[Dune] questions about ElementID_to_physical_entity

Jö Fahlke jorrit at jorrit.de
Sat Apr 9 11:40:01 CEST 2011


Am Sat,  9. Apr 2011, 14:32:31 +0530 schrieb Jayesh Badwaik:
> i am trying to use elementid_to_physical_entity feature of the gmsh reader
> and the code i'm using is as follows
> 
> std::vector<int>    boundaryid;
> std::vector<int>    elementid;
> GridReader gridreader;
> GridPointer gridptr =  gridreader.read(gridfile, boundaryid, elementid,
> true, true);

I'm assuming GridPointer is something like Grid*, specifically that it is
*not* something like Dune::GridPtr<Grid>.

The problem is probably that the GmshReader stores the element and boundary
ids in the order the elements and boundary segments were inserted into the
grid.  Of course, you cannot know this order.  You can however obtain it from
the gridfactory the GmshReader uses to insert the mesh elements:

  Dune::GmshReader<Grid> gridreader;
  Dune::GridFactory<Grid> factory;
  gridreader.read(factory, gridfile, boundaryid, elementid, true, true);
  Grid *gridptr = factory.create();

and later

  int eid = elementid[factory.insertionIndex(element)];
  int bid = 0;
  if(factory.wasInserted(intersection))
    bid = boundaryid[factory.insertionIndex(intersection)];

Note that calling insertionIndex() is only valid as long as you didn't change
the grid since creation -- i.e. no globalRefine(), no adapt(), no
loadBalance().

@Dune: what is the purpose of those GmshReader::read() methods that fill
       element and boundary id but don't take a GidFactory?

Bye,
Jö.

-- 
If God had intended Man to Smoke, He would have set him on Fire.
-- fortune
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: Digital signature
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20110409/c4856fae/attachment.sig>


More information about the Dune mailing list