On Wed, Oct 19, 2011 at 9:05 AM, Matteo Semplice
<[email protected]> wrote:
>
> Well.... yes, but there are a couple of quirks:
>
> 1) The mesh must be initialized setting its dimension, like
>     Mesh mesh(2);
> since the Mesh constructor defauts to 1 and GmshIO::read_mesh chooses dim as
> const unsigned int dim = mesh.mesh_dimension
> <http://libmesh.sourceforge.net/doxygen/classMeshBase.php#a81ce19df31062ba94d8fea90f050a649>();
> and thus would not modify the mesh dimension.

The mesh dimension information (dimension of the highest geometric
element present) is not contained in the gmsh file header anywhere, so
the right thing to do is probably to set the mesh dimension after
reading all the elements, similar to what is done in the Exodus
reader... however, glancing through the code it looks as though the
dimension is used *during element reading* to determine whether to
read a lower-dimensional element as boundary info, so this might
require some additional thought to get right.  The best workaround in
the meantime is the one you have identified.


> 2) mesh.prepare_for_use();
>    is called after reading the mesh. I have no clue for this, but
> otherwise attempting to use the mesh complains about failing assertion
> mesh_is_prepared...

We generally don't call prepare_for_use() in any of the Mesh reader classes.

The current reason, AFAICT, is that prepare_for_use() calls
delete_remote_elements() which, when LibMesh is compiled with
ParallelMesh enabled, effectively converts the Mesh to a parallel data
structure.  The user may wish to postpone this operation until some
later time, hence we leave it up to him to call prepare_for_use().
(Maybe Roy can confirm whether that is the correct reasoning...)


> For the developers:
> maybe both points could be made more prominent in the documentation of
> GmshIO::read? Something like:
> "Note that for this method to work (in 2d and 3d) you have to set
> explicitly the mesh dimension prior to calling GmshIO::read and that
> Mesh::prepare_for_use() must be called after reading the mesh and before
> using it"

I agree that we should add this comment, at least until we can work
out the right way of setting the mesh dimension automatically.  It's
checked in now.

> I think that the note is needed since the docs of the Mesh constructor
> is a bit misleading in saying:
>
> libMesh::Mesh::Mesh ( unsigned int /dim/ = |1|) | [inline]|
> Constructor. Takes |dim|, the dimension of the mesh. The mesh dimension
> can be changed (and may automatically be changed by mesh
> generation/loading) later.

Not sure how this is misleading.

-- 
John

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to