diff --git a/AMDiS/bin/Makefile.am b/AMDiS/bin/Makefile.am index 384eca0ad0271b595fa0075fe23899fdd87938ed..5d2dce12b4aa153b7e07f2dcddfc2d7c0f4b66c0 100644 --- a/AMDiS/bin/Makefile.am +++ b/AMDiS/bin/Makefile.am @@ -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 diff --git a/AMDiS/bin/Makefile.in b/AMDiS/bin/Makefile.in index 8b2d9f151ee16f834115bed39f224e8f3076f156..364fd9b9ccce0343e54abc4f2f3c7056d9fcc853 100644 --- a/AMDiS/bin/Makefile.in +++ b/AMDiS/bin/Makefile.in @@ -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; \ diff --git a/AMDiS/src/AMDiS.h b/AMDiS/src/AMDiS.h index bfd03ba0b7dba7a8bf8b9e401ef096a6a32226d5..ab33ffb057cad0360d1cd9b0f817920018c4d328 100644 --- a/AMDiS/src/AMDiS.h +++ b/AMDiS/src/AMDiS.h @@ -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 diff --git a/AMDiS/src/parallel/Mtl4Solver.h b/AMDiS/src/parallel/Mtl4Solver.h new file mode 100644 index 0000000000000000000000000000000000000000..a9b34d614ba1e59050a6008da0f127ca645e36cb --- /dev/null +++ b/AMDiS/src/parallel/Mtl4Solver.h @@ -0,0 +1,51 @@ +// ============================================================================ +// == == +// == AMDiS - Adaptive multidimensional simulations == +// == == +// ============================================================================ +// == == +// == TU Dresden == +// == == +// == Institut für 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 diff --git a/AMDiS/src/parallel/ParallelProblemStatBase.h b/AMDiS/src/parallel/ParallelProblemStatBase.h new file mode 100644 index 0000000000000000000000000000000000000000..23730b1e197d9f7068df15438aa6645c70743755 --- /dev/null +++ b/AMDiS/src/parallel/ParallelProblemStatBase.h @@ -0,0 +1,59 @@ +// ============================================================================ +// == == +// == AMDiS - Adaptive multidimensional simulations == +// == == +// ============================================================================ +// == == +// == TU Dresden == +// == == +// == Institut für 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 diff --git a/AMDiS/src/parallel/GlobalMatrixSolver.cc b/AMDiS/src/parallel/PetscSolver.cc similarity index 93% rename from AMDiS/src/parallel/GlobalMatrixSolver.cc rename to AMDiS/src/parallel/PetscSolver.cc index ed69bb60be58c31c28256780b91972e1d9c716ce..45bed7ed4c2e4a41b56e138b45c922e9bc3e184b 100644 --- a/AMDiS/src/parallel/GlobalMatrixSolver.cc +++ b/AMDiS/src/parallel/PetscSolver.cc @@ -1,4 +1,4 @@ -#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. diff --git a/AMDiS/src/parallel/GlobalMatrixSolver.h b/AMDiS/src/parallel/PetscSolver.h similarity index 84% rename from AMDiS/src/parallel/GlobalMatrixSolver.h rename to AMDiS/src/parallel/PetscSolver.h index 08f3656f6b5c4c71678e5cdaa8c00e87f3a1b5d5..44f049c55110a5ceff954126bbdb8fb4dbeddb28 100644 --- a/AMDiS/src/parallel/GlobalMatrixSolver.h +++ b/AMDiS/src/parallel/PetscSolver.h @@ -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