Skip to content
Snippets Groups Projects
Commit 63f7af45 authored by Oliver Sander's avatar Oliver Sander Committed by sander@PCPOOL.MI.FU-BERLIN.DE
Browse files

replace hand-written code to read and write 3d iterates by AmiraMesh I/O

[[Imported from SVN: r4878]]
parent f7b84027
No related branches found
No related tags found
No related merge requests found
...@@ -471,16 +471,10 @@ int main (int argc, char *argv[]) try ...@@ -471,16 +471,10 @@ int main (int argc, char *argv[]) try
std::stringstream iAsAscii; std::stringstream iAsAscii;
iAsAscii << i; iAsAscii << i;
std::string iSolFilename = resultPath + "tmp/intermediate3dSolution_" + iAsAscii.str(); std::string iSolFilename = resultPath + "tmp/intermediate3dSolution_" + iAsAscii.str();
FILE* fp = fopen(iSolFilename.c_str(), "wb");
if (!fp)
DUNE_THROW(SolverError, "Couldn't open file " << iSolFilename << " for writing");
for (int j=0; j<x3d.size(); j++)
for (int k=0; k<dim; k++)
fwrite(&x3d[j][k], sizeof(double), 1, fp);
fclose(fp); LeafAmiraMeshWriter<GridType> amiraMeshWriter;
amiraMeshWriter.addVertexData(x3d, grid.leafView());
amiraMeshWriter.write(iSolFilename);
// Then the rod // Then the rod
iSolFilename = resultPath + "tmp/intermediateRodSolution_" + iAsAscii.str(); iSolFilename = resultPath + "tmp/intermediateRodSolution_" + iAsAscii.str();
...@@ -619,19 +613,13 @@ int main (int argc, char *argv[]) try ...@@ -619,19 +613,13 @@ int main (int argc, char *argv[]) try
std::stringstream iAsAscii; std::stringstream iAsAscii;
iAsAscii << i; iAsAscii << i;
std::string iSolFilename = resultPath + "tmp/intermediate3dSolution_" + iAsAscii.str(); std::string iSolFilename = resultPath + "tmp/intermediate3dSolution_" + iAsAscii.str();
FILE* fpInt = fopen(iSolFilename.c_str(), "rb"); AmiraMeshReader<int>::readFunction(intermediateSol3d, iSolFilename);
if (!fpInt)
DUNE_THROW(IOError, "Couldn't open intermediate solution '" << iSolFilename << "'");
for (int j=0; j<intermediateSol3d.size(); j++)
fread(&intermediateSol3d[j], sizeof(double), dim, fpInt);
fclose(fpInt);
// Read rod solution from file // Read rod solution from file
iSolFilename = resultPath + "tmp/intermediateRodSolution_" + iAsAscii.str(); iSolFilename = resultPath + "tmp/intermediateRodSolution_" + iAsAscii.str();
fpInt = fopen(iSolFilename.c_str(), "rb"); FILE* fpInt = fopen(iSolFilename.c_str(), "rb");
if (!fpInt) if (!fpInt)
DUNE_THROW(IOError, "Couldn't open intermediate solution '" << iSolFilename << "'"); DUNE_THROW(IOError, "Couldn't open intermediate solution '" << iSolFilename << "'");
for (int j=0; j<intermediateSolRod.size(); j++) { for (int j=0; j<intermediateSolRod.size(); j++) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment