On Thu, Feb 11, 2010 at 5:55 PM, Karen Lee <[email protected]> wrote:
> Dear libmesh users,
>
> I have a few questions:
>
> 1) Having some problem reading tetgen meshes. Here's my sampleNode.node
> file:
>
> 4 3 1 0
> 1 1.0 1.0 1.0 1
> 2 2.0 1.0 1.0 1
> 3 1.0 1.0 2.0 1
> 4 1.0 2.0 1.0 1
>
> and sampleNode.ele file:
> 1 4 0 0
> 1 1 2 3 4
>
> I'm not sure why, but only 3 nodes were read in. I also experimented with
> spaces and comments, but no matter how I tinker with the .node and .ele
> files (including changing the node/ele IDs starting at 0 instead of 1), I
> haven't been able to get it to read in all 4 of the nodes...

I will try this example myself now, but off the top of my head, is
there a newline after the last line in the sampleNode.node file?


> The part of the code that did that was just:
>
> assert (dim == 3);
> Mesh mesh(dim);
> MeshData mesh_data(mesh);
>
> mesh_data.activate();
>
> mesh.read (mesh_file, &mesh_data);
>
>
> 2a) Regarding some comment I read in example 12: "Now we can safely read the
> input mesh. Note that this should be an .xda/.xdr or .unv file only,
> otherwise we cannot load/save associated data." It's for the line:
>
> mesh.read (mesh_file, &mesh_data);
>
> Is that still the case?

As far as I can tell, yes, none of the other formats I glanced through
actually appear to add data to a MeshData object while reading mesh
files.  If you take a look at how it's done for UNV format, you could
possibly get an idea of how you could adapt e.g. the TetgenIO reader
to do what you want...


> 2b) I'm very, very confused by the read/write file types allowed for the
> Mesh and MeshData classes. From the write function in MeshData, it seems
> that only xta, xtr and unv are allowed, but there's also a function in
> TecplotIO (and for Gmesh, etc) "write_nodal_data". I'm wondering if there's
> a way that data associated with nodes can be written into vtu, tecplot or
> tetgen files, or are the "write_nodal_data" functions just for reading the
> Mesh but not MeshData?

That's correct.  The (unfortunately named) write_nodal_data function,
at least in the TecplotIO class, only writes out solution values at
mesh points, it has nothing to do with MeshData.  For a while now, the
MeshData class has been mostly unsupported by the primary libmesh
developers (as none of us used it) but you may still find certain
places in the library where it works.

> 2c) Seeing that the various IO files seem to have data reading capability,
> I'm wondering using mesh.write/read(...) and mesh_data.write/read(...) are
> the only methods by which to read/write. I'm especialyl interested in
> reading in data and mesh... (from tetgen or vtu ideally...) Such

Glancing through the TetgenIO source it looks like it interacts with a
MeshData object, but I'm not sure how general it is.  It appears that
it's used for "add_foreign_elem_id" but beyond that I'm not sure if it
reads in general data at each nodal point.


> 3) More implementation problems: I modified the src file of example 12. one
> of the things I tried was to add the following line:
>
> TecplotIO(mesh).write_nodal_data("artificial.dat", artificial_data,
> "variable");
>
> after the original line 62:
>
> mesh_data.insert_node_data(artificial_data);
>
> It caused a compilation error that I don't know how to debug:
> g++ -o ex12 `../libmesh/contrib/bin/libmesh-config --include`
> `../libmesh/contrib/bin/libmesh-config --cxxflags` ex12.cxx
> `../libmesh/contrib/bin/libmesh-config --ldflags`
> ex12.cxx: In function ‘int main(int, char**)’:
> ex12.cxx:65: error: no matching function for call to
> ‘TecplotIO::write_nodal_data(const char [15], std::map<const Node*,
> std::vector<Number, std::allocator<Number> >, std::less<const Node*>,
> std::allocator<std::pair<const Node* const, std::vector<Number,
> std::allocator<Number> > > > >&, const char [9])’

TecplotIO::write_nodal_data takes the args: (string, vector<Number>,
vector<string>), it appears you passed a map as the second argument
and a string as the third, so that won't compile.

> I guess maybe I'm just not very clear how this is used. Could someone give
> me a correct example of reading/writing mesh/data with vtu/tetgen/tecplot
> data?

Examples 12, 8, and 7 are the closest thing I've got to MeshData
examples.  Tecplot doesn't use MeshData objects at all, VTK and Tetgen
both seem to use MeshData to a small degree but I couldn't find where
either of them go beyond the calls to add_foreign_node_id and actually
read data from the file...

-- 
John

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to