Skip to content
Snippets Groups Projects
Commit 7b793958 authored by Robert Klöfkorn's avatar Robert Klöfkorn
Browse files

read dofmanager if it was written.

[[Imported from SVN: r3799]]
parent 5c3fe8b3
No related branches found
No related tags found
No related merge requests found
......@@ -161,13 +161,14 @@ namespace Dune {
double time, int timestep, int precision )
{
// write dof manager, that corresponds to grid
bool hasDm = false;
{
typedef DofManager<GridImp> DofManagerType;
typedef DofManagerFactory<DofManagerType> DMFactoryType;
std::string dmname(fnprefix);
dmname += "_dm";
DMFactoryType::writeDofManager(grid,dmname,timestep);
hasDm = DMFactoryType::writeDofManager(grid,dmname,timestep);
}
// write Grid itself
......@@ -177,6 +178,8 @@ namespace Dune {
file << "Grid: " << transformToGridName(grid.type()) << std::endl;
file << "Format: " << ftype << std::endl;
file << "Precision: " << precision << std::endl;
int writeDm = (hasDm) ? 1 : 0;
file << "DofManager: " << writeDm << std::endl;
GrapeIOStringType fnstr = genFilename(path,fnprefix,timestep,precision);
......@@ -221,14 +224,18 @@ namespace Dune {
int precision = 6;
readParameter(fnprefix,"Precision",precision);
int hasDm = 0;
readParameter(fnprefix,"DofManager",hasDm);
const char *path = "";
GrapeIOStringType fn = genFilename(path,fnprefix,timestep,precision);
std::cout << "Read file: fnprefix = `" << fn << "' \n";
bool succeded = false;
switch (ftype)
{
case xdr : return grid.template readGrid<xdr> (fn,time);
case ascii : return grid.template readGrid<ascii>(fn,time);
case xdr : succeded = grid.template readGrid<xdr> (fn,time); break;
case ascii : succeded = grid.template readGrid<ascii>(fn,time); break;
default :
{
std::cerr << ftype << " GrapeIOFileFormatType not supported at the moment! \n";
......@@ -237,7 +244,21 @@ namespace Dune {
return false;
}
}
return false;
// write dof manager, that corresponds to grid
if(hasDm)
{
typedef DofManager<GridImp> DofManagerType;
typedef DofManagerFactory<DofManagerType> DMFactoryType;
std::string dmname(fn);
dmname += "_dm";
//std::cout << "Read DofManager from file " << dmname << "\n";
// this call creates DofManager if not already existing
DMFactoryType::getDofManager(grid);
succeded = DMFactoryType::writeDofManager(grid,dmname,timestep);
}
return succeded;
}
template <class GridType>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment