Commit b728a4ee authored by Thomas Witkowski's avatar Thomas Witkowski

Parallelization of instationary problems.

parent a1b5b1b9
...@@ -13,13 +13,17 @@ ...@@ -13,13 +13,17 @@
#include "Mesh.h" #include "Mesh.h"
#include "OpenMP.h" #include "OpenMP.h"
#if HAVE_PARALLEL_DOMAIN_AMDIS
#include "mpi.h"
#endif
namespace AMDiS { namespace AMDiS {
FileWriter::FileWriter(const std::string &name_, FileWriter::FileWriter(const std::string &str,
Mesh *mesh_, Mesh *m,
DOFVector<double> *vec) DOFVector<double> *vec)
: name(name_), : name(str),
mesh(mesh_) mesh(m)
{ {
FUNCNAME("FileWriter::FileWriter()"); FUNCNAME("FileWriter::FileWriter()");
...@@ -42,10 +46,9 @@ namespace AMDiS { ...@@ -42,10 +46,9 @@ namespace AMDiS {
initialize(); initialize();
for (int i = 0; i < static_cast<int>(vecs.size()); i++) { for (int i = 0; i < static_cast<int>(vecs.size()); i++)
TEST_EXIT(vecs[0]->getFESpace() == vecs[i]->getFESpace()) TEST_EXIT(vecs[0]->getFESpace() == vecs[i]->getFESpace())
("All FESpace have to be equal!\n"); ("All FESpace have to be equal!\n");
}
feSpace = vecs[0]->getFESpace(); feSpace = vecs[0]->getFESpace();
solutionVecs_ = vecs; solutionVecs_ = vecs;
...@@ -87,11 +90,9 @@ namespace AMDiS { ...@@ -87,11 +90,9 @@ namespace AMDiS {
{ {
// Do not forget to delete temporal solution vector, if there have been // Do not forget to delete temporal solution vector, if there have been
// some created in the constructor. // some created in the constructor.
if (nTmpSolutions_ > 0) { if (nTmpSolutions_ > 0)
for (int i = 0; i < nTmpSolutions_; i++) { for (int i = 0; i < nTmpSolutions_; i++)
delete solutionVecs_[i]; delete solutionVecs_[i];
}
}
} }
...@@ -166,21 +167,25 @@ namespace AMDiS { ...@@ -166,21 +167,25 @@ namespace AMDiS {
std::vector< DataCollector* > dataCollectors(solutionVecs_.size()); std::vector< DataCollector* > dataCollectors(solutionVecs_.size());
if (writeElem) { if (writeElem) {
for (int i = 0; i < static_cast<int>(dataCollectors.size()); i++) { for (int i = 0; i < static_cast<int>(dataCollectors.size()); i++)
dataCollectors[i] = new DataCollector(feSpace, solutionVecs_[i], dataCollectors[i] = new DataCollector(feSpace, solutionVecs_[i],
level, flag, writeElem); level, flag, writeElem);
}
} else { } else {
for (int i = 0; i < static_cast<int>(dataCollectors.size()); i++) { for (int i = 0; i < static_cast<int>(dataCollectors.size()); i++)
dataCollectors[i] = new DataCollector(feSpace, solutionVecs_[i], dataCollectors[i] = new DataCollector(feSpace, solutionVecs_[i],
traverseLevel, traverseLevel,
flag | traverseFlag, flag | traverseFlag,
writeElement); writeElement);
}
} }
std::string fn = filename; std::string fn = filename;
#if HAVE_PARALLEL_DOMAIN_AMDIS
char f[10];
sprintf(f, "-p%d-", MPI::COMM_WORLD.Get_rank());
fn += f;
#endif
if (appendIndex) { if (appendIndex) {
TEST_EXIT(indexLength <= 99)("index lenght > 99\n"); TEST_EXIT(indexLength <= 99)("index lenght > 99\n");
TEST_EXIT(indexDecimals <= 97)("index decimals > 97\n"); TEST_EXIT(indexDecimals <= 97)("index decimals > 97\n");
......
...@@ -105,15 +105,35 @@ namespace AMDiS { ...@@ -105,15 +105,35 @@ namespace AMDiS {
void partitionMesh(AdaptInfo *adaptInfo); void partitionMesh(AdaptInfo *adaptInfo);
virtual void setTime(AdaptInfo *adaptInfo) {} virtual void setTime(AdaptInfo *adaptInfo)
{
if (timeIF)
timeIF->setTime(adaptInfo);
}
virtual void initTimestep(AdaptInfo *adaptInfo) {} virtual void initTimestep(AdaptInfo *adaptInfo)
{
if (timeIF)
timeIF->initTimestep(adaptInfo);
}
virtual void closeTimestep(AdaptInfo *adaptInfo) {} virtual void closeTimestep(AdaptInfo *adaptInfo)
{
if (timeIF)
timeIF->closeTimestep(adaptInfo);
}
virtual void solveInitialProblem(AdaptInfo *adaptInfo) {} virtual void solveInitialProblem(AdaptInfo *adaptInfo)
{
if (timeIF)
timeIF->solveInitialProblem(adaptInfo);
}
virtual void transferInitialSolution(AdaptInfo *adaptInfo) {} virtual void transferInitialSolution(AdaptInfo *adaptInfo)
{
if (timeIF)
timeIF->transferInitialSolution(adaptInfo);
}
virtual void beginIteration(AdaptInfo *adaptInfo) virtual void beginIteration(AdaptInfo *adaptInfo)
{ {
......
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