Commit b376142c authored by Thomas Witkowski's avatar Thomas Witkowski

Basis for parallel MTL4.

parent a3a5c94f
......@@ -31,7 +31,8 @@ if USE_PARALLEL_DOMAIN_AMDIS
$(SOURCE_DIR)/parallel/StdMpi.h $(SOURCE_DIR)/parallel/StdMpi.cc \
$(SOURCE_DIR)/parallel/MeshDistributor.h $(SOURCE_DIR)/parallel/MeshDistributor.cc \
$(SOURCE_DIR)/parallel/ParallelDebug.h $(SOURCE_DIR)/parallel/ParallelDebug.cc \
$(SOURCE_DIR)/parallel/GlobalMatrixSolver.h $(SOURCE_DIR)/parallel/GlobalMatrixSolver.cc \
$(SOURCE_DIR)/parallel/ParallelProblemStatBase.h \
$(SOURCE_DIR)/parallel/PetscSolver.h $(SOURCE_DIR)/parallel/PetscSolver.cc \
$(SOURCE_DIR)/parallel/MpiHelper.h $(SOURCE_DIR)/parallel/MpiHelper.cc \
$(SOURCE_DIR)/parallel/ElementObjectData.h $(SOURCE_DIR)/parallel/ElementObjectData.cc
libamdis_la_CXXFLAGS += -DHAVE_PARALLEL_DOMAIN_AMDIS=1
......
......@@ -41,7 +41,8 @@ host_triplet = @host@
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ $(SOURCE_DIR)/parallel/StdMpi.h $(SOURCE_DIR)/parallel/StdMpi.cc \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ $(SOURCE_DIR)/parallel/MeshDistributor.h $(SOURCE_DIR)/parallel/MeshDistributor.cc \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ $(SOURCE_DIR)/parallel/ParallelDebug.h $(SOURCE_DIR)/parallel/ParallelDebug.cc \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ $(SOURCE_DIR)/parallel/GlobalMatrixSolver.h $(SOURCE_DIR)/parallel/GlobalMatrixSolver.cc \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ $(SOURCE_DIR)/parallel/ParallelProblemStatBase.h \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ $(SOURCE_DIR)/parallel/PetscSolver.h $(SOURCE_DIR)/parallel/PetscSolver.cc \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ $(SOURCE_DIR)/parallel/MpiHelper.h $(SOURCE_DIR)/parallel/MpiHelper.cc \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ $(SOURCE_DIR)/parallel/ElementObjectData.h $(SOURCE_DIR)/parallel/ElementObjectData.cc
......@@ -82,8 +83,9 @@ am__libamdis_la_SOURCES_DIST = $(SOURCE_DIR)/parallel/StdMpi.h \
$(SOURCE_DIR)/parallel/MeshDistributor.cc \
$(SOURCE_DIR)/parallel/ParallelDebug.h \
$(SOURCE_DIR)/parallel/ParallelDebug.cc \
$(SOURCE_DIR)/parallel/GlobalMatrixSolver.h \
$(SOURCE_DIR)/parallel/GlobalMatrixSolver.cc \
$(SOURCE_DIR)/parallel/ParallelProblemStatBase.h \
$(SOURCE_DIR)/parallel/PetscSolver.h \
$(SOURCE_DIR)/parallel/PetscSolver.cc \
$(SOURCE_DIR)/parallel/MpiHelper.h \
$(SOURCE_DIR)/parallel/MpiHelper.cc \
$(SOURCE_DIR)/parallel/ElementObjectData.h \
......@@ -252,7 +254,7 @@ am__libamdis_la_SOURCES_DIST = $(SOURCE_DIR)/parallel/StdMpi.h \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@am__objects_1 = libamdis_la-StdMpi.lo \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ libamdis_la-MeshDistributor.lo \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ libamdis_la-ParallelDebug.lo \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ libamdis_la-GlobalMatrixSolver.lo \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ libamdis_la-PetscSolver.lo \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ libamdis_la-MpiHelper.lo \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ libamdis_la-ElementObjectData.lo
@USE_PARALLEL_AMDIS_FALSE@am__objects_2 = $(am__objects_1)
......@@ -802,7 +804,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-FixVec.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-GNUPlotWriter.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-Global.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-GlobalMatrixSolver.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-InteriorBoundary.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-Lagrange.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-LeafData.Plo@am__quote@
......@@ -824,6 +825,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-Parameters.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-Parametric.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-PeriodicBC.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-PetscSolver.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-PngWriter.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-PollutionError.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-PovrayWriter.Plo@am__quote@
......@@ -920,12 +922,12 @@ libamdis_la-ParallelDebug.lo: $(SOURCE_DIR)/parallel/ParallelDebug.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-ParallelDebug.lo `test -f '$(SOURCE_DIR)/parallel/ParallelDebug.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/parallel/ParallelDebug.cc
libamdis_la-GlobalMatrixSolver.lo: $(SOURCE_DIR)/parallel/GlobalMatrixSolver.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-GlobalMatrixSolver.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-GlobalMatrixSolver.Tpo" -c -o libamdis_la-GlobalMatrixSolver.lo `test -f '$(SOURCE_DIR)/parallel/GlobalMatrixSolver.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/parallel/GlobalMatrixSolver.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-GlobalMatrixSolver.Tpo" "$(DEPDIR)/libamdis_la-GlobalMatrixSolver.Plo"; else rm -f "$(DEPDIR)/libamdis_la-GlobalMatrixSolver.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(SOURCE_DIR)/parallel/GlobalMatrixSolver.cc' object='libamdis_la-GlobalMatrixSolver.lo' libtool=yes @AMDEPBACKSLASH@
libamdis_la-PetscSolver.lo: $(SOURCE_DIR)/parallel/PetscSolver.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-PetscSolver.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-PetscSolver.Tpo" -c -o libamdis_la-PetscSolver.lo `test -f '$(SOURCE_DIR)/parallel/PetscSolver.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/parallel/PetscSolver.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-PetscSolver.Tpo" "$(DEPDIR)/libamdis_la-PetscSolver.Plo"; else rm -f "$(DEPDIR)/libamdis_la-PetscSolver.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(SOURCE_DIR)/parallel/PetscSolver.cc' object='libamdis_la-PetscSolver.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-GlobalMatrixSolver.lo `test -f '$(SOURCE_DIR)/parallel/GlobalMatrixSolver.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/parallel/GlobalMatrixSolver.cc
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -c -o libamdis_la-PetscSolver.lo `test -f '$(SOURCE_DIR)/parallel/PetscSolver.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/parallel/PetscSolver.cc
libamdis_la-MpiHelper.lo: $(SOURCE_DIR)/parallel/MpiHelper.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-MpiHelper.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-MpiHelper.Tpo" -c -o libamdis_la-MpiHelper.lo `test -f '$(SOURCE_DIR)/parallel/MpiHelper.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/parallel/MpiHelper.cc; \
......
......@@ -107,7 +107,13 @@
#if HAVE_PARALLEL_DOMAIN_AMDIS
#include "parallel/InteriorBoundary.h"
#include "parallel/MpiHelper.h"
#include "parallel/GlobalMatrixSolver.h"
#if HAVE_PARALLEL_MTL4
#include "parallel/Mtl4Solver.h"
#else
#include "parallel/PetscSolver.h"
#endif
#endif
#endif
// ============================================================================
// == ==
// == AMDiS - Adaptive multidimensional simulations ==
// == ==
// ============================================================================
// == ==
// == TU Dresden ==
// == ==
// == Institut fr Wissenschaftliches Rechnen ==
// == Zellescher Weg 12-14 ==
// == 01069 Dresden ==
// == germany ==
// == ==
// ============================================================================
// == ==
// == https://gforge.zih.tu-dresden.de/projects/amdis/ ==
// == ==
// ============================================================================
/** \file Mtl4Solver.h */
#ifndef AMDIS_MTL4_SOLVER_H
#define AMDIS_MTL4_SOLVER_H
#include "ParallelProblemStatBase.h"
namespace AMDiS {
class Mtl4Solver : public ParallelProblemStatBase
{
public:
Mtl4Solver(std::string nameStr,
ProblemIterationInterface *problemIteration = NULL)
: ParallelProblemStatBase(nameStr, problemIteration)
{}
~Mtl4Solver()
{}
void solve(AdaptInfo *adaptInfo, bool fixedMatrix = false)
{
ERROR_EXIT("TO BE IMPLEMENTED!\n");
}
}
typedef Mtl4Solver ParallelProblemStat;
}
#endif
// ============================================================================
// == ==
// == AMDiS - Adaptive multidimensional simulations ==
// == ==
// ============================================================================
// == ==
// == TU Dresden ==
// == ==
// == Institut fr Wissenschaftliches Rechnen ==
// == Zellescher Weg 12-14 ==
// == 01069 Dresden ==
// == germany ==
// == ==
// ============================================================================
// == ==
// == https://gforge.zih.tu-dresden.de/projects/amdis/ ==
// == ==
// ============================================================================
/** \file ParallelProblemStatBase.h */
#ifndef AMDIS_PARALLEL_PROBLEM_STAT_BASE_H
#define AMDIS_PARALLEL_PROBLEM_STAT_BASE_H
#include "ProblemVec.h"
namespace AMDiS {
class ParallelProblemStatBase : public ProblemVec
{
public:
ParallelProblemStatBase(std::string nameStr,
ProblemIterationInterface *problemIteration = NULL)
: ProblemVec(nameStr, problemIteration),
meshDistributor(NULL)
{}
void buildAfterCoarsen(AdaptInfo *adaptInfo, Flag flag,
bool assembleMatrix,
bool assembleVector)
{
meshDistributor->checkMeshChange();
ProblemVec::buildAfterCoarsen(adaptInfo, flag, assembleMatrix, assembleVector);
}
void addToMeshDistributor(MeshDistributor& m)
{
meshDistributor = &m;
m.addProblemStat(this);
}
protected:
MeshDistributor *meshDistributor;
};
}
#endif
#include "parallel/GlobalMatrixSolver.h"
#include "parallel/PetscSolver.h"
#include "parallel/StdMpi.h"
#include "parallel/ParallelDebug.h"
#include "DOFVector.h"
......@@ -18,25 +18,9 @@ namespace AMDiS {
}
void GlobalMatrixSolver::addToMeshDistributor(MeshDistributor& m)
void PetscSolver::solve(AdaptInfo *adaptInfo, bool fixedMatrix)
{
meshDistributor = &m;
m.addProblemStat(this);
}
void GlobalMatrixSolver::buildAfterCoarsen(AdaptInfo *adaptInfo, Flag flag,
bool assembleMatrix,
bool assembleVector)
{
meshDistributor->checkMeshChange();
ProblemVec::buildAfterCoarsen(adaptInfo, flag, assembleMatrix, assembleVector);
}
void GlobalMatrixSolver::solve(AdaptInfo *adaptInfo, bool fixedMatrix)
{
FUNCNAME("GlobalMatrixSolver::solve()");
FUNCNAME("PetscSolver::solve()");
TEST_EXIT(meshDistributor)("Should not happen!\n");
......@@ -59,10 +43,10 @@ namespace AMDiS {
}
void GlobalMatrixSolver::setDofMatrix(DOFMatrix* mat, int dispMult,
int dispAddRow, int dispAddCol)
void PetscSolver::setDofMatrix(DOFMatrix* mat, int dispMult,
int dispAddRow, int dispAddCol)
{
FUNCNAME("GlobalMatrixSolver::setDofMatrix()");
FUNCNAME("PetscSolver::setDofMatrix()");
TEST_EXIT(mat)("No DOFMatrix!\n");
......@@ -188,10 +172,10 @@ namespace AMDiS {
}
void GlobalMatrixSolver::setDofVector(Vec& petscVec, DOFVector<double>* vec,
int dispMult, int dispAdd)
void PetscSolver::setDofVector(Vec& petscVec, DOFVector<double>* vec,
int dispMult, int dispAdd)
{
FUNCNAME("GlobalMatrixSolver::setDofVector()");
FUNCNAME("PetscSolver::setDofVector()");
// Traverse all used dofs in the dof vector.
DOFVector<double>::Iterator dofIt(vec, USED_DOFS);
......@@ -221,9 +205,9 @@ namespace AMDiS {
}
void GlobalMatrixSolver::createPetscNnzStructure(Matrix<DOFMatrix*> *mat)
void PetscSolver::createPetscNnzStructure(Matrix<DOFMatrix*> *mat)
{
FUNCNAME("GlobalMatrixSolver::createPetscNnzStructure()");
FUNCNAME("PetscSolver::createPetscNnzStructure()");
TEST_EXIT_DBG(!d_nnz)("There is something wrong!\n");
TEST_EXIT_DBG(!o_nnz)("There is something wrong!\n");
......@@ -383,9 +367,9 @@ namespace AMDiS {
}
void GlobalMatrixSolver::fillPetscMatrix(Matrix<DOFMatrix*> *mat, SystemVector *vec)
void PetscSolver::fillPetscMatrix(Matrix<DOFMatrix*> *mat, SystemVector *vec)
{
FUNCNAME("GlobalMatrixSolver::fillPetscMatrix()");
FUNCNAME("PetscSolver::fillPetscMatrix()");
clock_t first = clock();
int nRankRows = meshDistributor->getNumberRankDofs() * nComponents;
......@@ -472,9 +456,9 @@ namespace AMDiS {
}
void GlobalMatrixSolver::solvePetscMatrix(SystemVector &vec, AdaptInfo *adaptInfo)
void PetscSolver::solvePetscMatrix(SystemVector &vec, AdaptInfo *adaptInfo)
{
FUNCNAME("GlobalMatrixSolver::solvePetscMatrix()");
FUNCNAME("PetscSolver::solvePetscMatrix()");
#if 0
// Set old solution to be initiual guess for petsc solver.
......
......@@ -17,16 +17,17 @@
// == ==
// ============================================================================
/** \file GlobalMatrixSolver.h */
/** \file PetscSolver.h */
#ifndef AMDIS_GLOBALMATRIXSOLVER_H
#define AMDIS_GLOBALMATRIXSOLVER_H
#ifndef AMDIS_PETSCSOLVER_H
#define AMDIS_PETSCSOLVER_H
#include "AMDiS_fwd.h"
#include "Global.h"
#include "MeshDistributor.h"
#include "ProblemVec.h"
#include "ProblemInstat.h"
#include "ParallelProblemStatBase.h"
#include "petsc.h"
#include "petscsys.h"
......@@ -34,27 +35,20 @@
namespace AMDiS {
class GlobalMatrixSolver : public ProblemVec
class PetscSolver : public ParallelProblemStatBase
{
public:
GlobalMatrixSolver(std::string nameStr,
ProblemIterationInterface *problemIteration = NULL)
: ProblemVec(nameStr, problemIteration),
meshDistributor(NULL),
PetscSolver(std::string nameStr,
ProblemIterationInterface *problemIteration = NULL)
: ParallelProblemStatBase(nameStr, problemIteration),
d_nnz(NULL),
o_nnz(NULL),
lastMeshNnz(0)
{}
~GlobalMatrixSolver()
~PetscSolver()
{}
void addToMeshDistributor(MeshDistributor&);
void buildAfterCoarsen(AdaptInfo *adaptInfo, Flag flag,
bool assembleMatrix = true,
bool assembleVector = true);
void solve(AdaptInfo *adaptInfo, bool fixedMatrix = false);
protected:
......@@ -82,8 +76,6 @@ namespace AMDiS {
void solvePetscMatrix(SystemVector &vec, AdaptInfo *adaptInfo);
protected:
MeshDistributor *meshDistributor;
/// Petsc's matrix structure.
Mat petscMatrix;
......@@ -105,8 +97,7 @@ namespace AMDiS {
int lastMeshNnz;
};
typedef GlobalMatrixSolver ParallelProblemStat;
typedef PetscSolver ParallelProblemStat;
} //namespace AMDiS
......
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