Commit 299ccf0d authored by Thomas Witkowski's avatar Thomas Witkowski

* writeResidualMesh() for ProblemScal and ProblemVec

parent 6c052dc3
......@@ -12,7 +12,6 @@ if USE_PARALLEL_AMDIS
PARALLEL_AMDIS_SOURCES = \
$(PARALLEL_DIR)/ConditionalEstimator.h $(PARALLEL_DIR)/ConditionalEstimator.cc \
$(PARALLEL_DIR)/ConditionalMarker.h \
$(PARALLEL_DIR)/ElementFileWriter.h $(PARALLEL_DIR)/ElementFileWriter.cc \
$(PARALLEL_DIR)/MeshStructure.h $(PARALLEL_DIR)/MeshStructure.cc \
$(PARALLEL_DIR)/MeshStructure_ED.h \
$(PARALLEL_DIR)/ParallelError.h $(PARALLEL_DIR)/ParallelError.hh \
......@@ -95,6 +94,7 @@ $(SOURCE_DIR)/ProblemStatBase.h \
$(SOURCE_DIR)/MatVecMultiplier.cc \
$(SOURCE_DIR)/DOFContainer.h \
$(SOURCE_DIR)/FileWriter.h $(SOURCE_DIR)/FileWriter.hh $(SOURCE_DIR)/FileWriter.cc \
$(SOURCE_DIR)/ElementFileWriter.h $(SOURCE_DIR)/ElementFileWriter.cc \
$(SOURCE_DIR)/ElInfo.cc \
$(SOURCE_DIR)/MatVecMultiplier.h \
$(SOURCE_DIR)/Operator.h $(SOURCE_DIR)/Operator.cc \
......
......@@ -64,8 +64,6 @@ libamdis_la_LIBADD =
am__libamdis_la_SOURCES_DIST = $(PARALLEL_DIR)/ConditionalEstimator.h \
$(PARALLEL_DIR)/ConditionalEstimator.cc \
$(PARALLEL_DIR)/ConditionalMarker.h \
$(PARALLEL_DIR)/ElementFileWriter.h \
$(PARALLEL_DIR)/ElementFileWriter.cc \
$(PARALLEL_DIR)/MeshStructure.h \
$(PARALLEL_DIR)/MeshStructure.cc \
$(PARALLEL_DIR)/MeshStructure_ED.h \
......@@ -137,7 +135,8 @@ am__libamdis_la_SOURCES_DIST = $(PARALLEL_DIR)/ConditionalEstimator.h \
$(SOURCE_DIR)/ProblemStatBase.h \
$(SOURCE_DIR)/MatVecMultiplier.cc $(SOURCE_DIR)/DOFContainer.h \
$(SOURCE_DIR)/FileWriter.h $(SOURCE_DIR)/FileWriter.hh \
$(SOURCE_DIR)/FileWriter.cc $(SOURCE_DIR)/ElInfo.cc \
$(SOURCE_DIR)/FileWriter.cc $(SOURCE_DIR)/ElementFileWriter.h \
$(SOURCE_DIR)/ElementFileWriter.cc $(SOURCE_DIR)/ElInfo.cc \
$(SOURCE_DIR)/MatVecMultiplier.h $(SOURCE_DIR)/Operator.h \
$(SOURCE_DIR)/Operator.cc $(SOURCE_DIR)/Mesh.cc \
$(SOURCE_DIR)/AMDiS.h $(SOURCE_DIR)/AdaptStationary.h \
......@@ -228,7 +227,6 @@ am__libamdis_la_SOURCES_DIST = $(PARALLEL_DIR)/ConditionalEstimator.h \
$(SOURCE_DIR)/PeriodicInfo.h $(SOURCE_DIR)/OpenMP.h
@USE_PARALLEL_AMDIS_TRUE@am__objects_1 = \
@USE_PARALLEL_AMDIS_TRUE@ libamdis_la-ConditionalEstimator.lo \
@USE_PARALLEL_AMDIS_TRUE@ libamdis_la-ElementFileWriter.lo \
@USE_PARALLEL_AMDIS_TRUE@ libamdis_la-MeshStructure.lo \
@USE_PARALLEL_AMDIS_TRUE@ libamdis_la-ParallelProblem.lo \
@USE_PARALLEL_AMDIS_TRUE@ libamdis_la-ParMetisPartitioner.lo
......@@ -254,9 +252,9 @@ am_libamdis_la_OBJECTS = $(am__objects_1) \
libamdis_la-SurfaceQuadrature.lo libamdis_la-LeafData.lo \
libamdis_la-BoundaryManager.lo libamdis_la-DirichletBC.lo \
libamdis_la-RobinBC.lo libamdis_la-MatVecMultiplier.lo \
libamdis_la-FileWriter.lo libamdis_la-ElInfo.lo \
libamdis_la-Operator.lo libamdis_la-Mesh.lo \
libamdis_la-AdaptStationary.lo \
libamdis_la-FileWriter.lo libamdis_la-ElementFileWriter.lo \
libamdis_la-ElInfo.lo libamdis_la-Operator.lo \
libamdis_la-Mesh.lo libamdis_la-AdaptStationary.lo \
libamdis_la-AdaptInstationary.lo \
libamdis_la-DiagonalPreconditioner.lo \
libamdis_la-ILUPreconditioner.lo \
......@@ -447,7 +445,6 @@ AMDIS_INCLUDES = -I$(SOURCE_DIR) $(am__append_2)
@USE_PARALLEL_AMDIS_TRUE@PARALLEL_AMDIS_SOURCES = \
@USE_PARALLEL_AMDIS_TRUE@ $(PARALLEL_DIR)/ConditionalEstimator.h $(PARALLEL_DIR)/ConditionalEstimator.cc \
@USE_PARALLEL_AMDIS_TRUE@ $(PARALLEL_DIR)/ConditionalMarker.h \
@USE_PARALLEL_AMDIS_TRUE@ $(PARALLEL_DIR)/ElementFileWriter.h $(PARALLEL_DIR)/ElementFileWriter.cc \
@USE_PARALLEL_AMDIS_TRUE@ $(PARALLEL_DIR)/MeshStructure.h $(PARALLEL_DIR)/MeshStructure.cc \
@USE_PARALLEL_AMDIS_TRUE@ $(PARALLEL_DIR)/MeshStructure_ED.h \
@USE_PARALLEL_AMDIS_TRUE@ $(PARALLEL_DIR)/ParallelError.h $(PARALLEL_DIR)/ParallelError.hh \
......@@ -511,6 +508,7 @@ $(SOURCE_DIR)/ProblemStatBase.h \
$(SOURCE_DIR)/MatVecMultiplier.cc \
$(SOURCE_DIR)/DOFContainer.h \
$(SOURCE_DIR)/FileWriter.h $(SOURCE_DIR)/FileWriter.hh $(SOURCE_DIR)/FileWriter.cc \
$(SOURCE_DIR)/ElementFileWriter.h $(SOURCE_DIR)/ElementFileWriter.cc \
$(SOURCE_DIR)/ElInfo.cc \
$(SOURCE_DIR)/MatVecMultiplier.h \
$(SOURCE_DIR)/Operator.h $(SOURCE_DIR)/Operator.cc \
......@@ -799,13 +797,6 @@ libamdis_la-ConditionalEstimator.lo: $(PARALLEL_DIR)/ConditionalEstimator.cc
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -c -o libamdis_la-ConditionalEstimator.lo `test -f '$(PARALLEL_DIR)/ConditionalEstimator.cc' || echo '$(srcdir)/'`$(PARALLEL_DIR)/ConditionalEstimator.cc
libamdis_la-ElementFileWriter.lo: $(PARALLEL_DIR)/ElementFileWriter.cc
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -MT libamdis_la-ElementFileWriter.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-ElementFileWriter.Tpo" -c -o libamdis_la-ElementFileWriter.lo `test -f '$(PARALLEL_DIR)/ElementFileWriter.cc' || echo '$(srcdir)/'`$(PARALLEL_DIR)/ElementFileWriter.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-ElementFileWriter.Tpo" "$(DEPDIR)/libamdis_la-ElementFileWriter.Plo"; else rm -f "$(DEPDIR)/libamdis_la-ElementFileWriter.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(PARALLEL_DIR)/ElementFileWriter.cc' object='libamdis_la-ElementFileWriter.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -c -o libamdis_la-ElementFileWriter.lo `test -f '$(PARALLEL_DIR)/ElementFileWriter.cc' || echo '$(srcdir)/'`$(PARALLEL_DIR)/ElementFileWriter.cc
libamdis_la-MeshStructure.lo: $(PARALLEL_DIR)/MeshStructure.cc
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -MT libamdis_la-MeshStructure.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-MeshStructure.Tpo" -c -o libamdis_la-MeshStructure.lo `test -f '$(PARALLEL_DIR)/MeshStructure.cc' || echo '$(srcdir)/'`$(PARALLEL_DIR)/MeshStructure.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-MeshStructure.Tpo" "$(DEPDIR)/libamdis_la-MeshStructure.Plo"; else rm -f "$(DEPDIR)/libamdis_la-MeshStructure.Tpo"; exit 1; fi
......@@ -1100,6 +1091,13 @@ libamdis_la-FileWriter.lo: $(SOURCE_DIR)/FileWriter.cc
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -c -o libamdis_la-FileWriter.lo `test -f '$(SOURCE_DIR)/FileWriter.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/FileWriter.cc
libamdis_la-ElementFileWriter.lo: $(SOURCE_DIR)/ElementFileWriter.cc
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -MT libamdis_la-ElementFileWriter.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-ElementFileWriter.Tpo" -c -o libamdis_la-ElementFileWriter.lo `test -f '$(SOURCE_DIR)/ElementFileWriter.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/ElementFileWriter.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-ElementFileWriter.Tpo" "$(DEPDIR)/libamdis_la-ElementFileWriter.Plo"; else rm -f "$(DEPDIR)/libamdis_la-ElementFileWriter.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(SOURCE_DIR)/ElementFileWriter.cc' object='libamdis_la-ElementFileWriter.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -c -o libamdis_la-ElementFileWriter.lo `test -f '$(SOURCE_DIR)/ElementFileWriter.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/ElementFileWriter.cc
libamdis_la-ElInfo.lo: $(SOURCE_DIR)/ElInfo.cc
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -MT libamdis_la-ElInfo.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-ElInfo.Tpo" -c -o libamdis_la-ElInfo.lo `test -f '$(SOURCE_DIR)/ElInfo.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/ElInfo.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-ElInfo.Tpo" "$(DEPDIR)/libamdis_la-ElInfo.Plo"; else rm -f "$(DEPDIR)/libamdis_la-ElInfo.Tpo"; exit 1; fi
......
......@@ -44,7 +44,7 @@ available_tags=" CXX F77"
# ### BEGIN LIBTOOL CONFIG
# Libtool was configured on host NWRW20:
# Libtool was configured on host NWRW15:
# Shell to use when invoking shell scripts.
SHELL="/bin/sh"
......@@ -7266,7 +7266,7 @@ disable_libs=static
# End:
# ### BEGIN LIBTOOL TAG CONFIG: CXX
# Libtool was configured on host NWRW20:
# Libtool was configured on host NWRW15:
# Shell to use when invoking shell scripts.
SHELL="/bin/sh"
......@@ -7574,7 +7574,7 @@ include_expsyms=""
# ### BEGIN LIBTOOL TAG CONFIG: F77
# Libtool was configured on host NWRW20:
# Libtool was configured on host NWRW15:
# Shell to use when invoking shell scripts.
SHELL="/bin/sh"
......@@ -7618,7 +7618,7 @@ LTCC="gcc"
LTCFLAGS="-g -O2"
# A language-specific compiler.
CC="f95"
CC="g77"
# Is the compiler the GNU C compiler?
with_gcc=yes
......@@ -7858,7 +7858,7 @@ variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COM
link_all_deplibs=unknown
# Compile-time system search path for libraries
sys_lib_search_path_spec=`echo " /usr/lib/gcc/i386-redhat-linux/4.1.2/ /usr/lib/gcc/i386-redhat-linux/4.1.2/ /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../i386-redhat-linux/lib/i386-redhat-linux/4.1.2/ /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../i386-redhat-linux/lib/ /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../i386-redhat-linux/4.1.2/ /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../ /lib/i386-redhat-linux/4.1.2/ /lib/ /usr/lib/i386-redhat-linux/4.1.2/ /usr/lib/" | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"`
sys_lib_search_path_spec=`echo " /usr/lib/gcc/i386-redhat-linux/3.4.6/ /usr/lib/gcc/i386-redhat-linux/3.4.6/ /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../i386-redhat-linux/lib/i386-redhat-linux/3.4.6/ /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../i386-redhat-linux/lib/ /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../i386-redhat-linux/3.4.6/ /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../ /lib/i386-redhat-linux/3.4.6/ /lib/ /usr/lib/i386-redhat-linux/3.4.6/ /usr/lib/" | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"`
# Run-time system search path for libraries
sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/qt-3.3/lib "
......
#include "ElementFileWriter.h"
#include "BasisFunction.h"
#include "Parameters.h"
#include "Traverse.h"
#include "AdaptInfo.h"
using namespace std;
ElementFileWriter::ElementFileWriter(const std::string& name_,
Mesh *mesh_,
const FiniteElemSpace *feSpace_,
std::map<int, int> &vec_)
: name(name_),
tecplotExt(".plt"),
amdisMeshDatExt(".elem.mesh"),
writeTecPlotFormat(0),
writeAMDiSFormat(0),
appendIndex(0),
indexLength(5),
indexDecimals(3),
tsModulo(1),
timestepNumber(-1),
mesh(mesh_),
feSpace(feSpace_),
vec(vec_)
{
GET_PARAMETER(0, name + "->output->filename", &filename);
GET_PARAMETER(0, name + "->output->TecPlot format", "%d",
&writeTecPlotFormat);
GET_PARAMETER(0, name + "->output->TecPlot ext", &tecplotExt);
GET_PARAMETER(0, name + "->output->AMDiS format", "%d", &writeAMDiSFormat);
GET_PARAMETER(0, name + "->output->AMDiS mesh-dat ext", &amdisMeshDatExt);
GET_PARAMETER(0, name + "->output->append index", "%d", &appendIndex);
GET_PARAMETER(0, name + "->output->index length", "%d", &indexLength);
GET_PARAMETER(0, name + "->output->index decimals", "%d", &indexDecimals);
GET_PARAMETER(0, name + "->output->write every i-th timestep", "%d",
&tsModulo);
// TEST_EXIT(vec.size() == mesh->getNumberOfLeaves())
// ("illegal size !\n");
}
namespace AMDiS {
ElementFileWriter::ElementFileWriter(const std::string& name_,
Mesh *mesh_,
const FiniteElemSpace *feSpace_,
std::map<int, double> &vec_)
: name(name_),
tecplotExt(".plt"),
amdisMeshDatExt(".elem.mesh"),
vtkExt(".vtu"),
writeTecPlotFormat(0),
writeAMDiSFormat(0),
writeVtkFormat(0),
appendIndex(0),
indexLength(5),
indexDecimals(3),
tsModulo(1),
timestepNumber(-1),
mesh(mesh_),
feSpace(feSpace_),
vec(vec_)
{
GET_PARAMETER(0, name + "->output->filename", &filename);
GET_PARAMETER(0, name + "->output->TecPlot format", "%d",
&writeTecPlotFormat);
GET_PARAMETER(0, name + "->output->TecPlot ext", &tecplotExt);
GET_PARAMETER(0, name + "->output->AMDiS format", "%d", &writeAMDiSFormat);
GET_PARAMETER(0, name + "->output->AMDiS mesh-dat ext", &amdisMeshDatExt);
GET_PARAMETER(0, name + "->output->ParaView format", "%d", &writeVtkFormat);
GET_PARAMETER(0, name + "->output->append index", "%d", &appendIndex);
GET_PARAMETER(0, name + "->output->index length", "%d", &indexLength);
GET_PARAMETER(0, name + "->output->index decimals", "%d", &indexDecimals);
GET_PARAMETER(0, name + "->output->write every i-th timestep", "%d",
&tsModulo);
// TEST_EXIT(vec.size() == mesh->getNumberOfLeaves())
// ("illegal size !\n");
}
void
ElementFileWriter::writeFiles(AdaptInfo *adaptInfo, bool force)
{
FUNCNAME("ElementFileWriter::writeFiles()");
void ElementFileWriter::writeFiles(AdaptInfo *adaptInfo, bool force,
int level, Flag traverseFlag, bool (*writeElem)(ElInfo*))
{
FUNCNAME("ElementFileWriter::writeFiles()");
timestepNumber++;
timestepNumber %= tsModulo;
timestepNumber++;
timestepNumber %= tsModulo;
if((timestepNumber != 0) && !force) return;
if ((timestepNumber != 0) && !force)
return;
std::string fn = filename;
std::string fn = filename;
if(appendIndex) {
TEST_EXIT(indexLength <= 99)("index lenght > 99\n");
TEST_EXIT(indexDecimals <= 97)("index decimals > 97\n");
TEST_EXIT(indexDecimals < indexLength)
("index length <= index decimals\n");
if (appendIndex) {
TEST_EXIT(indexLength <= 99)("index lenght > 99\n");
TEST_EXIT(indexDecimals <= 97)("index decimals > 97\n");
TEST_EXIT(indexDecimals < indexLength)("index length <= index decimals\n");
char formatStr[9];
char formatStr[9];
sprintf(formatStr, "%%0%d.%df", indexLength, indexDecimals);
sprintf(formatStr, "%%0%d.%df", indexLength, indexDecimals);
char timeStr[20];
char timeStr[20];
sprintf(timeStr, formatStr, adaptInfo ? adaptInfo->getTime() : 0.0);
sprintf(timeStr, formatStr, adaptInfo ? adaptInfo->getTime() : 0.0);
fn += timeStr;
}
fn += timeStr;
}
if(writeTecPlotFormat) {
writeTecPlotValues(const_cast<char*>((fn + tecplotExt).c_str()));
MSG("TecPlot file written to %s\n", (fn + tecplotExt).c_str());
}
if (writeTecPlotFormat) {
TEST_EXIT(mesh)("no mesh\n");
writeTecPlotValues(const_cast<char*>((fn + tecplotExt).c_str()));
MSG("TecPlot file written to %s\n", (fn + tecplotExt).c_str());
}
if(writeAMDiSFormat) {
TEST_EXIT(mesh)("no mesh\n");
if (writeAMDiSFormat) {
TEST_EXIT(mesh)("no mesh\n");
writeMeshDatValues(const_cast<char*>( (fn + amdisMeshDatExt).c_str()),
adaptInfo ? adaptInfo->getTime() : 0.0);
writeMeshDatValues(const_cast<char*>( (fn + amdisMeshDatExt).c_str()),
adaptInfo ? adaptInfo->getTime() : 0.0);
MSG("MeshDat file written to %s\n", (fn + amdisMeshDatExt).c_str());
}
MSG("MeshDat file written to %s\n", (fn + amdisMeshDatExt).c_str());
}
}
if (writeVtkFormat) {
TEST_EXIT(mesh)("no mesh\n");
void
ElementFileWriter::writeTecPlotValues(const char* filename)
{
FUNCNAME("ElementFileWriter::writeTecPlotValues()");
ofstream fout(filename);
TEST_EXIT(fout)("Could not open file %s !\n", filename);
fout.setf(std::ios::scientific,std::ios::floatfield);
int dim = mesh->getDim();
double val;
// === Write header. ===
fout << "TITLE = \"" << name.c_str() << "\"\n";
fout << "VARIABLES = ";
switch(dim) {
case 2: fout << "\"x\",\"y\"";
break;
case 3: fout << "\"x\",\"y\",\"z\"";
break;
default: ERROR_EXIT("illegal dimension !\n");
break;
}
fout << ",\"" << name.c_str() << "\"\n";
fout << "ZONE T=\"" << name.c_str() << "\""
<< ", N=" << 3*mesh->getNumberOfLeaves()
<< ", E=" << mesh->getNumberOfLeaves()
<< ", F=FEPOINT, ";
switch(dim) {
case 2: fout << "ET=TRIANGLE\n\n";
break;
case 3: fout << "ET=TETRAHEDRON\n\n";
break;
default: ERROR_EXIT("illegal dimension !\n");
break;
writeVtkValues(const_cast<char*>( (fn + vtkExt).c_str()));
MSG("VTK file written to %s\n", (fn + vtkExt).c_str());
}
}
void ElementFileWriter::writeTecPlotValues(const char* filename)
{
FUNCNAME("ElementFileWriter::writeTecPlotValues()");
::std::ofstream fout(filename);
TEST_EXIT(fout)("Could not open file %s !\n", filename);
fout.setf(std::ios::scientific,std::ios::floatfield);
// === Write vertex coordinates and values (for each element !). ===
TraverseStack stack;
int dim = mesh->getDim();
double val;
ElInfo *elInfo = stack.traverseFirst(mesh,
-1,
Mesh::CALL_LEAF_EL |
Mesh::FILL_COORDS);
while(elInfo) {
// === Write header. ===
fout << "TITLE = \"" << name.c_str() << "\"\n";
fout << "VARIABLES = ";
switch (dim) {
case 2: fout << "\"x\",\"y\"";
break;
case 3: fout << "\"x\",\"y\",\"z\"";
break;
default: ERROR_EXIT("illegal dimension !\n");
break;
}
fout << ",\"" << name.c_str() << "\"\n";
fout << "ZONE T=\"" << name.c_str() << "\""
<< ", N=" << 3*mesh->getNumberOfLeaves()
<< ", E=" << mesh->getNumberOfLeaves()
<< ", F=FEPOINT, ";
switch (dim) {
case 2: fout << "ET=TRIANGLE\n\n";
break;
case 3: fout << "ET=TETRAHEDRON\n\n";
break;
default: ERROR_EXIT("illegal dimension !\n");
break;
}
// === Write vertex coordinates and values (for each element !). ===
TraverseStack stack;
// Get element value.
val = (double) vec[elInfo->getElement()->getIndex()];
ElInfo *elInfo = stack.traverseFirst(mesh,
-1,
Mesh::CALL_LEAF_EL |
Mesh::FILL_COORDS);
while (elInfo) {
// Get element value.
val = vec[elInfo->getElement()->getIndex()];
// Write coordinates of all element vertices and element value.
for (int i=0; i<=dim; ++i) {
// Write coordinates of all element vertices and element value.
for (int i = 0; i <= dim; ++i) {
for (int j=0; j<dim; ++j) {
fout << elInfo->getCoord(i)[j] << " ";
for (int j = 0; j < dim; ++j) {
fout << elInfo->getCoord(i)[j] << " ";
}
fout << val << "\n";
}
fout << val << "\n";
}
elInfo = stack.traverseNext(elInfo);
} // end of: mesh traverse
elInfo = stack.traverseNext(elInfo);
} // end of: mesh traverse
// === Write elements. ===
int numLeaves = mesh->getNumberOfLeaves();
int vertCntr = 0;
fout << "\n";
for (int i=0; i<numLeaves; ++i) {
for (int j=0; j<=dim; ++j) {
// === Write elements. ===
int numLeaves = mesh->getNumberOfLeaves();
int vertCntr = 0;
fout << "\n";
++vertCntr;
fout << vertCntr << " ";
for (int i = 0; i<numLeaves; ++i) {
for (int j = 0; j<=dim; ++j) {
++vertCntr;
fout << vertCntr << " ";
}
fout << "\n";
}
fout << "\n";
fout.close();
}
void ElementFileWriter::writeMeshDatValues(const char* filename, double time)
{
FUNCNAME("ElementFileWriter::writeMeshDatValues()");
::std::ofstream fout(filename);
fout.close();
}
TEST_EXIT(fout)("Could not open file %s !\n", filename);
void
ElementFileWriter::writeMeshDatValues(const char* filename, double time)
{
FUNCNAME("ElementFileWriter::writeMeshDatValues()");
ofstream fout(filename);
int dim = mesh->getDim();
double val;
TEST_EXIT(fout)("Could not open file %s !\n", filename);
// === Write header. ===
fout << "mesh name: " << mesh->getName().c_str() << "\n\n";
fout << "time: " << time << "\n\n";
fout << "DIM: " << dim << "\n";
fout << "DIM_OF_WORLD: " << Global::getGeo(WORLD) << "\n\n";
fout << "number of vertices: " << (dim+1)*mesh->getNumberOfLeaves() << "\n";
fout << "number of elements: " << mesh->getNumberOfLeaves() << "\n\n";
int dim = mesh->getDim();
double val;
// === Write header. ===
fout << "mesh name: " << mesh->getName().c_str() << "\n\n";
fout << "time: " << time << "\n\n";
fout << "DIM: " << dim << "\n";
fout << "DIM_OF_WORLD: " << Global::getGeo(WORLD) << "\n\n";
fout << "number of vertices: " << (dim+1)*mesh->getNumberOfLeaves() << "\n";
fout << "number of elements: " << mesh->getNumberOfLeaves() << "\n\n";
// === Write vertex coordinates (every vertex for every element). ===
fout << "vertex coordinates:\n";
TraverseStack stack;
ElInfo *elInfo = stack.traverseFirst(mesh,
-1,
Mesh::CALL_LEAF_EL |
Mesh::FILL_COORDS);
// === Write vertex coordinates (every vertex for every element). ===
fout << "vertex coordinates:\n";
TraverseStack stack;
while (elInfo) {
ElInfo *elInfo = stack.traverseFirst(mesh,
-1,
Mesh::CALL_LEAF_EL |
Mesh::FILL_COORDS);
// Write coordinates of all element vertices.
for (int i = 0; i <= dim; ++i) {
for (int j = 0; j < dim; ++j) {
fout << elInfo->getCoord(i)[j] << " ";
}
fout << "\n";
}
elInfo = stack.traverseNext(elInfo);
}
while(elInfo) {
// Write coordinates of all element vertices.
for (int i=0; i<=dim; ++i) {
for (int j=0; j<dim; ++j) {
fout << elInfo->getCoord(i)[j] << " ";
// === Write elements. ===
int numLeaves = mesh->getNumberOfLeaves();
int vertCntr = 0;
fout << "\n";
fout << "element vertices:\n";
for (int i = 0; i < numLeaves; ++i) {
for (int j = 0; j <= dim; ++j) {
fout << vertCntr << " ";
++vertCntr;
}
fout << "\n";
}
elInfo = stack.traverseNext(elInfo);
} // end of: mesh traverse
// === Write elements. ===
int numLeaves = mesh->getNumberOfLeaves();
int vertCntr = 0;
fout << "\n";
fout << "element vertices:\n";
for (int i=0; i<numLeaves; ++i) {
for (int j=0; j<=dim; ++j) {
// === Write values. ===
fout << vertCntr << " ";
++vertCntr;
}
// Write values header.
fout << "\n";
}
fout << "number of values: 1\n\n";
fout << "value description: " << name.c_str() << "\n";
fout << "number of interpolation points: 0" << "\n";
fout << "type: scalar" << "\n";
fout << "interpolation type: lagrange" << "\n";
fout << "interpolation degree: 1" << "\n";
fout << "end of description: " << name.c_str() << "\n\n";
// Write values.
fout << "vertex values: " << name.c_str() << "\n";
fout.setf(std::ios::scientific,std::ios::floatfield);
elInfo = stack.traverseFirst(mesh,
-1,
Mesh::CALL_LEAF_EL);
while (elInfo) {
// Get element value.
val = vec[elInfo->getElement()->getIndex()];
// Write value for each vertex of each element.
for (int i = 0; i <= dim; ++i) {
fout << val << "\n";
}
elInfo = stack.traverseNext(elInfo);
} // end of: mesh traverse
// === Write values. ===
// Write values header.
fout << "\n";
fout << "number of values: 1\n\n";
fout << "value description: " << name.c_str() << "\n";
fout << "number of interpolation points: 0" << "\n";
fout << "type: scalar" << "\n";
fout << "interpolation type: lagrange" << "\n";
fout << "interpolation degree: 1" << "\n";
fout << "end of description: " << name.c_str() << "\n\n";
// Write values trailor.
fout << "\n";
fout << "interpolation values: " << name.c_str() << "\n\n\n";
fout << "element interpolation points: " << name.c_str() << "\n";
// Write values.
fout << "vertex values: " << name.c_str() << "\n";
fout.setf(std::ios::scientific,std::ios::floatfield);
fout.close();
}
elInfo = stack.traverseFirst(mesh,
-1,
Mesh::CALL_LEAF_EL);
void ElementFileWriter::writeVtkValues(const char* filename)
{
FUNCNAME("ElementFileWriter::writeVtkValues()");
::std::ofstream fout(filename);
TEST_EXIT(fout)("Could not open file %s !\n", filename);
int dim = mesh->getDim();
int vertices = mesh->getGeo(VERTEX);
int nElements = mesh->getNumberOfLeaves();
double val;
fout << "<?xml version=\"1.0\"?>" << ::std::endl;
fout << "<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\">" << ::std::endl;