I tried to add the vectors myself because with libmesh-version 0.7.1 I get the following errors:
ThermoPaine3d.C: In function ‘int main(int, char**)’: ThermoPaine3d.C:238: error: ‘class libMesh::TetGenIO’ has no member named ‘element_attributes’ ThermoPaine3d.C:239: error: ‘class libMesh::TetGenIO’ has no member named ‘node_attributes’ make: *** [ThermoPaine3d.i686-pc-linux-gnu.opt.o] Fehler 1 robert@robert:~/Desktop/THERMO_PAINE/3D$ Am Mittwoch, den 03.08.2011, 16:48 -0600 schrieb John Peterson: > On Wed, Aug 3, 2011 at 12:36 PM, robert <robert.bod...@unil.ch> wrote: > > Hi John, > > > > I found a simple way to work around the problem. I just added a public > > vector > > > > std::vector<Real> roberts_region; > > > > to the class TetGenIO. In the according function TetGenIO::read(...) the > > following is already implemented: > > > > // Read attributes from the stream. > > for (unsigned int j=0; j<nAttri; j++) > > ele_stream >> dummy; > > > > . This can be found around line 251 of tetgen_io.C (version 0.7.1). > > Here, I just added > > > > roberts_region.push_back(dummy); > > > > Now, I just have to create an object TetGenIO TETGEN when reading the > > mesh and with TETGEN.roberts_region.at(...) I can get my attributes. > > I do this immediately after reading the mesh and before any refinement. > > > > This is maybe not the most elegant way to do it. However, it seems to > > work. > > I just checked in something similar but slightly more general in that > it will read multiple attributes per element as well as node > attributes. > > They are stored in the public members "element_attributes" and > "node_attributes" respectively, which are vector<vector<Real> >'s. > > Here's some test code you can try out, it seemed to work fine with the > mesh file you sent me... > > // Manual IO object creation. We need to use this if > // we want the attributes to hang around after the reading is finished... > TetGenIO t(mesh); > t.read(filename); > > unsigned n_elem_attributes = t.element_attributes.size(); > unsigned n_node_attributes = t.node_attributes.size(); > > // Assign subdomain IDs based on the read in element attributes > if (n_elem_attributes == 1) > { > MeshBase::element_iterator it = mesh.elements_begin(); > const MeshBase::element_iterator end = mesh.elements_end(); > unsigned ctr=0; > for ( ; it != end; ++it, ctr++) > { > Elem* elem = *it; > > // Assign the subdomain ID from t.element_attributes[0] > elem->subdomain_id() = > static_cast<subdomain_id_type>(t.element_attributes[0][ctr]); > } // end loop over elements > } // end if n_elem_attributes > > // Write out the mesh in a different (Exodus) format > mesh.write("tetgen_read_test.e"); > ------------------------------------------------------------------------------ BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA The must-attend event for mobile developers. Connect with experts. Get tools for creating Super Apps. See the latest technologies. Sessions, hands-on labs, demos & much more. Register early & save! http://p.sf.net/sfu/rim-blackberry-1 _______________________________________________ Libmesh-users mailing list Libmesh-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libmesh-users