|
From: John P. <pet...@cf...> - 2007-06-05 16:30:50
|
Hi,
It's possible to read in a GMV file and solutions.
Sample code:
{
Mesh mesh(dim);
GMVIO gmvio(mesh);
gmvio.read("meshfile.gmv");
}
If there were solution fields in the GMV file they
were read in as well and are now stored in the GMV
object. Suppose you later created an EquationSystems
object based on this mesh:
{
EquationSystems es(mesh);
TransientLinearImplicitSystem & heat_system =
es.add_system<TransientLinearImplicitSystem> ("HeatSystem");
heat_system.add_variable ("T", FIRST);
es.init();
}
Then, you can copy the solution you read in
from the GMV file to the EquationSystems object:
{
gmvio.copy_nodal_solution(es);
}
I did it in stages like this because you can't initialize the
EquationSystems without the mesh, and you can't easily put the
solution data into the EquationSystems object before it has been
initialized.
Note that there isn't much information stored in a GMV file: only
nodal (or cell, which I didn't support yet) data values, so this
feature is limited to reading in linear, Lagrange elements (sorry
Roy!).
If you wrote out a quadratic solution to a GMV file, it was probably
written out as linear sub-elements, so this is what will be read back
in, not your nice original quadratic solution. It will also probably
completely break on non-conforming (AMR) GMV files, I haven't even
tested that yet.
I mainly wrote this was to be able to post-process uniform GMV files
for which I forgot to also write out the xda files. I hope it will
be useful for that, and maybe other stuff.
-John
|