Commit 1a043288 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

DOFVector are named by init file, and VTK writer uses this information to name...

DOFVector are named by init file, and VTK writer uses this information to name components of vtu files.
parent ef9e1c0f
...@@ -94,6 +94,12 @@ namespace AMDiS { ...@@ -94,6 +94,12 @@ namespace AMDiS {
return pos; return pos;
} }
/// Returns \ref node0
inline int getCurrentNode0()
{
return node0;
}
/// Returns \ref elementPos, the number of vertex, edge or face that /// Returns \ref elementPos, the number of vertex, edge or face that
/// is traversed. /// is traversed.
inline int getCurrentElementPos() inline int getCurrentElementPos()
......
...@@ -44,6 +44,57 @@ namespace AMDiS { ...@@ -44,6 +44,57 @@ namespace AMDiS {
using namespace std; using namespace std;
using boost::lexical_cast; using boost::lexical_cast;
ProblemStatSeq::ProblemStatSeq(string nameStr,
ProblemIterationInterface *problemIteration)
: StandardProblemIteration(this),
name(nameStr),
nComponents(-1),
nMeshes(0),
traverseInfo(0),
solver(NULL),
solution(NULL),
rhs(NULL),
systemMatrix(NULL),
useGetBound(true),
refinementManager(NULL),
coarseningManager(NULL),
info(10),
deserialized(false),
computeExactError(false),
boundaryConditionSet(false),
writeAsmInfo(false)
{
Parameters::get(name + "->components", nComponents);
TEST_EXIT(nComponents > 0)("components not set!\n");
estimator.resize(nComponents, NULL);
marker.resize(nComponents, NULL);
assembleMatrixOnlyOnce.resize(nComponents);
assembledMatrix.resize(nComponents);
for (int i = 0; i < nComponents; i++) {
assembleMatrixOnlyOnce[i].resize(nComponents);
assembledMatrix[i].resize(nComponents);
for (int j = 0; j < nComponents; j++) {
assembleMatrixOnlyOnce[i][j] = false;
assembledMatrix[i][j] = false;
}
}
exactSolutionFcts.resize(nComponents);
// === Initialize name of components. ===
componentNames.resize(nComponents, "");
for (int i = 0; i < nComponents; i++)
componentNames[i] = "solution[" + lexical_cast<string>(i) + "]";
Parameters::get(name + "->name", componentNames);
for (int i = 0; i < nComponents; i++)
Parameters::get(name + "->name[" + lexical_cast<string>(i) + "]",
componentNames[i]);
}
void ProblemStatSeq::initialize(Flag initFlag, void ProblemStatSeq::initialize(Flag initFlag,
ProblemStatSeq *adoptProblem, ProblemStatSeq *adoptProblem,
Flag adoptFlag) Flag adoptFlag)
...@@ -391,12 +442,11 @@ namespace AMDiS { ...@@ -391,12 +442,11 @@ namespace AMDiS {
componentSpaces[i], "A_ii"); componentSpaces[i], "A_ii");
(*systemMatrix)[i][i]->setCoupleMatrix(false); (*systemMatrix)[i][i]->setCoupleMatrix(false);
string numberedName = "rhs[" + boost::lexical_cast<string>(i) + "]"; rhs->setDOFVector(i, new DOFVector<double>(componentSpaces[i],
rhs->setDOFVector(i, new DOFVector<double>(componentSpaces[i], numberedName)); "rhs[" + lexical_cast<string>(i) + "]"));
numberedName = "solution[" + boost::lexical_cast<string>(i) + "]";
solution->setDOFVector(i, new DOFVector<double>(componentSpaces[i], solution->setDOFVector(i, new DOFVector<double>(componentSpaces[i],
numberedName)); componentNames[i]));
solution->getDOFVector(i)->setCoarsenOperation(COARSE_INTERPOL); solution->getDOFVector(i)->setCoarsenOperation(COARSE_INTERPOL);
solution->getDOFVector(i)->set(0.0); solution->getDOFVector(i)->set(0.0);
} }
......
...@@ -67,43 +67,7 @@ namespace AMDiS { ...@@ -67,43 +67,7 @@ namespace AMDiS {
public: public:
/// Constructor /// Constructor
ProblemStatSeq(string nameStr, ProblemStatSeq(string nameStr,
ProblemIterationInterface *problemIteration = NULL) ProblemIterationInterface *problemIteration = NULL);
: StandardProblemIteration(this),
name(nameStr),
nComponents(-1),
nMeshes(0),
traverseInfo(0),
solver(NULL),
solution(NULL),
rhs(NULL),
systemMatrix(NULL),
useGetBound(true),
refinementManager(NULL),
coarseningManager(NULL),
info(10),
deserialized(false),
computeExactError(false),
boundaryConditionSet(false),
writeAsmInfo(false)
{
Parameters::get(name + "->components", nComponents);
TEST_EXIT(nComponents > 0)("components not set!\n");
estimator.resize(nComponents, NULL);
marker.resize(nComponents, NULL);
assembleMatrixOnlyOnce.resize(nComponents);
assembledMatrix.resize(nComponents);
for (int i = 0; i < nComponents; i++) {
assembleMatrixOnlyOnce[i].resize(nComponents);
assembledMatrix[i].resize(nComponents);
for (int j = 0; j < nComponents; j++) {
assembleMatrixOnlyOnce[i][j] = false;
assembledMatrix[i][j] = false;
}
}
exactSolutionFcts.resize(nComponents);
}
/// Destructor /// Destructor
virtual ~ProblemStatSeq() {} virtual ~ProblemStatSeq() {}
...@@ -137,61 +101,43 @@ namespace AMDiS { ...@@ -137,61 +101,43 @@ namespace AMDiS {
/// Used in \ref initialize(). /// Used in \ref initialize().
virtual void createFileWriter(); virtual void createFileWriter();
/** \brief /// Used in \ref initialize(). This function is deprecated and should not
* Used in \ref initialize(). This function is deprecated and should not be used /// be used anymore. There is no guarantee that it will work in the future.
* anymore. There is no guarantee that it will work in the future.
*/
virtual void doOtherStuff(); virtual void doOtherStuff();
/** \brief /// Implementation of ProblemStatBase::solve(). Deligates the solving
* Implementation of ProblemStatBase::solve(). Deligates the solving /// of problems system to \ref solver.
* of problems system to \ref solver.
*/
void solve(AdaptInfo *adaptInfo, void solve(AdaptInfo *adaptInfo,
bool createMatrixData = true, bool createMatrixData = true,
bool storeMatrixData = false); bool storeMatrixData = false);
/** \brief /// Implementation of ProblemStatBase::estimate(). Deligates the estimation
* Implementation of ProblemStatBase::estimate(). Deligates the estimation /// to \ref estimator.
* to \ref estimator.
*/
virtual void estimate(AdaptInfo *adaptInfo); virtual void estimate(AdaptInfo *adaptInfo);
/** \brief /// Implementation of ProblemStatBase::markElements().
* Implementation of ProblemStatBase::markElements(). /// Deligated to \ref adapt.
* Deligated to \ref adapt.
*/
virtual Flag markElements(AdaptInfo *adaptInfo); virtual Flag markElements(AdaptInfo *adaptInfo);
/** \brief /// Implementation of ProblemStatBase::refineMesh(). Deligated to the
* Implementation of ProblemStatBase::refineMesh(). Deligated to the /// RefinementManager of \ref adapt.
* RefinementManager of \ref adapt.
*/
virtual Flag refineMesh(AdaptInfo *adaptInfo); virtual Flag refineMesh(AdaptInfo *adaptInfo);
/** \brief /// Implementation of ProblemStatBase::coarsenMesh(). Deligated to the
* Implementation of ProblemStatBase::coarsenMesh(). Deligated to the /// CoarseningManager of \ref adapt.
* CoarseningManager of \ref adapt.
*/
virtual Flag coarsenMesh(AdaptInfo *adaptInfo); virtual Flag coarsenMesh(AdaptInfo *adaptInfo);
/** \brief /// Implementation of ProblemStatBase::buildBeforeRefine().
* Implementation of ProblemStatBase::buildBeforeRefine(). /// Does nothing here.
* Does nothing here.
*/
virtual void buildBeforeRefine(AdaptInfo *adaptInfo, Flag) {} virtual void buildBeforeRefine(AdaptInfo *adaptInfo, Flag) {}
/** \brief /// Implementation of ProblemStatBase::buildBeforeCoarsen().
* Implementation of ProblemStatBase::buildBeforeCoarsen(). /// Does nothing here.
* Does nothing here.
*/
virtual void buildBeforeCoarsen(AdaptInfo *adaptInfo, Flag) {} virtual void buildBeforeCoarsen(AdaptInfo *adaptInfo, Flag) {}
/** \brief /// Implementation of ProblemStatBase::buildAfterCoarsen().
* Implementation of ProblemStatBase::buildAfterCoarsen(). /// Assembles \ref A and \ref rhs. With the last two parameters, assembling
* Assembles \ref A and \ref rhs. With the last two parameters, assembling /// can be restricted to matrices or vectors only.
* can be restricted to matrices or vectors only.
*/
virtual void buildAfterCoarsen(AdaptInfo *adaptInfo, Flag flag, virtual void buildAfterCoarsen(AdaptInfo *adaptInfo, Flag flag,
bool assembleMatrix = true, bool assembleMatrix = true,
bool assembleVector = true); bool assembleVector = true);
...@@ -603,6 +549,10 @@ namespace AMDiS { ...@@ -603,6 +549,10 @@ namespace AMDiS {
/// Number of problem components /// Number of problem components
int nComponents; int nComponents;
/// Stores the names for all components. Is used for naming the solution
/// vectors, \ref solution.
vector<string> componentNames;
/** \brief /** \brief
* Number of problem meshes. If all components are defined on the same mesh, * Number of problem meshes. If all components are defined on the same mesh,
* this number is 1. Otherwise, this variable is the number of different meshes * this number is 1. Otherwise, this variable is the number of different meshes
......
...@@ -59,7 +59,7 @@ namespace AMDiS { ...@@ -59,7 +59,7 @@ namespace AMDiS {
std::list<ElementInfo>* getElementInfos(); std::list<ElementInfo>* getElementInfos();
/// Returns vector with vertex information. /// Returns vector with vertex information.
DOFVector< std::list<VertexInfo> >* getVertexInfos(); DOFVector<std::list<VertexInfo> >* getVertexInfos();
/// Returns the finite element space of the problem. /// Returns the finite element space of the problem.
const FiniteElemSpace* getFeSpace() const FiniteElemSpace* getFeSpace()
......
...@@ -82,7 +82,8 @@ namespace AMDiS { ...@@ -82,7 +82,8 @@ namespace AMDiS {
file << " <PointData>\n"; file << " <PointData>\n";
for (int i = 0; i < static_cast<int>(dataCollector->size()); i++) { for (int i = 0; i < static_cast<int>(dataCollector->size()); i++) {
file << " <DataArray type=\"Float32\" Name=\"value" << i file << " <DataArray type=\"Float32\" Name=\""
<< (*dataCollector)[i]->getValues()->getName()
<< "\" format=\"ascii\">\n"; << "\" format=\"ascii\">\n";
writeVertexValues(file, i); writeVertexValues(file, i);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment