/** * Convert this cell's attributes to a string format * @return a character array of this cell's attributes */ std::string CellFill::toString() { std::stringstream string; string << "Cell id = " << _id << ", type = FILL, universe_fill = " << _universe_fill.first << ", universe = " << _universe << ", num_surfaces = " << getNumSurfaces(); std::map<int, Surface*>::iterator iter; string << ", surface ids = "; for (iter = _surfaces.begin(); iter != _surfaces.end(); ++iter) string << iter->first << ", "; return string.str(); }
/** * @brief Convert this CellFill's attributes to a string format. * @return a character array of this Cell's attributes */ std::string CellFill::toString() { std::stringstream string; string << "Cell ID = " << _id << ", name = " << _name << ", type = FILL, " << ", fill = " << _fill->getId() << ", # surfaces = " << getNumSurfaces(); /** Add the IDs for the Surfaces in this Cell */ std::map<int, surface_halfspace>::iterator iter; string << ", surface ids = "; for (iter = _surfaces.begin(); iter != _surfaces.end(); ++iter) string << iter->first << ", "; return string.str(); }
/** * Convert this cell's attributes to a string format * @return a character array of this cell's attributes */ std::string CellBasic::toString() { std::stringstream string; string << "Cell id = " << _id << ", type = MATERIAL, material id = " << _material << ", universe = " << _universe << ", num_surfaces = " << getNumSurfaces() << ", num of rings = " << _num_rings << ", num of sectors = " << _num_sectors; std::map<int, Surface*>::iterator iter; string << ", surface ids = "; for (iter = _surfaces.begin(); iter != _surfaces.end(); ++iter) string << iter->first << ", "; return string.str(); }
/** * @brief Convert this CellBasic's attributes to a string format. * @return a character array of this CellBasic's attributes */ std::string CellBasic::toString() { std::stringstream string; string << "Cell ID = " << _id << ", name = " << _name << ", type = MATERIAL" << ", material id = " << _material->getId() << ", # surfaces = " << getNumSurfaces() << ", # rings = " << _num_rings << ", # sectors = " << _num_sectors; /* Append each of the surface ids to the string */ std::map<int, surface_halfspace>::iterator iter; string << ", surface ids = "; for (iter = _surfaces.begin(); iter != _surfaces.end(); ++iter) string << iter->first << ", "; return string.str(); }
void the::object::unbind() { if (!glIsBuffer(_bindId)) return; glDeleteBuffers(1, &_bindId); for (auto & s : surfaces) s.unbind(); resetID(); triangles = 0; logger::debug("[Object ] remove '%s' (%s) surfaces: %d; triangles: %d",getTag().c_str(), getType().c_str(),getNumSurfaces(),triangles); GL_CHECK("the::object::unbind"); }
void the::object::bind() { uint sz = vertexes.size(); if(sz == 0) return; glGenBuffers(1, &_bindId); glBindBuffer(GL_ARRAY_BUFFER, _bindId); glBufferData(GL_ARRAY_BUFFER, sz * sizeof(Vertex) , &vertexes[0], GL_STATIC_DRAW); for(auto & s : surfaces) s.bind(); recalculateBoundingBox(); triangles = 0; for(auto const &s : surfaces) triangles+=s.getNumTriangles(); logger::debug("[Object ] create '%s' (%s) surfaces: %d; triangles: %d",getTag().c_str(), getType().c_str(),getNumSurfaces(),triangles); GL_CHECK("the::object::bind"); }
void ofxPiMapper::eraseSurface(int i){ cout << "numSurfaces: " << getNumSurfaces() << ", i: " << i << endl; if(getNumSurfaces() > 0 && i < getNumSurfaces()){ _application.eraseSurface(i); } }