Hi,<br>thanks for your help<br>the code is working properly now.<br><br>I was using the Dune::GridPtr<Grid> before as you had suspected.<br>I actually got that idea from the dune-pdelab-howto manual <br>where they are using the same thing.<br>
especially the crankdiffusion problem (listing 16).<br><br><br clear="all"><br>Cheers and Regards,<br>Jayesh Vinay Badwaik<br>-----------------------------------------------------------------------------------------------------------<br>
<div>
<p>We are servants rather than masters in mathematics --- Charles Hermite<br></p>
</div><br><br><br><br>
<br><br><div class="gmail_quote">On Sat, Apr 9, 2011 at 15:10, Jö Fahlke <span dir="ltr"><<a href="mailto:jorrit@jorrit.de">jorrit@jorrit.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Am Sat, 9. Apr 2011, 14:32:31 +0530 schrieb Jayesh Badwaik:<br>
<div class="im">> i am trying to use elementid_to_physical_entity feature of the gmsh reader<br>
> and the code i'm using is as follows<br>
><br>
> std::vector<int> boundaryid;<br>
> std::vector<int> elementid;<br>
> GridReader gridreader;<br>
> GridPointer gridptr = gridreader.read(gridfile, boundaryid, elementid,<br>
> true, true);<br>
<br>
</div>I'm assuming GridPointer is something like Grid*, specifically that it is<br>
*not* something like Dune::GridPtr<Grid>.<br>
<br>
The problem is probably that the GmshReader stores the element and boundary<br>
ids in the order the elements and boundary segments were inserted into the<br>
grid. Of course, you cannot know this order. You can however obtain it from<br>
the gridfactory the GmshReader uses to insert the mesh elements:<br>
<br>
Dune::GmshReader<Grid> gridreader;<br>
Dune::GridFactory<Grid> factory;<br>
gridreader.read(factory, gridfile, boundaryid, elementid, true, true);<br>
Grid *gridptr = factory.create();<br>
<br>
and later<br>
<br>
int eid = elementid[factory.insertionIndex(element)];<br>
int bid = 0;<br>
if(factory.wasInserted(intersection))<br>
bid = boundaryid[factory.insertionIndex(intersection)];<br>
<br>
Note that calling insertionIndex() is only valid as long as you didn't change<br>
the grid since creation -- i.e. no globalRefine(), no adapt(), no<br>
loadBalance().<br>
<br>
@Dune: what is the purpose of those GmshReader::read() methods that fill<br>
element and boundary id but don't take a GidFactory?<br>
<br>
Bye,<br>
Jö.<br>
<font color="#888888"><br>
--<br>
If God had intended Man to Smoke, He would have set him on Fire.<br>
-- fortune<br>
</font><br>-----BEGIN PGP SIGNATURE-----<br>
Version: GnuPG v1.4.10 (GNU/Linux)<br>
<br>
iQIVAwUBTaApcemx9CKgc0OWAQjORxAAntWZMhdflziPqOAOXa4Bnms4twnF/g9L<br>
u4TWBh4VpQkBjyX28+sKe3/atHosPDsFR+o6lHI9zJyxusLxrMTbZ0r775JE2U2w<br>
1jhuV0gzqJqhVOeQngIvGYkxSpjj1SBlYkvGveLqfVIiuK6+PGjzlJLKm7g0jGsA<br>
jHawwYJBtygmjcgzp8PkvBwWCyGM23faIwUXgeT12OudkssSdw2ffRiZVVZey51w<br>
idrHUTOitKoK9WaKckeYXbCuP2kUINgkCNY83pgUDMQ07PDEExQA0EqbHOZHycHW<br>
vtla84KeJyyaWKydT1Mups9gcbLTuwxt6KlffCins381gB1IJz/mZl7Q0oOHJTLD<br>
2WnHUKnpAigKxpI9GgFFlmr/ajo27JMcG7sx24l+hzk1eIdqRfa38uFv08yR79Nx<br>
EQ7c1MFR887xYtIDHpotaiXnXPHNhEad60IAfUQEv25jy+0cgIgKJGPXTUtmvKEs<br>
SXphqrX+cgCho7uadUPf4RvwoHhKp8n5f9txTZACz7ZhiW2UvJkuE3CWSRVxVLBE<br>
SU+zuOlkvhYcc8hxEps6OLIcFtQuHgnM88RyaQrCSvC4Y7N7DnPbYCAD/0pK6ByY<br>
z6Ay2XzlMw8SSM+lBbMH5meeblq4nEobBI0ZEfXdb29qVkcsSsoxJyMBmVyFuW4M<br>
cNdWEUABNu0=<br>
=yGSV<br>
-----END PGP SIGNATURE-----<br>
<br></blockquote></div><br>