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. 

Regards, 
Robert




Am Mittwoch, den 03.08.2011, 09:01 -0600 schrieb John Peterson:
> On Wed, Aug 3, 2011 at 7:10 AM, robert <robert.bod...@unil.ch> wrote:
> > Hi to all,
> >
> > I want to read a mesh from a tetgen-output file. In tetgen I have
> > specified different regions. Now I am trying to read the mesh by:
> >
> > Mesh new_mesh;
> > new_mesh.read("mesh/almirante_box.1.ele");
> >
> >
> > Here are the first lines of my *.ele file:
> >
> > 542385  4  1
> >    1   16340 63454 13659 86041    1
> >    2   44851 69045 38700 85823    1
> >    3   39598 38395 28168 28167    1
> >    4   54393 80195 67081 80196    2
> >    5   15767 74613 35521 53993    2
> >    6   11944 83706 12467 87606    1
> >    7    5102  6153  7395 16715    2
> >    8   75849 79502 33646 79520    1
> >    9   10026 61126 14569 71718    1
> >   10   50667 50803 33989 79888    1
> >
> >
> > As you can see, the last figures describe to which region the respective
> > tetrahedra belongs. However, now I am stuck with the quite simple
> > problem to find these values in my libmesh-mesh.
> > I have tried something like:
> >
> > elem->subdomain_id();
> >
> > when looping through the elements. But since the new_mesh.n_subdomains()
> > returns 1, this didn't work.
> 
> Looks like at the moment, we read in and discard the last value(s),
> but we could easily use it to set the subdomain_id...
> 
> Apparently there can be any number of "attributes" specified for each
> element, but I don't think there's a way to specify in the file what
> each attribute means.
> 
> Could you send me a much smaller example mesh file (or tell me the
> steps used to create it)?  I've never used tetgen directly before.
> 
> I also suspect this code will need a few updates for ParallelMesh...
> 



------------------------------------------------------------------------------
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

Reply via email to