Hello, 

again, I have a question as far as reading meshes with tetgen is
concered. 
I read a mesh by 

Mesh new_mesh; 
EquationSystems new_equation_systems (new_mesh);
TetGenIO TETGEN(new_mesh);
          
OStringStream inmesh;
inmesh<<"geometry_wings/export_pov/out/"<<ReadMesh[actual_pulse]<<"_box.1.ele";
TETGEN.read(inmesh.str().c_str());


. 
Afterwards, if I look at the equation system I get n_dofs() = 0;

Up to now I have looped through the nodes and 

  MeshBase::node_iterator               nd              = mesh.nodes_begin();
  const MeshBase::node_iterator end_nd  = mesh.nodes_end();
        
int proc = 0;
  for ( ; nd != end_nd; ++nd){
          Node* NOD = *nd;
          NOD->processor_id() = proc;
          
  }             

My question now is, if the code still works in parallel? I would say
yes. As far as I know is the mesh always be on CPU, isn't it (unless I
use ParallelMesh which seems to be in developement stade). So, if I read
a mesh like above, manually set the processor ids and use a code like
ex9, everything works like if I created the mesh with libmesh?

thanks, 
Robert




Am Donnerstag, den 04.08.2011, 11:48 +0200 schrieb robert:
> Hi, 
> 
> could you just tell me how you implemented the public members
> 'element_attributes' and 'node_attributes'? In tetgen_io.C I just tried:
> 
> std::vector<Real> el_attr;
>  // Read attributes from the stream.
>       for (unsigned int j=0; j<nAttri; j++){
>               ele_stream >> dummy;  
>               ///roberts_region.push_back(dummy);  /// by R.B.
>               el_attr.push_back(dummy);
>         }
>         if (el_attr.size()>0)   /// by R.B.
>                element_attributes.push_back(el_attr);  /// by R.B.
>         nAttriel = nAttri;    /// by R.B.
>         
>     }
> 
> where element_attributes is defined as public: std::vector<
> std::vector<Real>  > in tetgen_io.h. I did the same for node_attributes.
> However, I get some bad alloc when reading the mesh.
> 
> Thank you, 
> Robert
> 
> 
> 
> 
> 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&reg; 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



------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. 
http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
Libmesh-users mailing list
Libmesh-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to