diff --git a/AMDiS/bin/Makefile.am b/AMDiS/bin/Makefile.am index 332e434310090487128aecbe3587eefa8492f930..5bf7184e8f4078d0dac1cfd2435c68f6c87738fe 100644 --- a/AMDiS/bin/Makefile.am +++ b/AMDiS/bin/Makefile.am @@ -84,6 +84,7 @@ $(SOURCE_DIR)/ProblemVec.h $(SOURCE_DIR)/ProblemVec.cc \ $(SOURCE_DIR)/DualTraverse.h $(SOURCE_DIR)/DualTraverse.cc \ $(SOURCE_DIR)/ElementPartition_ED.h $(SOURCE_DIR)/SurfacePartition_ED.h \ $(SOURCE_DIR)/ElementData.h $(SOURCE_DIR)/ElementData.cc \ +$(SOURCE_DIR)/ComponentTraverseInfo.h $(SOURCE_DIR)/ComponentTraverseInfo.cc \ $(SOURCE_DIR)/CreatorMap.h $(SOURCE_DIR)/CreatorMap.hh $(SOURCE_DIR)/CreatorMap.cc \ $(SOURCE_DIR)/CreatorInterface.h \ $(SOURCE_DIR)/ElementFunction.h \ diff --git a/AMDiS/bin/Makefile.in b/AMDiS/bin/Makefile.in index d80d44a906c9e319d01e8468cbb3e00729a1950f..521ef538ca3be9925f10ebdf1348115578cbbc68 100644 --- a/AMDiS/bin/Makefile.in +++ b/AMDiS/bin/Makefile.in @@ -112,6 +112,8 @@ am__libamdis_la_SOURCES_DIST = $(PARALLEL_DIR)/ConditionalEstimator.h \ $(SOURCE_DIR)/ElementPartition_ED.h \ $(SOURCE_DIR)/SurfacePartition_ED.h \ $(SOURCE_DIR)/ElementData.h $(SOURCE_DIR)/ElementData.cc \ + $(SOURCE_DIR)/ComponentTraverseInfo.h \ + $(SOURCE_DIR)/ComponentTraverseInfo.cc \ $(SOURCE_DIR)/CreatorMap.h $(SOURCE_DIR)/CreatorMap.hh \ $(SOURCE_DIR)/CreatorMap.cc $(SOURCE_DIR)/CreatorInterface.h \ $(SOURCE_DIR)/ElementFunction.h \ @@ -270,7 +272,8 @@ am_libamdis_la_OBJECTS = $(am__objects_1) \ libamdis_la-StandardProblemIteration.lo \ libamdis_la-ProblemScal.lo libamdis_la-ProblemVec.lo \ libamdis_la-DualTraverse.lo libamdis_la-ElementData.lo \ - libamdis_la-CreatorMap.lo libamdis_la-ProblemInterpolScal.lo \ + libamdis_la-ComponentTraverseInfo.lo libamdis_la-CreatorMap.lo \ + libamdis_la-ProblemInterpolScal.lo \ libamdis_la-ProblemInterpolVec.lo libamdis_la-MacroReader.lo \ libamdis_la-ValueReader.lo libamdis_la-Projection.lo \ libamdis_la-SubAssembler.lo libamdis_la-ZeroOrderAssembler.lo \ @@ -525,6 +528,7 @@ $(SOURCE_DIR)/ProblemVec.h $(SOURCE_DIR)/ProblemVec.cc \ $(SOURCE_DIR)/DualTraverse.h $(SOURCE_DIR)/DualTraverse.cc \ $(SOURCE_DIR)/ElementPartition_ED.h $(SOURCE_DIR)/SurfacePartition_ED.h \ $(SOURCE_DIR)/ElementData.h $(SOURCE_DIR)/ElementData.cc \ +$(SOURCE_DIR)/ComponentTraverseInfo.h $(SOURCE_DIR)/ComponentTraverseInfo.cc \ $(SOURCE_DIR)/CreatorMap.h $(SOURCE_DIR)/CreatorMap.hh $(SOURCE_DIR)/CreatorMap.cc \ $(SOURCE_DIR)/CreatorInterface.h \ $(SOURCE_DIR)/ElementFunction.h \ @@ -783,6 +787,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-CoarseningManager1d.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-CoarseningManager2d.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-CoarseningManager3d.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-ComponentTraverseInfo.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-ConditionalEstimator.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-CreatorMap.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-DOFAdmin.Plo@am__quote@ @@ -1082,6 +1087,13 @@ libamdis_la-ElementData.lo: $(SOURCE_DIR)/ElementData.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-ElementData.lo `test -f '$(SOURCE_DIR)/ElementData.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/ElementData.cc +libamdis_la-ComponentTraverseInfo.lo: $(SOURCE_DIR)/ComponentTraverseInfo.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-ComponentTraverseInfo.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-ComponentTraverseInfo.Tpo" -c -o libamdis_la-ComponentTraverseInfo.lo `test -f '$(SOURCE_DIR)/ComponentTraverseInfo.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/ComponentTraverseInfo.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-ComponentTraverseInfo.Tpo" "$(DEPDIR)/libamdis_la-ComponentTraverseInfo.Plo"; else rm -f "$(DEPDIR)/libamdis_la-ComponentTraverseInfo.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(SOURCE_DIR)/ComponentTraverseInfo.cc' object='libamdis_la-ComponentTraverseInfo.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-ComponentTraverseInfo.lo `test -f '$(SOURCE_DIR)/ComponentTraverseInfo.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/ComponentTraverseInfo.cc + libamdis_la-CreatorMap.lo: $(SOURCE_DIR)/CreatorMap.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-CreatorMap.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-CreatorMap.Tpo" -c -o libamdis_la-CreatorMap.lo `test -f '$(SOURCE_DIR)/CreatorMap.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/CreatorMap.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-CreatorMap.Tpo" "$(DEPDIR)/libamdis_la-CreatorMap.Plo"; else rm -f "$(DEPDIR)/libamdis_la-CreatorMap.Tpo"; exit 1; fi diff --git a/AMDiS/src/AMDiS.h b/AMDiS/src/AMDiS.h index 262b7c8b51b7441d3d705ed04a6bc4a0adce8cb7..8cc5dd6989d73f0e71b8558ef5349b8714a5e35e 100644 --- a/AMDiS/src/AMDiS.h +++ b/AMDiS/src/AMDiS.h @@ -55,6 +55,7 @@ #include "MemoryManager.h" #include "MemoryPool.h" #include "Mesh.h" +#include "ComponentTraverseInfo.h" #include "Newton.h" #include "NewtonS.h" #include "NonLinSolver.h" diff --git a/AMDiS/src/AbstractFunction.h b/AMDiS/src/AbstractFunction.h index 1ce4a63b3cd0493d35a7499380891c5e5e4db383..5816de5b06b598f086772aac1fd1a4847716a26d 100644 --- a/AMDiS/src/AbstractFunction.h +++ b/AMDiS/src/AbstractFunction.h @@ -51,16 +51,16 @@ namespace AMDiS { */ AbstractFunction(int degree = 0) : degree_(degree) - {}; + {} - virtual ~AbstractFunction() {}; + virtual ~AbstractFunction() {} /** \brief * Returns \ref degree_. */ inline int getDegree() const { return degree_; - }; + } /** \brief * Deligates the evaluation to overriden method f. diff --git a/AMDiS/src/AdaptBase.h b/AMDiS/src/AdaptBase.h index 0787450bceb58588a6e8bc53431d7520781dd416..963642a0f02b0435994f6e1b08e3e57a64efd54b 100644 --- a/AMDiS/src/AdaptBase.h +++ b/AMDiS/src/AdaptBase.h @@ -34,30 +34,24 @@ namespace AMDiS { // ===== class AdaptBase ====================================================== // ============================================================================ - /** \brief - * Interface for adaption loops. - */ + /// Interface for adaption loops. class AdaptBase { public: - /** \brief - * Constructor - */ - AdaptBase(const std::string& name, + /// Constructor + AdaptBase(const std::string& sname, ProblemIterationInterface *problemIteration, AdaptInfo *adapt, ProblemTimeInterface *problemTime = NULL, AdaptInfo *initialAdaptInfo = NULL) - : name_(name), + : name(sname), problemIteration_(problemIteration), adaptInfo(adapt), problemTime_(problemTime), initialAdaptInfo_(initialAdaptInfo) {} - /** \brief - * Destructor - */ + /// Destructor virtual ~AdaptBase() {} /** \brief @@ -66,68 +60,52 @@ namespace AMDiS { */ virtual int adapt() = 0; - /** \brief - * Returns \ref name_ - */ + /// Returns \ref name inline const std::string& getName() const { - return name_; + return name; } - /** \brief - * Returns \ref problemIteration_ - */ + /// Returns \ref problemIteration_ inline ProblemIterationInterface *getProblemIteration() { return problemIteration_; } + /// inline void setProblemIteration(ProblemIterationInterface *pii) { problemIteration_ = pii; } - /** \brief - * Returns \ref adaptInfo - */ + /// Returns \ref adaptInfo inline AdaptInfo *getAdaptInfo() { return adaptInfo; } - /** \brief - * Returns \ref problemTime_ - */ + /// Returns \ref problemTime_ inline ProblemTimeInterface *getProblemTime() { return problemTime_; } + /// inline void setProblemTime(ProblemTimeInterface *pti) { problemTime_ = pti; } - /** \brief - * Returns \ref initialAdaptInfo_ - */ + /// Returns \ref initialAdaptInfo_ inline AdaptInfo *getInitialAdaptInfo() { return initialAdaptInfo_; } protected: - /** \brief - * Name of the adaption loop - */ - std::string name_; + /// Name of the adaption loop + std::string name; - /** \brief - * Problem iteration interface - */ + /// Problem iteration interface ProblemIterationInterface *problemIteration_; - /** \brief - * Main adapt info - */ + /// Main adapt info AdaptInfo *adaptInfo; - /** \brief - * problem time interface - */ + /// problem time interface ProblemTimeInterface *problemTime_; /** \brief @@ -136,9 +114,7 @@ namespace AMDiS { */ AdaptInfo *initialAdaptInfo_; - /** \brief - * Info level - */ + /// Info level static int info_; }; diff --git a/AMDiS/src/AdaptInstationary.cc b/AMDiS/src/AdaptInstationary.cc index b9fcde7090debe348f6ffca5ef6437d22c9d9de7..fe0baac5d9c5c4dd6ea8a9fffa09930426dab258 100644 --- a/AMDiS/src/AdaptInstationary.cc +++ b/AMDiS/src/AdaptInstationary.cc @@ -8,7 +8,7 @@ namespace AMDiS { - AdaptInstationary::AdaptInstationary(const char *name, + AdaptInstationary::AdaptInstationary(const std::string &name, ProblemIterationInterface *problemStat, AdaptInfo *info, ProblemTimeInterface *problemInstat, @@ -20,7 +20,7 @@ namespace AMDiS { { FUNCNAME("AdaptInstationary::AdaptInstationary()"); - initialize(name_); + initialize(name); fixedTimestep_ = (info->getMinTimestep() == info->getMaxTimestep()); diff --git a/AMDiS/src/AdaptInstationary.h b/AMDiS/src/AdaptInstationary.h index 83f87a3c2a3d22a70d7355c77c5cf087fa5dcb2b..ee2795a9384aedcf7bc5a933be660e688ec8fd17 100644 --- a/AMDiS/src/AdaptInstationary.h +++ b/AMDiS/src/AdaptInstationary.h @@ -54,7 +54,7 @@ namespace AMDiS { * Creates a AdaptInstationary object with the given name for the time * dependent problem problemInstat. */ - AdaptInstationary(const char *name_, + AdaptInstationary(const std::string &name, ProblemIterationInterface *problemStat, AdaptInfo *info, ProblemTimeInterface *problemInstat, diff --git a/AMDiS/src/AdaptStationary.cc b/AMDiS/src/AdaptStationary.cc index b5265570007526a9bb60596e00a7f42c0b0fe63d..343accf210d680901bd82b2f831f1de65d8f0ccf 100644 --- a/AMDiS/src/AdaptStationary.cc +++ b/AMDiS/src/AdaptStationary.cc @@ -7,9 +7,9 @@ namespace AMDiS { - AdaptStationary::AdaptStationary(const char *name, + AdaptStationary::AdaptStationary(const std::string &name, ProblemIterationInterface *prob, - AdaptInfo *info) + AdaptInfo *info) : AdaptBase(name, prob, info) { initialize(); @@ -49,7 +49,7 @@ namespace AMDiS { { FUNCNAME("AdaptStationary::initialize()"); - GET_PARAMETER(0, name_ + "->info", "%d", &info_); + GET_PARAMETER(0, name + "->info", "%d", &info_); } } diff --git a/AMDiS/src/AdaptStationary.h b/AMDiS/src/AdaptStationary.h index 2b2440b839ba2e8378c82ea8456c5a1bcd7646e8..0c30c6dbed973d1a09f5df52ae40e157f19ed58c 100644 --- a/AMDiS/src/AdaptStationary.h +++ b/AMDiS/src/AdaptStationary.h @@ -58,9 +58,9 @@ namespace AMDiS { /** \brief * Creates a AdaptStationary object with given name. */ - AdaptStationary(const char *name, + AdaptStationary(const std::string &name, ProblemIterationInterface *prob, - AdaptInfo *info); + AdaptInfo *info); /** \brief * Destructor diff --git a/AMDiS/src/Assembler.cc b/AMDiS/src/Assembler.cc index 44413fe2f81345cda4c6500785b22bc787ad4939..182cb004e37eb806232c68466f437d7b9259b7bb 100644 --- a/AMDiS/src/Assembler.cc +++ b/AMDiS/src/Assembler.cc @@ -36,20 +36,18 @@ namespace AMDiS { { FUNCNAME("Assembler::calculateElementMatrix()"); - if (remember && ((factor != 1.0) || (operat->uhOld))) { + if (remember && ((factor != 1.0) || (operat->uhOld))) { rememberElMat = true; } - + if (rememberElMat && !elementMatrix) elementMatrix = NEW ElementMatrix(nRow, nCol); Element *el = elInfo->getElement(); - - + checkForNewTraverse(); - checkQuadratures(); - + if ((el != lastMatEl && el != lastVecEl) || !operat->isOptimized()) { initElement(elInfo); } @@ -65,7 +63,7 @@ namespace AMDiS { return; } } - + ElementMatrix *mat = rememberElMat ? elementMatrix : userMat; if (secondOrderAssembler) @@ -77,9 +75,10 @@ namespace AMDiS { if (zeroOrderAssembler) zeroOrderAssembler->calculateElementMatrix(elInfo, mat); - if (rememberElMat && userMat) { + if (rememberElMat && userMat) { axpy(factor, *elementMatrix, *userMat); } + } void Assembler::calculateElementMatrix(const ElInfo *rowElInfo, @@ -98,7 +97,7 @@ namespace AMDiS { if (rememberElMat && !elementMatrix) elementMatrix = NEW ElementMatrix(nRow, nCol); - Element *el = rowElInfo->getElement(); + Element *el = smallElInfo->getElement(); // checkForNewTraverse(); @@ -107,7 +106,7 @@ namespace AMDiS { checkQuadratures(); if ((el != lastMatEl && el != lastVecEl) || !operat->isOptimized()) { - initElement(rowElInfo); + initElement(smallElInfo, largeElInfo); } if (el != lastMatEl || !operat->isOptimized()) { @@ -124,26 +123,31 @@ namespace AMDiS { ElementMatrix *mat = rememberElMat ? elementMatrix : userMat; - if (secondOrderAssembler) { - secondOrderAssembler->calculateElementMatrix(rowElInfo, colElInfo, - smallElInfo, largeElInfo, mat); - } - - if (firstOrderAssemblerGrdPsi) { - firstOrderAssemblerGrdPsi->calculateElementMatrix(rowElInfo, colElInfo, - smallElInfo, largeElInfo, mat); - } - - if (firstOrderAssemblerGrdPhi) { - firstOrderAssemblerGrdPhi->calculateElementMatrix(rowElInfo, colElInfo, - smallElInfo, largeElInfo, mat); - } - - if (zeroOrderAssembler) { - zeroOrderAssembler->calculateElementMatrix(rowElInfo, colElInfo, + if (smallElInfo->getLevel() == largeElInfo->getLevel()) { + if (secondOrderAssembler) + secondOrderAssembler->calculateElementMatrix(smallElInfo, mat); + if (firstOrderAssemblerGrdPsi) + firstOrderAssemblerGrdPsi->calculateElementMatrix(smallElInfo, mat); + if (firstOrderAssemblerGrdPhi) + firstOrderAssemblerGrdPhi->calculateElementMatrix(smallElInfo, mat); + if (zeroOrderAssembler) + zeroOrderAssembler->calculateElementMatrix(smallElInfo, mat); + } else { + if (secondOrderAssembler) + secondOrderAssembler->calculateElementMatrix(rowElInfo, colElInfo, + smallElInfo, largeElInfo, mat); + if (firstOrderAssemblerGrdPsi) + firstOrderAssemblerGrdPsi->calculateElementMatrix(rowElInfo, colElInfo, + smallElInfo, largeElInfo, mat); + if (firstOrderAssemblerGrdPhi) + firstOrderAssemblerGrdPhi->calculateElementMatrix(rowElInfo, colElInfo, + smallElInfo, largeElInfo, mat); + + if (zeroOrderAssembler) + zeroOrderAssembler->calculateElementMatrix(rowElInfo, colElInfo, smallElInfo, largeElInfo, mat); } - + if (rememberElMat && userMat) { axpy(factor, *elementMatrix, *userMat); } @@ -201,6 +205,71 @@ namespace AMDiS { } } + void Assembler::calculateElementVector(const ElInfo *mainElInfo, + const ElInfo *auxElInfo, + const ElInfo *smallElInfo, + const ElInfo *largeElInfo, + ElementVector *userVec, + double factor) + { + FUNCNAME("Assembler::calculateElementVector()"); + + if (remember && factor != 1.0) { + rememberElVec = true; + } + + if (rememberElVec && !elementVector) { + elementVector = NEW ElementVector(nRow); + } + + Element *el = mainElInfo->getElement(); + // checkForNewTraverse(); + checkQuadratures(); + + if ((el != lastMatEl && el != lastVecEl) || !operat->isOptimized()) { + initElement(auxElInfo); + } + + if (el != lastVecEl || !operat->isOptimized()) { + if (rememberElVec) { + elementVector->set(0.0); + } + lastVecEl = el; + } else { + if (rememberElVec) { + axpy(factor, *elementVector, *userVec); + return; + } + } + ElementVector *vec = rememberElVec ? elementVector : userVec; + + if (operat->uhOld && remember) { + + if (smallElInfo->getLevel() == largeElInfo->getLevel()) { + matVecAssemble(auxElInfo, vec); + } else { + matVecAssemble(mainElInfo, auxElInfo, smallElInfo, largeElInfo, vec); + } + + if (rememberElVec) { + axpy(factor, *elementVector, *userVec); + } + return; + } + + ERROR_EXIT("Not yet implemented!\n"); +// if (firstOrderAssemblerGrdPsi) { +// firstOrderAssemblerGrdPsi->calculateElementVector(elInfo, vec); +// } +// if (zeroOrderAssembler) { +// zeroOrderAssembler->calculateElementVector(elInfo, vec); +// } +// if (rememberElVec) { +// axpy(factor, *elementVector, *userVec); +// } + + } + void Assembler::matVecAssemble(const ElInfo *elInfo, ElementVector *vec) { FUNCNAME("Assembler::matVecAssemble()"); @@ -225,21 +294,72 @@ namespace AMDiS { } - delete [] uhOldLoc; + delete [] uhOldLoc; + } + + void Assembler::matVecAssemble(const ElInfo *mainElInfo, const ElInfo *auxElInfo, + const ElInfo *smallElInfo, const ElInfo *largeElInfo, + ElementVector *vec) + { + FUNCNAME("Assembler::matVecAssemble()"); + + TEST_EXIT(rowFESpace->getBasisFcts() == colFESpace->getBasisFcts()) + ("Works only for equal basis functions for different components!\n"); + + TEST_EXIT(operat->uhOld->getFESpace()->getMesh() == auxElInfo->getMesh()) + ("Da stimmt was nicht!\n"); + + Element *mainEl = mainElInfo->getElement(); + Element *auxEl = auxElInfo->getElement(); + + const BasisFunction *basFcts = rowFESpace->getBasisFcts(); + int nBasFcts = basFcts->getNumber(); + double *uhOldLoc = new double[nBasFcts]; + double *uhOldLoc2 = new double[nBasFcts]; + + operat->uhOld->getLocalVector(auxEl, uhOldLoc); + + DimMat<double> *m = smallElInfo->getSubElemCoordsMat(); + + for (int i = 0; i < nBasFcts; i++) { + uhOldLoc2[i] = 0.0; + for (int j = 0; j < nBasFcts; j++) { + uhOldLoc2[i] += (*m)[j][i] * uhOldLoc[i]; + } + } + + + if (mainEl != lastMatEl) { + calculateElementMatrix(mainElInfo, auxElInfo, smallElInfo, largeElInfo, NULL); + } + + for (int i = 0; i < nBasFcts; i++) { + double val = 0.0; + for (int j = 0; j < nBasFcts; j++) { + val += (*elementMatrix)[i][j] * uhOldLoc2[j]; + } + (*vec)[i] += val; + } + + + delete [] uhOldLoc; + delete [] uhOldLoc2; } - void Assembler::initElement(const ElInfo *elInfo, Quadrature *quad) + void Assembler::initElement(const ElInfo *smallElInfo, + const ElInfo *largeElInfo, + Quadrature *quad) { checkQuadratures(); if (secondOrderAssembler) - secondOrderAssembler->initElement(elInfo, quad); + secondOrderAssembler->initElement(smallElInfo, largeElInfo, quad); if (firstOrderAssemblerGrdPsi) - firstOrderAssemblerGrdPsi->initElement(elInfo, quad); + firstOrderAssemblerGrdPsi->initElement(smallElInfo, largeElInfo, quad); if (firstOrderAssemblerGrdPhi) - firstOrderAssemblerGrdPhi->initElement(elInfo, quad); + firstOrderAssemblerGrdPhi->initElement(smallElInfo, largeElInfo, quad); if (zeroOrderAssembler) - zeroOrderAssembler->initElement(elInfo, quad); + zeroOrderAssembler->initElement(smallElInfo, largeElInfo, quad); } OptimizedAssembler::OptimizedAssembler(Operator *op, diff --git a/AMDiS/src/Assembler.h b/AMDiS/src/Assembler.h index cd0edc0a5563270fb9be484ae3e62511d073c329..dc489aff32f519ce5badbdedb6c0821f9ebcbf2b 100644 --- a/AMDiS/src/Assembler.h +++ b/AMDiS/src/Assembler.h @@ -41,7 +41,6 @@ namespace AMDiS { - // class ElInfo; class Element; class Quadrature; class ElementMatrix; @@ -68,8 +67,7 @@ namespace AMDiS { const FiniteElemSpace *rowFESpace, const FiniteElemSpace *colFESpace = NULL); - virtual ~Assembler() - {} + virtual ~Assembler() {} ElementMatrix *initElementMatrix(ElementMatrix *elMat, const ElInfo *rowElInfo, @@ -100,6 +98,14 @@ namespace AMDiS { ElementVector *userVec, double factor = 1.0); + + void calculateElementVector(const ElInfo *mainElInfo, + const ElInfo *auxElInfo, + const ElInfo *smallElInfo, + const ElInfo *largeElInfo, + ElementVector *userVec, + double factor = 1.0); + /** \brief * Returns \ref rowFESpace. */ @@ -178,7 +184,8 @@ namespace AMDiS { * Initialisation for the given ElInfo. The call is deligated to * the sub assemblers. */ - void initElement(const ElInfo *elInfo, + void initElement(const ElInfo *smallElInfo, + const ElInfo *largeElInfo = NULL, Quadrature *quad = NULL); /** \brief @@ -218,6 +225,11 @@ namespace AMDiS { */ void matVecAssemble(const ElInfo *elInfo, ElementVector *vec); + + void matVecAssemble(const ElInfo *mainElInfo, const ElInfo *auxElInfo, + const ElInfo *smallElInfo, const ElInfo *largeElInfo, + ElementVector *vec); + /** \brief * Checks whether this is a new travese. */ @@ -280,6 +292,9 @@ namespace AMDiS { */ ZeroOrderAssembler *zeroOrderAssembler; + /** \brief + * + */ bool remember; /** \brief diff --git a/AMDiS/src/ComponentTraverseInfo.cc b/AMDiS/src/ComponentTraverseInfo.cc new file mode 100644 index 0000000000000000000000000000000000000000..a830f81a16efcccdf7d050cbe91a4a4e534c6636 --- /dev/null +++ b/AMDiS/src/ComponentTraverseInfo.cc @@ -0,0 +1,48 @@ +#include "ComponentTraverseInfo.h" + +namespace AMDiS { + const int SingleComponentInfo::EMPTY = 0; + const int SingleComponentInfo::EQ_SPACES_NO_AUX = 1; + const int SingleComponentInfo::EQ_SPACES_WITH_AUX = 2; + const int SingleComponentInfo::EQ_SPACES_WITH_DIF_AUX = 3; + const int SingleComponentInfo::DIF_SPACES_NO_AUX = 4; + const int SingleComponentInfo::DIF_SPACES_WITH_AUX = 5; + const int SingleComponentInfo::DIF_SPACES_WITH_DIF_AUX = 6; + + void SingleComponentInfo::updateStatus() + { + if (rowFESpace == NULL) { + status = SingleComponentInfo::EMPTY; + return; + } + + if (colFESpace == NULL || + (colFESpace != NULL && rowFESpace->getMesh() == colFESpace->getMesh())) { + if (auxFESpaces.size() == 0) { + status = SingleComponentInfo::EQ_SPACES_NO_AUX; + } else { + status = SingleComponentInfo::EQ_SPACES_WITH_AUX; + for (int i = 0; i < static_cast<int>(auxFESpaces.size()); i++) { + if (auxFESpaces[i]->getMesh() != rowFESpace->getMesh()) { + status = SingleComponentInfo::EQ_SPACES_WITH_DIF_AUX; + break; + } + } + } + } else { + if (auxFESpaces.size() == 0) { + status = SingleComponentInfo::DIF_SPACES_NO_AUX; + } else { + status = SingleComponentInfo::DIF_SPACES_WITH_AUX; + for (int i = 0; i < static_cast<int>(auxFESpaces.size()); i++) { + if (auxFESpaces[i]->getMesh() != rowFESpace->getMesh() && + auxFESpaces[i]->getMesh() != colFESpace->getMesh()) { + status = SingleComponentInfo::DIF_SPACES_WITH_DIF_AUX; + break; + } + } + } + } + } + +} diff --git a/AMDiS/src/ComponentTraverseInfo.h b/AMDiS/src/ComponentTraverseInfo.h new file mode 100644 index 0000000000000000000000000000000000000000..b210b7f45b098edc046ef8251ca2c9ad7bb20578 --- /dev/null +++ b/AMDiS/src/ComponentTraverseInfo.h @@ -0,0 +1,177 @@ +// ============================================================================ +// == == +// == AMDiS - Adaptive multidimensional simulations == +// == == +// ============================================================================ +// == == +// == crystal growth group == +// == == +// == Stiftung caesar == +// == Ludwig-Erhard-Allee 2 == +// == 53175 Bonn == +// == germany == +// == == +// ============================================================================ +// == == +// == http://www.caesar.de/cg/AMDiS == +// == == +// ============================================================================ + +/** \file ComponentTraverseInfo.h */ + +#ifndef AMDIS_COMPONENTTRAVERSEINFO_H +#define AMDIS_COMPONENTTRAVERSEINFO_H + +#include <vector> + +#include "FiniteElemSpace.h" + +namespace AMDiS { + + class SingleComponentInfo + { + public: + SingleComponentInfo() + : rowFESpace(NULL), + colFESpace(NULL), + auxFESpaces(0), + status(0) + {} + + void setFESpace(FiniteElemSpace *row, FiniteElemSpace *col = NULL) { + rowFESpace = row; + colFESpace = col; + } + + void setAuxFESpaces(std::vector<const FiniteElemSpace*> feSpaces) { + auxFESpaces = feSpaces; + } + + void addAuxFESpace(const FiniteElemSpace *fe) { + auxFESpaces.push_back(fe); + } + + bool hasFESpace() { + return rowFESpace != NULL; + } + + void updateStatus(); + + int getNumAuxFESpaces() { + return auxFESpaces.size(); + } + + FiniteElemSpace *getRowFESpace() { + return rowFESpace; + } + + FiniteElemSpace *getColFESpace() { + return colFESpace; + } + + const FiniteElemSpace *getAuxFESpace(int i) { + return ((i <= static_cast<int>(auxFESpaces.size())) ? auxFESpaces[i] : NULL); + } + + int getStatus() { + return status; + } + + protected: + FiniteElemSpace *rowFESpace; + + FiniteElemSpace *colFESpace; + + std::vector<const FiniteElemSpace*> auxFESpaces; + + /// Status of the component, see the possible status flags below. + int status; + + public: + /// Single component status flag: empty component, no fe spaces + static const int EMPTY; + + /// Single component status flag: row = col, no aux + static const int EQ_SPACES_NO_AUX; + + /// Single component status flag: row = col = aux + static const int EQ_SPACES_WITH_AUX; + + /// Single component status flag: row = col, different aux + static const int EQ_SPACES_WITH_DIF_AUX; + + /// Single component status flag: row, col, no aux + static const int DIF_SPACES_NO_AUX; + + /// Single component status flag: row, col, aux either equal to row or to col + static const int DIF_SPACES_WITH_AUX; + + /// Single component status flag: row, col, aux (at least 3 different fe spaces) + static const int DIF_SPACES_WITH_DIF_AUX; + }; + + + class ComponentTraverseInfo + { + public: + ComponentTraverseInfo(int n) + : nComponents(n) + { + resize(n); + } + + void resize(int n) { + nComponents = n; + + matrixComponents.resize(n); + vectorComponents.resize(n); + + for (int i = 0; i < n; i++) { + matrixComponents[i].resize(n); + } + } + + void updateStatus() { + for (int i = 0; i < nComponents; i++) { + for (int j = 0; j < nComponents; j++) { + matrixComponents[i][j].updateStatus(); + } + vectorComponents[i].updateStatus(); + } + } + + SingleComponentInfo &getMatrix(int row, int col) { + return matrixComponents[row][col]; + } + + SingleComponentInfo &getVector(int row) { + return vectorComponents[row]; + } + + int getStatus(int row, int col) { + return matrixComponents[row][col].getStatus(); + } + + int getStatus(int row) { + return vectorComponents[row].getStatus(); + } + + const FiniteElemSpace* getAuxFESpace(int row, int col) { + return matrixComponents[row][col].getAuxFESpace(0); + } + + const FiniteElemSpace* getAuxFESpace(int row) { + return vectorComponents[row].getAuxFESpace(0); + } + + protected: + int nComponents; + + std::vector<std::vector<SingleComponentInfo> > matrixComponents; + + std::vector<SingleComponentInfo> vectorComponents; + }; + +} + +#endif diff --git a/AMDiS/src/DOFIndexed.h b/AMDiS/src/DOFIndexed.h index 6fd2480356938f575b4e7c0d724a6cd59f840bb6..59a5b059260d42fd05dc6e3de779ef372938e1c4 100644 --- a/AMDiS/src/DOFIndexed.h +++ b/AMDiS/src/DOFIndexed.h @@ -48,7 +48,7 @@ namespace AMDiS { class DOFIndexedBase { public: - virtual ~DOFIndexedBase() {}; + virtual ~DOFIndexedBase() {} /** \brief * Returns the actual size. Must be overriden by sub classes @@ -70,19 +70,19 @@ namespace AMDiS { * Performs needed action when a DOF index is freed. Can be overriden in * sub classes. The default behavior is to do nothing. */ - virtual void freeDOFContent(int) {}; + virtual void freeDOFContent(int) {} /** \brief * Interpolation after refinement. Can be overriden in subclasses. * The default behavior is to do nothing. */ - virtual void refineInterpol(RCNeighbourList&, int) {}; + virtual void refineInterpol(RCNeighbourList&, int) {} /** \brief * Restriction after coarsening. Can be overriden in subclasses. * The default behavior is to do nothing. */ - virtual void coarseRestrict(RCNeighbourList&, int) {}; + virtual void coarseRestrict(RCNeighbourList&, int) {} /** \brief * Returns the finite element space of this DOFIndexed object. Must be @@ -103,7 +103,7 @@ namespace AMDiS { class DOFIndexed : public DOFIndexedBase { public: - virtual ~DOFIndexed() {}; + virtual ~DOFIndexed() {} /** \brief * Returns iterator to the begin of container diff --git a/AMDiS/src/DOFMatrix.cc b/AMDiS/src/DOFMatrix.cc index f8f1da4c891a7314df922b768b0067da0859545c..7994e2a45a8806ca061d9d9188bd851c9284c7a3 100644 --- a/AMDiS/src/DOFMatrix.cc +++ b/AMDiS/src/DOFMatrix.cc @@ -249,6 +249,10 @@ namespace AMDiS { int nRow = elMat.rowIndices.getSize(); int nCol = elMat.colIndices.getSize(); +// elMat.rowIndices.print(); +// elMat.colIndices.print(); +// elMat.print(); + for (int i = 0; i < nRow; i++) { // for all rows of element matrix row = elMat.rowIndices[i]; BoundaryCondition *condition = @@ -440,7 +444,7 @@ namespace AMDiS { Operator *operat = op ? op : operators[0]; operat->getAssembler(omp_get_thread_num())->initElementMatrix(elementMatrix, elInfo); - + if (op) { op->getElementMatrix(elInfo, elementMatrix); } else { @@ -449,9 +453,11 @@ namespace AMDiS { for (it = operators.begin(), factorIt = operatorFactor.begin(); it != operators.end(); ++it, ++factorIt) { - (*it)->getElementMatrix(elInfo, - elementMatrix, - *factorIt ? **factorIt : 1.0); + if ((*it)->getNeedDualTraverse() == false) { + (*it)->getElementMatrix(elInfo, + elementMatrix, + *factorIt ? **factorIt : 1.0); + } } } @@ -483,14 +489,44 @@ namespace AMDiS { for (it = operators.begin(), factorIt = operatorFactor.begin(); it != operators.end(); ++it, ++factorIt) { - // If both levels are equal, we may use the standard assembler for - // one element. - if (rowElInfo->getLevel() == colElInfo->getLevel()) { - (*it)->getElementMatrix(rowElInfo, - elementMatrix, - *factorIt ? **factorIt : 1.0); - } else { - (*it)->getElementMatrix(rowElInfo, colElInfo, + (*it)->getElementMatrix(rowElInfo, colElInfo, + smallElInfo, largeElInfo, + elementMatrix, + *factorIt ? **factorIt : 1.0); + } + } + + addElementMatrix(factor, *elementMatrix, bound); + } + + void DOFMatrix::assemble2(double factor, + ElInfo *mainElInfo, ElInfo *auxElInfo, + ElInfo *smallElInfo, ElInfo *largeElInfo, + const BoundaryType *bound, Operator *op) + { + FUNCNAME("DOFMatrix::assemble2()"); + + if (!op && operators.size() == 0) { + return; + } + + Operator *operat = op ? op : operators[0]; + operat->getAssembler(omp_get_thread_num())-> + initElementMatrix(elementMatrix, mainElInfo); + + if (op) { + ERROR_EXIT("TODO"); +// op->getElementMatrix(rowElInfo, colElInfo, +// smallElInfo, largeElInfo, +// elementMatrix); + } else { + std::vector<Operator*>::iterator it; + std::vector<double*>::iterator factorIt; + for (it = operators.begin(), factorIt = operatorFactor.begin(); + it != operators.end(); + ++it, ++factorIt) { + if ((*it)->getNeedDualTraverse()) { + (*it)->getElementMatrix(mainElInfo, auxElInfo, smallElInfo, largeElInfo, elementMatrix, *factorIt ? **factorIt : 1.0); @@ -501,7 +537,6 @@ namespace AMDiS { addElementMatrix(factor, *elementMatrix, bound); } - Flag DOFMatrix::getAssembleFlag() { Flag fillFlag(0); @@ -509,6 +544,7 @@ namespace AMDiS { for(op = operators.begin(); op != operators.end(); ++op) { fillFlag |= (*op)->getFillFlag(); } + return fillFlag; } diff --git a/AMDiS/src/DOFMatrix.h b/AMDiS/src/DOFMatrix.h index 66a8a012e597fabb1785598afd2abc36c714310c..26706cb05cddd0218851bd720955eb17038de9be 100644 --- a/AMDiS/src/DOFMatrix.h +++ b/AMDiS/src/DOFMatrix.h @@ -364,38 +364,37 @@ namespace AMDiS { void assemble(double factor, ElInfo *rowElInfo, ElInfo *colElInfo, ElInfo *smallElInfo, ElInfo *largeElInfo, - const BoundaryType *bound, Operator *op = NULL); - + const BoundaryType *bound, + Operator *op = NULL); - /** \brief - * Adds an element matrix to \ref matrix - */ + void assemble2(double factor, + ElInfo *mainElInfo, ElInfo *auxElInfo, + ElInfo *smallElInfo, ElInfo *largeElInfo, + const BoundaryType *bound, + Operator *op = NULL); + + /// Adds an element matrix to \ref matrix void addElementMatrix(double sign, const ElementMatrix& elMat, const BoundaryType *bound, bool add = true); - /** \brief - * Returns \ref matrix - */ + /// Returns \ref matrix std::vector< std::vector<MatEntry> >& getMatrix() { return matrix; } + /// void setMatrix(std::vector< std::vector<MatEntry> > m) { matrix = m; } - /** \brief - * Returns \ref matrix[n] - */ + /// Returns \ref matrix[n] const std::vector<MatEntry>& getRow(int n) const { return matrix[n]; } - /** \brief - * Returns \ref matrix[n] - */ + /// Returns \ref matrix[n] std::vector<MatEntry>& getRow(int n) { return matrix[n]; } @@ -408,9 +407,7 @@ namespace AMDiS { return false; } - /** \brief - * Returns const \ref rowFESpace - */ + /// Returns const \ref rowFESpace const FiniteElemSpace* getRowFESpace() const { return rowFESpace; } diff --git a/AMDiS/src/DOFVector.cc b/AMDiS/src/DOFVector.cc index 799edb3cb4b344f695484a9e71aa3cf370b819fc..96d96a1b8390e2d5824666fe204acfcb27b846aa 100644 --- a/AMDiS/src/DOFVector.cc +++ b/AMDiS/src/DOFVector.cc @@ -35,12 +35,11 @@ namespace AMDiS { if (n < 1) return; - int dim = feSpace->getMesh()->getDim(); Element *el = list.getElement(0); int n0 = feSpace->getAdmin()->getNumberOfPreDOFs(VERTEX); DegreeOfFreedom dof0 = el->getDOF(0, n0); DegreeOfFreedom dof1 = el->getDOF(1, n0); - DegreeOfFreedom dof_new = el->getChild(0)->getDOF(dim, n0); + DegreeOfFreedom dof_new = el->getChild(0)->getDOF(feSpace->getMesh()->getDim(), n0); vec[dof_new] = vec[dof0]; vec[dof_new] += vec[dof1]; vec[dof_new] *= 0.5; @@ -93,8 +92,8 @@ namespace AMDiS { numNodes += numPositionNodes; } -// TEST_EXIT_DBG(numNodes == mesh->getNumberOfNodes()) -// ("invalid number of nodes\n"); + // TEST_EXIT_DBG(numNodes == mesh->getNumberOfNodes()) + // ("invalid number of nodes\n"); TEST_EXIT_DBG(numDOFs == basFcts->getNumber()) ("number of dofs != number of basis functions\n"); @@ -297,8 +296,89 @@ namespace AMDiS { } template<> - const WorldMatrix<double> *DOFVectorBase<double>::getD2AtQPs(const ElInfo *elInfo, - const Quadrature *quad, + const WorldVector<double> *DOFVectorBase<double>::getGrdAtQPs(const ElInfo *smallElInfo, + const ElInfo *largeElInfo, + const Quadrature *quad, + const FastQuadrature *quadFast, + WorldVector<double> *grdAtQPs) const + { + FUNCNAME("DOFVector<double>::getGrdAtQPs()"); + + TEST_EXIT_DBG(quad || quadFast)("neither quad nor quadFast defined\n"); + + if (quad && quadFast) { + TEST_EXIT_DBG(quad == quadFast->getQuadrature()) + ("quad != quadFast->quadrature\n"); + } + + TEST_EXIT_DBG(!quadFast || quadFast->getBasisFunctions() == feSpace->getBasisFcts()) + ("invalid basis functions"); + + int dow = Global::getGeo(WORLD); + int myRank = omp_get_thread_num(); + int nPoints = quadFast ? quadFast->getQuadrature()->getNumPoints() : quad->getNumPoints(); + static WorldVector<double> *grd = NULL; + WorldVector<double> *result; + + if (grdAtQPs) { + result = grdAtQPs; + } else { + if (grd) + delete [] grd; + + grd = new WorldVector<double>[nPoints]; + for (int i = 0; i < nPoints; i++) { + grd[i].set(0.0); + } + result = grd; + } + + double *localVec = localVectors[myRank]; + getLocalVector(largeElInfo->getElement(), localVec); + DimMat<double> *m = smallElInfo->getSubElemCoordsMat(); + + DimVec<double> &grd1 = *grdTmp[myRank]; + int parts = Global::getGeo(PARTS, dim); + const DimVec<WorldVector<double> > &grdLambda = largeElInfo->getGrdLambda(); + + + const BasisFunction *basFcts = feSpace->getBasisFcts(); + DimVec<double>* grdPhi = grdPhis[myRank]; + DimVec<double> tmp(dim, DEFAULT_VALUE, 0.0); + + for (int i = 0; i < nPoints; i++) { + for (int j = 0; j < dim + 1; j++) { + grd1[j] = 0.0; + } + + for (int j = 0; j < nBasFcts; j++) { + + grdPhi->set(0.0); + for (int k = 0; k < nBasFcts; k++) { + (*(basFcts->getGrdPhi(k)))(quad->getLambda(i), tmp); + tmp *= (*m)[j][k]; + *grdPhi += tmp; + } + + for (int k = 0; k < parts; k++) { + grd1[k] += (*grdPhi)[k] * localVec[j]; + } + } + + for (int l = 0; l < dow; l++) { + result[i][l] = 0.0; + for (int k = 0; k < parts; k++) { + result[i][l] += grdLambda[k][l] * grd1[k]; + } + } + } + + return const_cast<const WorldVector<double>*>(result); + } + + template<> + const WorldMatrix<double> *DOFVectorBase<double>::getD2AtQPs(const ElInfo *elInfo, + const Quadrature *quad, const FastQuadrature *quadFast, WorldMatrix<double> *d2AtQPs) const { @@ -637,7 +717,7 @@ namespace AMDiS { DOFVectorDOF::DOFVectorDOF() : DOFVector<DegreeOfFreedom>() - {}; + {} void DOFVectorDOF::freeDOFContent(DegreeOfFreedom dof) { @@ -647,7 +727,7 @@ namespace AMDiS { for (it = vec.begin(); it != end; ++it, ++pos) { if (*it == dof) *it = pos; } - }; + } WorldVector<DOFVector<double>*> *transform(DOFVector<WorldVector<double> > *vec, @@ -679,5 +759,135 @@ namespace AMDiS { return r; } + template<> + const double *DOFVectorBase<double>::getVecAtQPs(const ElInfo *smallElInfo, + const ElInfo *largeElInfo, + const Quadrature *quad, + const FastQuadrature *quadFast, + double *vecAtQPs) const + { + FUNCNAME("DOFVector<double>::getVecAtQPs()"); + + TEST_EXIT_DBG(quad || quadFast)("neither quad nor quadFast defined\n"); + + if (quad && quadFast) { + TEST_EXIT_DBG(quad == quadFast->getQuadrature()) + ("quad != quadFast->quadrature\n"); + } + + TEST_EXIT_DBG(!quadFast || quadFast->getBasisFunctions() == feSpace->getBasisFcts()) + ("invalid basis functions"); + + const BasisFunction *basFcts = feSpace->getBasisFcts(); + int nPoints = quadFast ? quadFast->getQuadrature()->getNumPoints() : quad->getNumPoints(); + static double *localvec = NULL; + double *result; + + if (vecAtQPs) { + result = vecAtQPs; + } else { + if (localvec) + delete [] localvec; + localvec = new double[nPoints]; + for (int i = 0; i < nPoints; i++) { + localvec[i] = 0.0; + } + result = localvec; + } + + double *localVec = localVectors[omp_get_thread_num()]; + getLocalVector(largeElInfo->getElement(), localVec); + + DimMat<double> *m = smallElInfo->getSubElemCoordsMat(); + + for (int i = 0; i < nPoints; i++) { + result[i] = 0.0; + for (int j = 0; j < nBasFcts; j++) { + double val = 0.0; + for (int k = 0; k < nBasFcts; k++) { + val += (*m)[j][k] * (*(basFcts->getPhi(k)))(quad->getLambda(i)); + } + result[i] += localVec[j] * val; + } + } + + return const_cast<const double*>(result); + } + + template<> + void DOFVectorBase<double>::assemble(double factor, ElInfo *elInfo, + const BoundaryType *bound, + Operator *op) + { + FUNCNAME("DOFVector::assemble()"); + + if (!(op || this->operators.size())) + return; + + Operator *operat = op ? op : this->operators[0]; + + this->elementVector = + operat->getAssembler(omp_get_thread_num())->initElementVector(this->elementVector, elInfo); + + if (op) { + op->getElementVector(elInfo, this->elementVector); + } else { + std::vector<Operator*>::iterator it; + std::vector<double*>::iterator factorIt; + + for (it = this->operators.begin(), factorIt = this->operatorFactor.begin(); + it != this->operators.end(); + ++it, ++factorIt) { + if ((*it)->getNeedDualTraverse() == false) { + (*it)->getElementVector(elInfo, this->elementVector, + *factorIt ? **factorIt : 1.0); + } + } + } + + addElementVector(factor, *this->elementVector, bound); + } + + template<> + void DOFVectorBase<double>::assemble2(double factor, + ElInfo *mainElInfo, ElInfo *auxElInfo, + ElInfo *smallElInfo, ElInfo *largeElInfo, + const BoundaryType *bound, + Operator *op) + { + FUNCNAME("DOFVector::assemble2()"); + + if (!(op || this->operators.size())) + return; + + Operator *operat = op ? op : this->operators[0]; + + this->elementVector = + operat->getAssembler(omp_get_thread_num())-> + initElementVector(this->elementVector, mainElInfo); + + if (op) { + ERROR_EXIT("TODO"); + // op->getElementVector(mainElInfo, this->elementVector); + } else { + std::vector<Operator*>::iterator it; + std::vector<double*>::iterator factorIt; + for (it = this->operators.begin(), factorIt = this->operatorFactor.begin(); + it != this->operators.end(); + ++it, ++factorIt) { + if ((*it)->getNeedDualTraverse()) { + (*it)->getElementVector(mainElInfo, auxElInfo, + smallElInfo, largeElInfo, + this->elementVector, + *factorIt ? **factorIt : 1.0); + } + } + } + + + addElementVector(factor, *this->elementVector, bound); + } + + } diff --git a/AMDiS/src/DOFVector.h b/AMDiS/src/DOFVector.h index f46cfb84342e25c49789d9dd9f705a34cae719ac..c4f011864e1273415a30d354229ff6ab6324c9b1 100644 --- a/AMDiS/src/DOFVector.h +++ b/AMDiS/src/DOFVector.h @@ -82,31 +82,61 @@ namespace AMDiS { virtual ~DOFVectorBase(); - virtual const T *getLocalVector(const Element *el, - T* localVec) const; + /** \brief + * For the given element, this function returns an array of all DOFs of this + * DOFVector that are defined on this element. + */ + virtual const T *getLocalVector(const Element *el, T* localVec) const; + /** \brief + * Evaluates the DOF vector at a set of quadrature points defined on the + * given element. + */ const T *getVecAtQPs(const ElInfo *elInfo, const Quadrature *quad, const FastQuadrature *quadFast, T *vecAtQPs) const; + const T *getVecAtQPs(const ElInfo *smallElInfo, + const ElInfo *largeElInfo, + const Quadrature *quad, + const FastQuadrature *quadFast, + T *vecAtQPs) const; + const WorldVector<T> *getGrdAtQPs(const ElInfo *elInfo, const Quadrature *quad, const FastQuadrature *quadFast, WorldVector<T> *grdAtQPs) const; + const WorldVector<T> *getGrdAtQPs(const ElInfo *smallElInfo, + const ElInfo *largeElInfo, + const Quadrature *quad, + const FastQuadrature *quadFast, + WorldVector<T> *grdAtQPs) const; + const WorldMatrix<T> *getD2AtQPs(const ElInfo *elInfo, const Quadrature *quad, const FastQuadrature *quadFast, WorldMatrix<T> *d2AtQPs) const; + /// Returns the FE space the DOF vector is defined on. inline const FiniteElemSpace* getFESpace() const { return feSpace; } - ElementVector *assemble(T factor, ElInfo *elInfo, - const BoundaryType *bound, - Operator *op = NULL); + /** \brief + * Assembles the element vector for the given ellement and adds the + * element matrix to the current DOF vector. + */ + void assemble(T factor, ElInfo *elInfo, + const BoundaryType *bound, + Operator *op = NULL); + + void assemble2(T factor, + ElInfo *mainElInfo, ElInfo *auxElInfo, + ElInfo *smallElInfo, ElInfo *largeElInfo, + const BoundaryType *bound, + Operator *op = NULL); void addElementVector(T sign, const ElementVector &elVec, @@ -169,9 +199,7 @@ namespace AMDiS { return operatorEstFactor; } - /** \brief - * Returns \ref name - */ + /// Returns \ref name inline const std::string& getName() const { return name; } @@ -185,76 +213,46 @@ namespace AMDiS { } protected: - /** \brief - * - */ + /// const FiniteElemSpace *feSpace; - /** \brief - * - */ + /// std::string name; - /** \brief - * - */ + /// ElementVector *elementVector; - /** \brief - * - */ + /// std::vector<Operator*> operators; - /** \brief - * - */ + /// std::vector<double*> operatorFactor; - /** \brief - * - */ + /// std::vector<double*> operatorEstFactor; - /** \brief - * - */ + /// BoundaryManager *boundaryManager; - /** \brief - * Number of basis functions of the used finite element space. - */ + /// Number of basis functions of the used finite element space. int nBasFcts; - /** \brief - * Are used to store temporary local dofs of an element. - * Thread safe. - */ + /// Are used to store temporary local dofs of an element. Thread safe. std::vector<DegreeOfFreedom*> localIndices; - /** \brief - * Are used to store temporary local values of an element. - * Thread safe. - */ + /// Are used to store temporary local values of an element. Thread safe. std::vector<T*> localVectors; - /** \brief - * Temporarly used in \ref getGrdAtQPs. Thread safe. - */ + /// Temporarly used in \ref getGrdAtQPs. Thread safe. std::vector<DimVec<double>*> grdTmp; - /** \brief - * Temporarly used in \ref getGrdAtQPs. Thread safe. - */ + /// Temporarly used in \ref getGrdAtQPs. Thread safe. std::vector<DimVec<double>*> grdPhis; - /** \brief - * Temporarly used in \ref getD2AtQPs. Thread safe. - */ + /// Temporarly used in \ref getD2AtQPs. Thread safe. std::vector<DimMat<double>*> D2Phis; - /** \brief - * Dimension of the mesh this DOFVectorBase belongs to - */ + /// Dimension of the mesh this DOFVectorBase belongs to int dim; }; diff --git a/AMDiS/src/DOFVector.hh b/AMDiS/src/DOFVector.hh index 89a176ed8cdf4ab18caaf5049089ebb7b89765fa..533c5da27fb9facba7f79bb5129b48fec850cc1a 100644 --- a/AMDiS/src/DOFVector.hh +++ b/AMDiS/src/DOFVector.hh @@ -18,6 +18,7 @@ #include "OpenMP.h" #include "Operator.h" #include "Parameters.h" +#include "Traverse.h" namespace AMDiS { @@ -114,7 +115,7 @@ namespace AMDiS { BoundaryCondition *condition = bound ? this->getBoundaryManager()->getBoundaryCondition(bound[i]) : NULL; - if(!(condition && condition->isDirichlet())) { + if (!(condition && condition->isDirichlet())) { DegreeOfFreedom irow = elVec.dofIndices[i]; (*this)[irow] = (add ? (*this)[irow] : 0.0); (*this)[irow] += factor * elVec[i]; @@ -135,7 +136,7 @@ namespace AMDiS { double nrm = 0.0; Iterator vecIterator(dynamic_cast<DOFIndexed<T>*>(const_cast<DOFVector<T>*>(this)), USED_DOFS); - for(vecIterator.reset(); !vecIterator.end(); ++vecIterator) + for (vecIterator.reset(); !vecIterator.end(); ++vecIterator) nrm += (*vecIterator) * (*vecIterator); return(sqrt(nrm)); @@ -154,7 +155,7 @@ namespace AMDiS { double nrm = 0.0; Iterator vecIterator(dynamic_cast<DOFIndexed<T>*>(const_cast<DOFVector<T>*>(this)), USED_DOFS); - for(vecIterator.reset(); !vecIterator.end(); ++vecIterator) + for (vecIterator.reset(); !vecIterator.end(); ++vecIterator) nrm += (*vecIterator) * (*vecIterator); return nrm; @@ -173,7 +174,7 @@ namespace AMDiS { double nrm = 0.0; Iterator vecIterator(dynamic_cast<DOFIndexed<T>*>(const_cast<DOFVector<T>*>(this)), USED_DOFS); - for(vecIterator.reset(); !vecIterator.end(); ++vecIterator) + for (vecIterator.reset(); !vecIterator.end(); ++vecIterator) nrm += abs(*vecIterator); return(nrm); @@ -192,7 +193,7 @@ namespace AMDiS { double nrm = 0.0; Iterator vecIterator(dynamic_cast<DOFIndexed<T>*>(const_cast<DOFVector<T>*>(this)), USED_DOFS); - for(vecIterator.reset(); !vecIterator.end(); ++vecIterator) + for (vecIterator.reset(); !vecIterator.end(); ++vecIterator) nrm += *vecIterator; return(nrm); @@ -210,9 +211,9 @@ namespace AMDiS { feSpace->getAdmin()->getUsedSize()); Iterator vecIterator(dynamic_cast<DOFIndexed<T>*>(this), USED_DOFS); - for(vecIterator.reset(); !vecIterator.end(); ++vecIterator) { + for (vecIterator.reset(); !vecIterator.end(); ++vecIterator) { *vecIterator = alpha ; - }; + } } @@ -240,7 +241,7 @@ namespace AMDiS { ++vecIterator, ++xIterator) { *vecIterator = *xIterator; - }; + } } @@ -345,22 +346,20 @@ namespace AMDiS { ysize = y.getSize(); typename DOFVector<T>::Iterator vecIterator(dynamic_cast<DOFIndexed<T>*>(&y), FREE_DOFS); - for(vecIterator.reset(); - !vecIterator.end(); ++vecIterator) { + for (vecIterator.reset(); !vecIterator.end(); ++vecIterator) { *vecIterator = 0; - }; + } if (transpose == NoTranspose) { typename DOFVector<T>::Iterator vecIterator(dynamic_cast<DOFIndexed<T>*>(&y), USED_DOFS); DOFMatrix::Iterator rowIterator(const_cast<DOFMatrix*>(&a), USED_DOFS); - for(vecIterator.reset(), rowIterator.reset(); - !rowIterator.end(); - ++rowIterator, ++vecIterator) { + for (vecIterator.reset(), rowIterator.reset(); !rowIterator.end(); + ++rowIterator, ++vecIterator) { sum = 0; row = &(a[rowIterator.getDOFIndex()]); - for(std::vector<MatEntry>::iterator colIterator = rowIterator->begin(); - colIterator != rowIterator->end(); - colIterator++) { + for (std::vector<MatEntry>::iterator colIterator = rowIterator->begin(); + colIterator != rowIterator->end(); + colIterator++) { jcol = colIterator->col; if (jcol >= 0) { // entry used? sum += (static_cast<T>(colIterator->entry)) * x[jcol]; @@ -371,23 +370,20 @@ namespace AMDiS { } *vecIterator *= beta; *vecIterator += alpha * sum; - }; + } } else if (transpose == Transpose) { typename DOFVector<T>::Iterator vecIterator(dynamic_cast<DOFIndexed<T>*>(&y), USED_DOFS); - for(vecIterator.reset(); - !vecIterator.end(); - ++vecIterator) { + for (vecIterator.reset(); !vecIterator.end(); ++vecIterator) { *vecIterator *= beta ; - }; + } typename DOFVector<T>::Iterator xIterator(dynamic_cast<DOFIndexed<T>*>(const_cast<DOFVector<T>*>(&x)), USED_DOFS); DOFMatrix::Iterator rowIterator(const_cast<DOFMatrix*>(&a), USED_DOFS); - for(xIterator.reset(), rowIterator.reset(); - !rowIterator.end(); - ++rowIterator, ++xIterator) { + for (xIterator.reset(), rowIterator.reset(); !rowIterator.end(); + ++rowIterator, ++xIterator) { ax = alpha * (*xIterator); row = &(a[rowIterator.getDOFIndex()]); - for(std::vector<MatEntry>::iterator colIterator = rowIterator->begin(); + for (std::vector<MatEntry>::iterator colIterator = rowIterator->begin(); colIterator != rowIterator->end(); colIterator++) { jcol = colIterator->col; @@ -424,14 +420,14 @@ namespace AMDiS { format = "%s(%1d,%10.5le)"; Iterator vecIterator(dynamic_cast<DOFIndexed<T>*>(const_cast<DOFVector<T>*>(this)), USED_DOFS); - for(vecIterator.reset(); - !vecIterator.end(); ++vecIterator) { + for (vecIterator.reset(); !vecIterator.end(); ++vecIterator) { if ((j % 3) == 0) { if (j) Msg::print("\n"); MSG(format, "", vecIterator.getDOFIndex(), *vecIterator); - } else + } else { Msg::print(format, " ", vecIterator.getDOFIndex(), *vecIterator); + } j++; } Msg::print("\n"); @@ -511,32 +507,31 @@ namespace AMDiS { } traverseVector = this; - this->getFESpace()->getMesh()->traverse(-1, - Mesh::CALL_LEAF_EL | - Mesh::FILL_COORDS, - interpolFct); - return; + TraverseStack stack; + ElInfo *elInfo = stack.traverseFirst(this->getFESpace()->getMesh(), -1, + Mesh::CALL_LEAF_EL | Mesh::FILL_COORDS); + while (elInfo) { + interpolFct(elInfo); + elInfo = stack.traverseNext(elInfo); + } } template<typename T> int DOFVector<T>::interpolFct(ElInfo* elinfo) { - int i; const BasisFunction *basFct = traverseVector->getFESpace()->getBasisFcts(); const DOFAdmin* admin = traverseVector->getFESpace()->getAdmin(); - const DegreeOfFreedom *dof = - basFct->getLocalIndices(const_cast<Element *>(elinfo->getElement()), - admin, NULL); - const T *inter_val = - const_cast<BasisFunction*>(basFct)->interpol(elinfo, - 0, - NULL, - traverseVector->interFct, - NULL); + const DegreeOfFreedom *dof = basFct->getLocalIndices(const_cast<Element *>(elinfo->getElement()), + admin, NULL); + const T *inter_val = const_cast<BasisFunction*>(basFct)->interpol(elinfo, + 0, + NULL, + traverseVector->interFct, + NULL); int number = basFct->getNumber(); - for (i = 0; i < number; i++) + for (int i = 0; i < number; i++) (*traverseVector)[dof[i]] = inter_val[i]; return 0; @@ -733,48 +728,12 @@ namespace AMDiS { } } - template<typename T> - ElementVector* DOFVectorBase<T>::assemble(T factor, ElInfo *elInfo, - const BoundaryType *bound, - Operator *op) - { - FUNCNAME("DOFVector::assemble()"); - - if (!(op || this->operators.size())) - return NULL; - - Operator *operat = op ? op : this->operators[0]; - - this->elementVector = - operat->getAssembler(omp_get_thread_num())->initElementVector(this->elementVector, elInfo); - - if (op) { - op->getElementVector(elInfo, this->elementVector); - } else { - std::vector<Operator*>::iterator it; - std::vector<double*>::iterator factorIt; - for (it = this->operators.begin(), factorIt = this->operatorFactor.begin(); - it != this->operators.end(); - ++it, ++factorIt) { - (*it)->getElementVector(elInfo, - this->elementVector, - *factorIt ? **factorIt : 1.0); - } - } - - addElementVector(factor, - *this->elementVector, - bound); - - return this->elementVector; - } - template<typename T> Flag DOFVectorBase<T>::getAssembleFlag() { Flag fillFlag(0); std::vector<Operator*>::iterator op; - for(op = this->operators.begin(); op != this->operators.end(); ++op) { + for (op = this->operators.begin(); op != this->operators.end(); ++op) { fillFlag |= (*op)->getFillFlag(); } return fillFlag; @@ -814,7 +773,7 @@ namespace AMDiS { typename DOFVector<T>::Iterator vecIterator(dynamic_cast<DOFIndexed<T>*>(&x), USED_DOFS); for (vecIterator.reset(); !vecIterator.end(); ++vecIterator) { (*vecIterator) *= scal; - }; + } return x; } @@ -907,11 +866,10 @@ namespace AMDiS { T dot = 0; typename DOFVector<T>::Iterator xIterator(dynamic_cast<DOFIndexed<T>*>(&x), USED_DOFS); typename DOFVector<T>::Iterator yIterator(dynamic_cast<DOFIndexed<T>*>(&y), USED_DOFS); - for (xIterator.reset(), yIterator.reset(); - !xIterator.end(); + for (xIterator.reset(), yIterator.reset(); !xIterator.end(); ++xIterator, ++yIterator) { dot += (*xIterator) * (*yIterator); - }; + } return(dot); } @@ -954,16 +912,15 @@ namespace AMDiS { typename DOFVector<T>::Iterator vecIterator(dynamic_cast<DOFIndexed<T>*>(&result), USED_DOFS); DOFMatrix::Iterator rowIterator(const_cast<DOFMatrix*>(&a), USED_DOFS); - for(vecIterator.reset(), rowIterator.reset(); - !rowIterator.end(); + for (vecIterator.reset(), rowIterator.reset(); !rowIterator.end(); ++rowIterator, ++vecIterator) { double sum = 0; if (!add) *vecIterator = 0.0; - for(std::vector<MatEntry>::iterator colIterator = rowIterator->begin(); - colIterator != rowIterator->end(); - colIterator++) { + for (std::vector<MatEntry>::iterator colIterator = rowIterator->begin(); + colIterator != rowIterator->end(); + colIterator++) { int jcol = colIterator->col; if (jcol >= 0) { // entry used? @@ -987,19 +944,17 @@ namespace AMDiS { ("a.size = %d too small: admin->sizeUsed = %d\n", a.getSize(), a.getRowFESpace()->getAdmin()->getUsedSize()); - if(!add) { + if (!add) { typename DOFVector<T>::Iterator vecIterator(dynamic_cast<DOFIndexed<T>*>(&result), USED_DOFS); - for(vecIterator.reset(); - !vecIterator.end(); ++vecIterator) { + for (vecIterator.reset(); !vecIterator.end(); ++vecIterator) { *vecIterator = 0; - }; + } } typename DOFVector<T>::Iterator xIterator(const_cast<DOFIndexed<T>*>(dynamic_cast<const DOFIndexed<T>*>(&x)), USED_DOFS); DOFMatrix::Iterator rowIterator(const_cast<DOFMatrix*>(&a), USED_DOFS); - for(xIterator.reset(), rowIterator.reset(); - !rowIterator.end(); - ++rowIterator, ++xIterator) { + for (xIterator.reset(), rowIterator.reset(); !rowIterator.end(); + ++rowIterator, ++xIterator) { T ax = (*xIterator); for (std::vector<MatEntry>::iterator colIterator = rowIterator->begin(); colIterator != rowIterator->end(); @@ -1039,11 +994,10 @@ namespace AMDiS { typename DOFVector<T>::Iterator xIterator(dynamic_cast<DOFIndexed<T>*>(const_cast<DOFVector<T>*>(&x)), USED_DOFS); typename DOFVector<T>::Iterator yIterator(dynamic_cast<DOFIndexed<T>*>(&y), USED_DOFS); - for (xIterator.reset(), yIterator.reset(); - !xIterator.end(); + for (xIterator.reset(), yIterator.reset(); !xIterator.end(); ++xIterator, ++yIterator) { *yIterator += alpha * (*xIterator); - }; + } } template<typename T> @@ -1091,11 +1045,10 @@ namespace AMDiS { typename DOFVector<T>::Iterator xIterator(dynamic_cast<DOFIndexed<T>*>(const_cast<DOFVector<T>*>(&x)), USED_DOFS); typename DOFVector<T>::Iterator yIterator(dynamic_cast<DOFIndexed<T>*>(&y), USED_DOFS); - for (xIterator.reset(), yIterator.reset(); - !xIterator.end(); + for (xIterator.reset(), yIterator.reset(); !xIterator.end(); ++xIterator, ++yIterator) { *yIterator = alpha *(*yIterator)+ (*xIterator); - }; + } } template<typename T> @@ -1105,11 +1058,10 @@ namespace AMDiS { { typename DOFVector<T>::Iterator vIterator(dynamic_cast<DOFIndexed<T>*>(const_cast<DOFVector<T>*>(&v)), USED_DOFS); typename DOFVector<T>::Iterator rIterator(dynamic_cast<DOFIndexed<T>*>(&result), USED_DOFS); - for (vIterator.reset(), rIterator.reset(); - !vIterator.end(); + for (vIterator.reset(), rIterator.reset(); !vIterator.end(); ++vIterator, ++rIterator) { *rIterator = scal * (*vIterator); - }; + } return result; } @@ -1121,12 +1073,10 @@ namespace AMDiS { { typename DOFVector<T>::Iterator vIterator(dynamic_cast<DOFIndexed<T>*>(const_cast<DOFVector<T>*>(&v)), USED_DOFS); typename DOFVector<T>::Iterator rIterator(dynamic_cast<DOFIndexed<T>*>(&result), USED_DOFS); - for(vIterator.reset(), rIterator.reset(); - !vIterator.end(); - ++vIterator, ++rIterator) - { - *rIterator = (*vIterator) + scal; - }; + for (vIterator.reset(), rIterator.reset(); !vIterator.end(); + ++vIterator, ++rIterator) { + *rIterator = (*vIterator) + scal; + } return result; } @@ -1138,12 +1088,10 @@ namespace AMDiS { typename DOFVector<T>::Iterator v1Iterator(dynamic_cast<DOFIndexed<T>*>(const_cast<DOFVector<T>*>(&v1)), USED_DOFS); typename DOFVector<T>::Iterator v2Iterator(dynamic_cast<DOFIndexed<T>*>(const_cast<DOFVector<T>*>(&v2)), USED_DOFS); typename DOFVector<T>::Iterator rIterator(dynamic_cast<DOFIndexed<T>*>(&result), USED_DOFS); - for(v1Iterator.reset(), v2Iterator.reset(), rIterator.reset(); - !v1Iterator.end(); - ++v1Iterator, ++v2Iterator, ++rIterator) - { - *rIterator = (*v1Iterator) + (*v2Iterator); - }; + for (v1Iterator.reset(), v2Iterator.reset(), rIterator.reset(); !v1Iterator.end(); + ++v1Iterator, ++v2Iterator, ++rIterator) { + *rIterator = (*v1Iterator) + (*v2Iterator); + } return result; } @@ -1154,8 +1102,7 @@ namespace AMDiS { typename DOFVector<T>::Iterator vIterator(dynamic_cast<DOFIndexed<T>*>(const_cast<DOFVector<T>*>(&v)), USED_DOFS); typename DOFVector<T>::Iterator rIterator(dynamic_cast<DOFIndexed<T>*>(&result), USED_DOFS); - for (vIterator.reset(), rIterator.reset(); - !vIterator.end(); + for (vIterator.reset(), rIterator.reset(); !vIterator.end(); ++vIterator, ++rIterator) { *rIterator = fmod((*vIterator), 1.0); } @@ -1182,31 +1129,6 @@ namespace AMDiS { } - template<typename T> - const T *DOFVectorBase<T>::getLocalVector(const Element *el, T *d) const - { - static T* localVec = NULL; - T *result; - if (d) { - result = d; - } else { - if (localVec) - delete [] localVec; - localVec = new T[nBasFcts]; - result = localVec; - } - - DegreeOfFreedom *myLocalIndices = localIndices[omp_get_thread_num()]; - feSpace->getBasisFcts()->getLocalIndices(el, feSpace->getAdmin(), - myLocalIndices); - - for (int i = 0; i < nBasFcts; i++) { - result[i] = (*this)[myLocalIndices[i]]; - } - - return result; - } - template<typename T> const T *DOFVectorBase<T>::getVecAtQPs(const ElInfo *elInfo, const Quadrature *quad, @@ -1258,6 +1180,31 @@ namespace AMDiS { return const_cast<const T*>(result); } + template<typename T> + const T *DOFVectorBase<T>::getLocalVector(const Element *el, T *d) const + { + static T* localVec = NULL; + T *result; + if (d) { + result = d; + } else { + if (localVec) + delete [] localVec; + localVec = new T[nBasFcts]; + result = localVec; + } + + DegreeOfFreedom *myLocalIndices = localIndices[omp_get_thread_num()]; + feSpace->getBasisFcts()->getLocalIndices(el, feSpace->getAdmin(), + myLocalIndices); + + for (int i = 0; i < nBasFcts; i++) { + result[i] = (*this)[myLocalIndices[i]]; + } + + return result; + } + // integral u^2(1-u)^2 template<typename T> double DOFVector<T>::DoubleWell(Quadrature* q) const diff --git a/AMDiS/src/ElInfo.cc b/AMDiS/src/ElInfo.cc index 9470d9d21cf4867b41266aef3f49f4ae55319c7b..a7058c5ea05ee3b61abcd921bb68850e2e36ae35 100644 --- a/AMDiS/src/ElInfo.cc +++ b/AMDiS/src/ElInfo.cc @@ -33,7 +33,7 @@ namespace AMDiS { neighbour_(mesh_->getDim(), NO_INIT), neighbourCoord_(mesh_->getDim(), NO_INIT), oppVertex_(mesh_->getDim(), NO_INIT), - grdLambda_(mesh_->getDim(), NO_INIT), + grdLambda(mesh_->getDim(), NO_INIT), subElemCoordsMat(NULL) { projection_.set(NULL); @@ -165,7 +165,7 @@ namespace AMDiS { void ElInfo::fillDetGrdLambda() { if (fillFlag_.isSet(Mesh::FILL_GRD_LAMBDA)) { - det_ = calcGrdLambda(grdLambda_); + det_ = calcGrdLambda(grdLambda); } else { if (fillFlag_.isSet(Mesh::FILL_DET)) { det_ = calcDet(); diff --git a/AMDiS/src/ElInfo.h b/AMDiS/src/ElInfo.h index 3951b8296f15bec2385e599302ec5c64d7161f66..9f5c9bc2ee24a084d9de13242824ac5582f260bd 100644 --- a/AMDiS/src/ElInfo.h +++ b/AMDiS/src/ElInfo.h @@ -247,10 +247,10 @@ namespace AMDiS { } /** \brief - * Returns \ref grdLambda_ + * Returns \ref grdLambda */ inline const DimVec<WorldVector<double> >& getGrdLambda() const { - return grdLambda_; + return grdLambda; } /** \brief @@ -417,7 +417,7 @@ namespace AMDiS { /** \brief - * Fills ElInfo's \ref det_ and \ref grdLambda_ entries. + * Fills ElInfo's \ref det_ and \ref grdLambda entries. */ virtual void fillDetGrdLambda(); @@ -603,7 +603,7 @@ namespace AMDiS { /** \brief * Gradient of lambda. */ - DimVec<WorldVector<double> > grdLambda_; + DimVec<WorldVector<double> > grdLambda; /** \brief * True, if this elInfo stores parametrized information. False, otherwise. diff --git a/AMDiS/src/ElInfo2d.cc b/AMDiS/src/ElInfo2d.cc index af4bebfaf4e0cfeacab270186377a82b134dde17..fe0efee1f8670f83bf3cd08a041d4e0e2e408072 100644 --- a/AMDiS/src/ElInfo2d.cc +++ b/AMDiS/src/ElInfo2d.cc @@ -562,7 +562,7 @@ namespace AMDiS { normal *= 1.0 / det; - return(det); + return det; } @@ -571,7 +571,7 @@ namespace AMDiS { /* return the absulute value of the determinant from the */ /* transformation to the reference element */ /****************************************************************************/ - double ElInfo2d::getElementNormal( WorldVector<double> &elementNormal) const + double ElInfo2d::getElementNormal(WorldVector<double> &elementNormal) const { FUNCNAME("ElInfo::getElementNormal()"); @@ -589,7 +589,7 @@ namespace AMDiS { elementNormal *= 1.0 / det; - return(det); + return det; } void ElInfo2d::getRefSimplexCoords(DimMat<double> *coords) const @@ -623,13 +623,13 @@ namespace AMDiS { (*coords)[1][0] = (*coords)[1][2]; (*coords)[2][0] = (*coords)[2][2]; } else { - (*coords)[0][1] = (*coords)[0][2]; - (*coords)[1][1] = (*coords)[1][2]; - (*coords)[2][1] = (*coords)[2][2]; - (*coords)[0][0] = (*coords)[0][1]; (*coords)[1][0] = (*coords)[1][1]; - (*coords)[2][0] = (*coords)[2][1]; + (*coords)[2][0] = (*coords)[2][1]; + + (*coords)[0][1] = (*coords)[0][2]; + (*coords)[1][1] = (*coords)[1][2]; + (*coords)[2][1] = (*coords)[2][2]; } (*coords)[0][2] = c0; diff --git a/AMDiS/src/ElementFileWriter.cc b/AMDiS/src/ElementFileWriter.cc index bfd4edf6ace56ebe91581a5f4ad515fa7e6d7d71..63b7b61fb3b03e8cebb8d0ec846dc1a6d3b2bf22 100644 --- a/AMDiS/src/ElementFileWriter.cc +++ b/AMDiS/src/ElementFileWriter.cc @@ -7,7 +7,6 @@ namespace AMDiS { ElementFileWriter::ElementFileWriter(const std::string& name_, - Mesh *mesh_, const FiniteElemSpace *feSpace_, std::map<int, double> &vec_) : name(name_), @@ -22,7 +21,7 @@ namespace AMDiS { indexDecimals(3), tsModulo(1), timestepNumber(-1), - mesh(mesh_), + mesh(feSpace_->getMesh()), feSpace(feSpace_), vec(vec_) { @@ -41,7 +40,8 @@ namespace AMDiS { } void ElementFileWriter::writeFiles(AdaptInfo *adaptInfo, bool force, - int level, Flag traverseFlag, bool (*writeElem)(ElInfo*)) + int level, Flag traverseFlag, + bool (*writeElem)(ElInfo*)) { FUNCNAME("ElementFileWriter::writeFiles()"); @@ -93,10 +93,10 @@ namespace AMDiS { } } - void ElementFileWriter::writeTecPlotValues(const char* filename) + void ElementFileWriter::writeTecPlotValues(const std::string &filename) { FUNCNAME("ElementFileWriter::writeTecPlotValues()"); - std::ofstream fout(filename); + std::ofstream fout(filename.c_str()); TEST_EXIT(fout)("Could not open file %s !\n", filename); fout.setf(std::ios::scientific,std::ios::floatfield); @@ -173,10 +173,10 @@ namespace AMDiS { fout.close(); } - void ElementFileWriter::writeMeshDatValues(const char* filename, double time) + void ElementFileWriter::writeMeshDatValues(const std::string &filename, double time) { FUNCNAME("ElementFileWriter::writeMeshDatValues()"); - std::ofstream fout(filename); + std::ofstream fout(filename.c_str()); TEST_EXIT(fout)("Could not open file %s !\n", filename); @@ -272,10 +272,10 @@ namespace AMDiS { fout.close(); } - void ElementFileWriter::writeVtkValues(const char* filename) + void ElementFileWriter::writeVtkValues(const std::string &filename) { FUNCNAME("ElementFileWriter::writeVtkValues()"); - std::ofstream fout(filename); + std::ofstream fout(filename.c_str()); TEST_EXIT(fout)("Could not open file %s !\n", filename); diff --git a/AMDiS/src/ElementFileWriter.h b/AMDiS/src/ElementFileWriter.h index 3ba744748ccd94e932423e8e0b796f80dc11a4bd..dd9b1eff68d80083da5b50b6ad87db0f1c685b61 100644 --- a/AMDiS/src/ElementFileWriter.h +++ b/AMDiS/src/ElementFileWriter.h @@ -9,6 +9,15 @@ namespace AMDiS { + /** \brief + * Filewriter that make it possible to create mesh files, where the values + * are not defined on DOFs, but instead are defined on the elements. + * + * It can be necessary to visualize data defined on elements, e.g. residual + * error that is defined on elements and not on DOFs. This class takes as + * input a mesh and a map, which defines for each element index a (double) + * value, and outputs a TecPlot/AMDiS/VTK mesh. + */ class ElementFileWriter : public FileWriterInterface { public: @@ -17,10 +26,9 @@ namespace AMDiS { /** * Constructor. */ - ElementFileWriter(const std::string& name_, - Mesh *mesh_, - const FiniteElemSpace *feSpace_, - std::map<int, double> &vec_); + ElementFileWriter(const std::string& name, + const FiniteElemSpace *feSpace, + std::map<int, double> &vec); /** * Implementation of FileWriterInterface::writeFiles(). @@ -34,17 +42,17 @@ namespace AMDiS { /** * Writes element data in tecplot format. */ - void writeTecPlotValues(const char* filename); + void writeTecPlotValues(const std::string &filename); /** * Writes element data in AMDiS format (1 file !). */ - void writeMeshDatValues(const char* filename, double time); + void writeMeshDatValues(const std::string &filename, double time); /** * Writes element data in VTK format. */ - void writeVtkValues(const char* filename); + void writeVtkValues(const std::string &filename); protected: /** \brief diff --git a/AMDiS/src/Estimator.h b/AMDiS/src/Estimator.h index 8254c802c2449b101789b2953f391bf757e752dd..883eb5c98cd1b861534d2fb2e70e2e4db0d46401 100755 --- a/AMDiS/src/Estimator.h +++ b/AMDiS/src/Estimator.h @@ -59,7 +59,7 @@ namespace AMDiS { public: MEMORY_MANAGED(Estimator); - Estimator() {}; + Estimator() {} /** \brief * Constructor. @@ -69,14 +69,14 @@ namespace AMDiS { /** \brief * destructor */ - virtual ~Estimator() {}; + virtual ~Estimator() {} /** \brief * Returns \ref name of the Estimator */ inline const std::string& getName() const { return name; - }; + } /** \brief * Performs the estimation and returns the final \ref est_sum @@ -86,66 +86,66 @@ namespace AMDiS { /** \brief * */ - virtual void init(double timestep) {}; + virtual void init(double timestep) {} /** \brief * */ - virtual void estimateElement(ElInfo *elInfo) {}; + virtual void estimateElement(ElInfo *elInfo) {} /** \brief * */ - virtual void exit(bool output=true) {}; + virtual void exit(bool output=true) {} /** \brief * Returns \ref est_sum of the Estimator */ inline double getErrorSum() const { return est_sum; - }; + } /** \brief * Sets \ref est_sum of the Estimator */ inline void setErrorSum(double sum) { est_sum = sum; - }; + } /** \brief * Returns \ref est_max of the Estimator */ inline double getErrorMax() const { return est_max; - }; + } /** \brief * Returns the estimated time error. */ virtual double getTimeEst() const { return est_t_sum; - }; + } /** \brief * Returns the maximal time estimation. */ virtual double getTimeEstMax() const { return est_t_max; - }; + } /** \brief * Sets \ref est_max of the Estimator */ inline void setErrorMax(double m) { est_max = m; - }; + } /** \brief * Returns \ref norm. */ inline Norm getErrorNorm() { return norm; - }; + } /** \brief * Adds one system to the estimator. @@ -159,7 +159,7 @@ namespace AMDiS { uh.push_back(uh_); fh.push_back(fh_); uhOld.push_back(uhOld_); - }; + } /** \brief * Adds pointer to old solution to the given system. @@ -176,19 +176,19 @@ namespace AMDiS { */ inline int getNumSystems() { return static_cast<int>(matrix.size()); - }; + } inline Flag getTraverseFlag() { return traverseFlag; - }; + } inline Mesh* getMesh() { return mesh; - }; + } inline int getRow() { return row; - }; + } protected: /** \brief @@ -276,26 +276,26 @@ namespace AMDiS { /** \brief * constructor */ - EstimatorCreator() : row(-1) {}; + EstimatorCreator() : row(-1) {} /** \brief * destructor */ - virtual ~EstimatorCreator() {}; + virtual ~EstimatorCreator() {} /** \brief * Sets \ref name */ void setName(std::string name_) { name = name_; - }; + } /** \brief * Sets \ref row */ void setRow(int r) { row = r; - }; + } protected: /** \brief diff --git a/AMDiS/src/FirstOrderAssembler.cc b/AMDiS/src/FirstOrderAssembler.cc index 868318f6a19fe5551d0ef70271db3a876e951b83..1e189e574bda176807fec5fc8bfb97a22fcbd909 100644 --- a/AMDiS/src/FirstOrderAssembler.cc +++ b/AMDiS/src/FirstOrderAssembler.cc @@ -81,24 +81,24 @@ namespace AMDiS { } // create new assembler - if (!optimized) { + // if (!optimized) { newAssembler = (type == GRD_PSI) ? dynamic_cast<FirstOrderAssembler*>(NEW Stand10(op, assembler, quad)) : dynamic_cast<FirstOrderAssembler*>(NEW Stand01(op, assembler, quad)); - } else { - if (pwConst) { - newAssembler = - (type == GRD_PSI) ? - dynamic_cast<FirstOrderAssembler*>(NEW Pre10(op, assembler, quad)) : - dynamic_cast<FirstOrderAssembler*>(NEW Pre01(op, assembler, quad)); - } else { - newAssembler = - (type == GRD_PSI) ? - dynamic_cast<FirstOrderAssembler*>( NEW Quad10(op, assembler, quad)) : - dynamic_cast<FirstOrderAssembler*>( NEW Quad01(op, assembler, quad)); - } - } +// } else { +// if (pwConst) { +// newAssembler = +// (type == GRD_PSI) ? +// dynamic_cast<FirstOrderAssembler*>(NEW Pre10(op, assembler, quad)) : +// dynamic_cast<FirstOrderAssembler*>(NEW Pre01(op, assembler, quad)); +// } else { +// newAssembler = +// (type == GRD_PSI) ? +// dynamic_cast<FirstOrderAssembler*>( NEW Quad10(op, assembler, quad)) : +// dynamic_cast<FirstOrderAssembler*>( NEW Quad01(op, assembler, quad)); +// } +// } subAssemblers->push_back(newAssembler); return newAssembler; @@ -146,6 +146,62 @@ namespace AMDiS { FREE_MEMORY(phival, double, nCol); } + void Stand10::calculateElementMatrix(const ElInfo *rowElInfo, + const ElInfo *colElInfo, + const ElInfo *smallElInfo, + const ElInfo *largeElInfo, + ElementMatrix *mat) + { + FUNCNAME("Stand10::calculateElementMatrix()"); + + TEST_EXIT((nRow <= 3) && (nCol <= 3))("not yet!\n"); + + DimVec<double> grdPsi(dim, DEFAULT_VALUE, 0.0); + + const BasisFunction *psi = owner->getRowFESpace()->getBasisFcts(); + const BasisFunction *phi = owner->getColFESpace()->getBasisFcts(); + DimMat<double> *m = smallElInfo->getSubElemCoordsMat(); + + TEST_EXIT(m)("No subElemCoordsMat!\n"); + + int nPoints = quadrature->getNumPoints(); + + VectorOfFixVecs<DimVec<double> > Lb(dim, nPoints, NO_INIT); + for (int iq = 0; iq < nPoints; iq++) { + Lb[iq].set(0.0); + } + + int myRank = omp_get_thread_num(); + for (int i = 0; i < static_cast<int>(terms[myRank].size()); i++) { + (static_cast<FirstOrderTerm*>((terms[myRank][i])))-> + getLb(smallElInfo, nPoints, Lb); + } + + for (int iq = 0; iq < nPoints; iq++) { + Lb[iq] *= smallElInfo->getDet(); + } + + DimVec<double> val1(dim, DEFAULT_VALUE, 0.0); + + for (int i = 0; i < nRow; i++) { + for (int j = 0; j < nCol; j++) { + for (int iq = 0; iq < nPoints; iq++) { + + val1.set(0.0); + + for (int k = 0; k < nCol; k++) { + (*(psi->getGrdPhi(k)))(quadrature->getLambda(iq), grdPsi); + grdPsi *= (*m)[i][k]; + val1 += grdPsi; + } + + (*mat)[i][j] += quadrature->getWeight(iq) * (Lb[iq] * val1) * + (*(phi->getPhi(j)))(quadrature->getLambda(iq)); + } + } + } + } + Quad10::Quad10(Operator *op, Assembler *assembler, Quadrature *quad) : FirstOrderAssembler(op, assembler, quad, true, GRD_PSI) @@ -285,6 +341,61 @@ namespace AMDiS { } } + void Stand01::calculateElementMatrix(const ElInfo *rowElInfo, + const ElInfo *colElInfo, + const ElInfo *smallElInfo, + const ElInfo *largeElInfo, + ElementMatrix *mat) + { + FUNCNAME("Stand10::calculateElementMatrix()"); + + TEST_EXIT((nRow <= 3) && (nCol <= 3))("not yet!\n"); + + DimVec<double> grdPhi(dim, DEFAULT_VALUE, 0.0); + + const BasisFunction *psi = owner->getRowFESpace()->getBasisFcts(); + const BasisFunction *phi = owner->getColFESpace()->getBasisFcts(); + DimMat<double> *m = smallElInfo->getSubElemCoordsMat(); + + TEST_EXIT(m)("No subElemCoordsMat!\n"); + + int nPoints = quadrature->getNumPoints(); + + VectorOfFixVecs<DimVec<double> > Lb(dim, nPoints, NO_INIT); + for (int iq = 0; iq < nPoints; iq++) { + Lb[iq].set(0.0); + } + + int myRank = omp_get_thread_num(); + for (int i = 0; i < static_cast<int>(terms[myRank].size()); i++) { + (static_cast<FirstOrderTerm*>((terms[myRank][i])))-> + getLb(smallElInfo, nPoints, Lb); + } + + for (int iq = 0; iq < nPoints; iq++) { + Lb[iq] *= smallElInfo->getDet(); + } + + + for (int i = 0; i < nRow; i++) { + for (int j = 0; j < nCol; j++) { + for (int iq = 0; iq < nPoints; iq++) { + + double val0 = 0.0; + + for (int k = 0; k < nCol; k++) { + val0 = (*m)[i][k] * (*(psi->getPhi(k)))(quadrature->getLambda(iq)); + } + + (*(phi->getGrdPhi(j)))(quadrature->getLambda(iq), grdPhi); + + (*mat)[i][j] += quadrature->getWeight(iq) * ((Lb[iq] * val0) * grdPhi); + + } + } + } + } + void Stand10::calculateElementVector(const ElInfo *elInfo, ElementVector *vec) { DimVec<double> grdPsi(dim, DEFAULT_VALUE, 0.0); diff --git a/AMDiS/src/FirstOrderAssembler.h b/AMDiS/src/FirstOrderAssembler.h index ee10b3c8faa2ad9d83014fe237c6391b8bbd795a..16236732272bb31b861e62be725784cefcdacef8 100644 --- a/AMDiS/src/FirstOrderAssembler.h +++ b/AMDiS/src/FirstOrderAssembler.h @@ -33,15 +33,11 @@ namespace AMDiS { FirstOrderType type, bool optimized); - /** \brief - * Destructor. - */ - virtual ~FirstOrderAssembler() {}; + /// Destructor. + virtual ~FirstOrderAssembler() {} protected: - /** \brief - * Constructor. - */ + /// Constructor. FirstOrderAssembler(Operator *op, Assembler *assembler, Quadrature *quadrat, @@ -50,30 +46,19 @@ namespace AMDiS { protected: - /** \brief - * List of all yet created optimized zero order assemblers for grdPsi. - */ + /// List of all yet created optimized zero order assemblers for grdPsi. static std::vector<SubAssembler*> optimizedSubAssemblersGrdPsi; - /** \brief - * List of all yet created standard zero order assemblers for grdPsi. - */ + /// List of all yet created standard zero order assemblers for grdPsi. static std::vector<SubAssembler*> standardSubAssemblersGrdPsi; - /** \brief - * List of all yet created optimized zero order assemblers for grdPhi. - */ + /// List of all yet created optimized zero order assemblers for grdPhi. static std::vector<SubAssembler*> optimizedSubAssemblersGrdPhi; - /** \brief - * List of all yet created standard zero order assemblers for grdPhi. - */ + /// List of all yet created standard zero order assemblers for grdPhi. static std::vector<SubAssembler*> standardSubAssemblersGrdPhi; }; - // ============================================================================ - // ===== class Stand10 ======================================================== - // ============================================================================ /** * \ingroup Assembler @@ -86,34 +71,23 @@ namespace AMDiS { public: MEMORY_MANAGED(Stand10); - /** \brief - * Constructor. - */ + /// Constructor. Stand10(Operator *op, Assembler *assembler, Quadrature *quad); - /** \brief - * Implements SubAssembler::calculateElementMatrix(). - */ + /// Implements SubAssembler::calculateElementMatrix(). void calculateElementMatrix(const ElInfo *elInfo, ElementMatrix *mat); + /// void calculateElementMatrix(const ElInfo *rowElInfo, const ElInfo *colElInfo, const ElInfo *smallElInfo, const ElInfo *largeElInfo, - ElementMatrix *mat) - { - ERROR_EXIT("CEM not yet\n"); - } + ElementMatrix *mat); - /** \brief - * Implements SubAssembler::calculateElementVector(). - */ + /// Implements SubAssembler::calculateElementVector(). void calculateElementVector(const ElInfo *, ElementVector */*vec*/); }; - // ============================================================================ - // ===== class Stand10 ======================================================== - // ============================================================================ /** * \ingroup Assembler @@ -126,38 +100,30 @@ namespace AMDiS { public: MEMORY_MANAGED(Stand01); - /** \brief - * Constructor. - */ + /// Constructor. Stand01(Operator *op, Assembler *assembler, Quadrature *quad); - /** \brief - * Implements SubAssembler::calculateElementMatrix(). - */ + /// Implements SubAssembler::calculateElementMatrix(). void calculateElementMatrix(const ElInfo *elInfo, ElementMatrix *mat); + /// void calculateElementMatrix(const ElInfo *rowElInfo, const ElInfo *colElInfo, const ElInfo *smallElInfo, const ElInfo *largeElInfo, - ElementMatrix *mat) - { - ERROR_EXIT("CEM not yet\n"); - } + ElementMatrix *mat); - /** \brief - * Implements SubAssembler::calculateElementVector(). - */ + /// Implements SubAssembler::calculateElementVector(). void calculateElementVector(const ElInfo *, ElementVector *) { ERROR_EXIT("should not be called\n"); - }; + } }; - // ============================================================================ - // ===== class Quad10 ========================================================= - // ============================================================================ - /** \brief + /** + * \ingroup Assembler + * + * \brief * First order assembler for grdPsi using fast quadratures. */ class Quad10 : public FirstOrderAssembler @@ -165,16 +131,13 @@ namespace AMDiS { public: MEMORY_MANAGED(Quad10); - /** \brief - * Constructor. - */ + /// Constructor. Quad10(Operator *op, Assembler *assembler, Quadrature *quad); - /** \brief - * Implements SubAssembler::calculateElementMatrix(). - */ + /// Implements SubAssembler::calculateElementMatrix(). void calculateElementMatrix(const ElInfo *elInfo, ElementMatrix *mat); + /// void calculateElementMatrix(const ElInfo *rowElInfo, const ElInfo *colElInfo, const ElInfo *smallElInfo, @@ -184,17 +147,14 @@ namespace AMDiS { ERROR_EXIT("CEM not yet\n"); } - /** \brief - * Implements SubAssembler::calculateElementVector(). - */ - void calculateElementVector(const ElInfo *, ElementVector */*vec*/); + /// Implements SubAssembler::calculateElementVector(). + void calculateElementVector(const ElInfo *, ElementVector *); }; - // ============================================================================ - // ===== class Quad01 ========================================================= - // ============================================================================ - - /** \brief + /** + * \ingroup Assembler + * + * \brief * First order assembler for grdPhi using fast quadratures. */ class Quad01 : public FirstOrderAssembler @@ -202,16 +162,13 @@ namespace AMDiS { public: MEMORY_MANAGED(Quad01); - /** \brief - * Constructor. - */ + /// Constructor. Quad01(Operator *op, Assembler *assembler, Quadrature *quad); - /** \brief - * Implements SubAssembler::calculateElementMatrix(). - */ + /// Implements SubAssembler::calculateElementMatrix(). void calculateElementMatrix(const ElInfo *elInfo, ElementMatrix *mat); + /// void calculateElementMatrix(const ElInfo *rowElInfo, const ElInfo *colElInfo, const ElInfo *smallElInfo, @@ -221,19 +178,17 @@ namespace AMDiS { ERROR_EXIT("CEM not yet\n"); } - /** \brief - * Implements SubAssembler::calculateElementVector(). - */ - void calculateElementVector(const ElInfo *, ElementVector */*vec*/) { + /// Implements SubAssembler::calculateElementVector(). + void calculateElementVector(const ElInfo *, ElementVector *) { ERROR_EXIT("should not be called\n"); - }; + } }; - // ============================================================================ - // ===== class Pre10 ========================================================== - // ============================================================================ - /** \brief + /** + * \ingroup Assembler + * + * \brief * First order assembler for grdPsi using precalculated integrals */ class Pre10 : public FirstOrderAssembler @@ -241,16 +196,13 @@ namespace AMDiS { public: MEMORY_MANAGED(Pre10); - /** \brief - * Constructor. - */ + /// Constructor. Pre10(Operator *op, Assembler *assembler, Quadrature *quad); - /** \brief - * Implements SubAssembler::calculateElementMatrix(). - */ + /// Implements SubAssembler::calculateElementMatrix(). void calculateElementMatrix(const ElInfo *elInfo, ElementMatrix *mat); + /// void calculateElementMatrix(const ElInfo *rowElInfo, const ElInfo *colElInfo, const ElInfo *smallElInfo, @@ -260,30 +212,24 @@ namespace AMDiS { ERROR_EXIT("CEM not yet\n"); } - /** \brief - * Implements SubAssembler::calculateElementVector(). - */ - void calculateElementVector(const ElInfo *, ElementVector */*vec*/); + /// Implements SubAssembler::calculateElementVector(). + void calculateElementVector(const ElInfo *, ElementVector *); protected: - /** \brief - * Integral of the product of the derivative of psi and phi. - */ + /// Integral of the product of the derivative of psi and phi. const Q10PsiPhi *q10; - /** \brief - * Integral of the derivative of psi. - */ + /// Integral of the derivative of psi. const Q1Psi *q1; friend class FirstOrderAssembler; }; - // ============================================================================ - // ===== class Pre01 ========================================================== - // ============================================================================ - /** \brief + /** + * \ingroup Assembler + * + * \brief * First order assembler for grdPhi using precalculated integrals */ class Pre01 : public FirstOrderAssembler @@ -291,16 +237,13 @@ namespace AMDiS { public: MEMORY_MANAGED(Pre01); - /** \brief - * Constructor. - */ + /// Constructor. Pre01(Operator *op, Assembler *assembler, Quadrature *quad); - /** \brief - * Implements SubAssembler::calculateElementMatrix(). - */ + /// Implements SubAssembler::calculateElementMatrix(). void calculateElementMatrix(const ElInfo *elInfo, ElementMatrix *mat); + /// void calculateElementMatrix(const ElInfo *rowElInfo, const ElInfo *colElInfo, const ElInfo *smallElInfo, @@ -310,22 +253,16 @@ namespace AMDiS { ERROR_EXIT("CEM not yet\n"); } - /** \brief - * Implements SubAssembler::calculateElementVector(). - */ - void calculateElementVector(const ElInfo *, ElementVector */*vec*/) { + /// Implements SubAssembler::calculateElementVector(). + void calculateElementVector(const ElInfo *, ElementVector *) { ERROR_EXIT("should not be called\n"); - }; + } protected: - /** \brief - * Integral of the product of psi and the derivative of phi. - */ + /// Integral of the product of psi and the derivative of phi. const Q01PsiPhi *q01; - /** \brief - * Integral of the derivative of phi. - */ + /// Integral of the derivative of phi. const Q1Psi *q1; friend class FirstOrderAssembler; diff --git a/AMDiS/src/Lagrange.h b/AMDiS/src/Lagrange.h index c57b691159fabc6a7d102dd116de2529db24cbbd..5952f4d4b4344b003dd966ede4225a29080776b4 100644 --- a/AMDiS/src/Lagrange.h +++ b/AMDiS/src/Lagrange.h @@ -147,7 +147,7 @@ namespace AMDiS { { if (coarseInter_fct) (*coarseInter_fct)(drv, list, n, this); - }; + } /** \brief * Implements BasisFunction::getLocalIndices(). @@ -488,7 +488,7 @@ namespace AMDiS { inline void operator()(const DimVec<double>& lambda, DimVec<double>& result) const { func(lambda, vertices, result); - }; + } // ====== Lagrange0 ================================================ // center @@ -497,7 +497,7 @@ namespace AMDiS { DimVec<double>& result) { result.set(0.0); - }; + } // ====== Lagrange1 ================================================ // vertex @@ -507,7 +507,7 @@ namespace AMDiS { { result.set(0.0); result[vertices[0]] = 1.0; - }; + } // ====== Lagrange2 ================================================ // vertex @@ -517,7 +517,7 @@ namespace AMDiS { { result.set(0.0); result[vertices[0]] = 4.0 * lambda[vertices[0]] - 1.0; - }; + } // edge inline static void grdPhi2e(const DimVec<double>& lambda, @@ -527,7 +527,7 @@ namespace AMDiS { result.set(0.0); result[vertices[0]] = 4.0 * lambda[vertices[1]]; result[vertices[1]] = 4.0 * lambda[vertices[0]]; - }; + } // ===== Lagrange3 ================================================ // vertex @@ -538,7 +538,7 @@ namespace AMDiS { result.set(0.0); result[vertices[0]] = (13.5 * lambda[vertices[0]] - 9.0) * lambda[vertices[0]] + 1.0; - }; + } // edge inline static void grdPhi3e(const DimVec<double>& lambda, @@ -550,7 +550,7 @@ namespace AMDiS { lambda[vertices[1]]; result[vertices[1]] = (13.5 * lambda[vertices[0]] - 4.5) * lambda[vertices[0]]; - }; + } // face inline static void grdPhi3f(const DimVec<double>& lambda, @@ -561,7 +561,7 @@ namespace AMDiS { result[vertices[0]] = 27.0 * lambda[vertices[1]] * lambda[vertices[2]]; result[vertices[1]] = 27.0 * lambda[vertices[0]] * lambda[vertices[2]]; result[vertices[2]] = 27.0 * lambda[vertices[0]] * lambda[vertices[1]]; - }; + } // ===== Lagrange4 ================================================ @@ -574,7 +574,7 @@ namespace AMDiS { result[vertices[0]] = ((128.0 * lambda[vertices[0]] - 144.0) * lambda[vertices[0]] + 44.0) * lambda[vertices[0]] / 3.0 - 1.0; - }; + } // edge inline static void grdPhi4e0(const DimVec<double>& lambda, @@ -586,7 +586,7 @@ namespace AMDiS { lambda[vertices[0]] + 16.0 / 3.0) * lambda[vertices[1]]; result[vertices[1]] = ((128.0 * lambda[vertices[0]] - 96.0) * lambda[vertices[0]] + 16.0)*lambda[vertices[0]] / 3.0; - }; + } inline static void grdPhi4e1(const DimVec<double>& lambda, int* vertices, @@ -597,7 +597,7 @@ namespace AMDiS { lambda[vertices[1]] * (4.0 * lambda[vertices[1]] - 1.0); result[vertices[1]] = 4.0 * lambda[vertices[0]] * (4.0 * lambda[vertices[0]] - 1.0) * (8.0 * lambda[vertices[1]] - 1.0); - }; + } // face inline static void grdPhi4f(const DimVec<double>& lambda, @@ -611,7 +611,7 @@ namespace AMDiS { lambda[vertices[0]] * lambda[vertices[2]]; result[vertices[2]] = 32.0 * (4.0 * lambda[vertices[0]] - 1.0) * lambda[vertices[0]] * lambda[vertices[1]]; - }; + } // center inline static void grdPhi4c(const DimVec<double>& lambda, @@ -623,7 +623,7 @@ namespace AMDiS { result[1] = 256.0 * lambda[vertices[0]] * lambda[vertices[2]] * lambda[vertices[3]]; result[2] = 256.0 * lambda[vertices[0]] * lambda[vertices[1]] * lambda[vertices[3]]; result[3] = 256.0 * lambda[vertices[0]] * lambda[vertices[1]] * lambda[vertices[2]]; - }; + } }; @@ -650,21 +650,21 @@ namespace AMDiS { inline void operator()(const DimVec<double>& lambda, DimMat<double>& result) const { return func(lambda, vertices, result); - }; + } // ===== Lagrange0 ================================================ // center inline static void D2Phi0c(const DimVec<double>&, int*, DimMat<double>& result) { result.set(0.0); - }; + } // ===== Lagrange1 ================================================ // vertex inline static void D2Phi1v(const DimVec<double>&, int*, DimMat<double>& result) { result.set(0.0); - }; + } // ===== Lagrange2 ================================================ // vertex @@ -673,7 +673,7 @@ namespace AMDiS { { result.set(0.0); result[vertices[0]][vertices[0]] = 4.0; - }; + } // edge inline static void D2Phi2e(const DimVec<double>&, int* vertices, @@ -682,7 +682,7 @@ namespace AMDiS { result.set(0.0); result[vertices[0]][vertices[1]] = 4.0; result[vertices[1]][vertices[0]] = 4.0; - }; + } // ===== Lagrange3 ================================================ @@ -692,7 +692,7 @@ namespace AMDiS { { result.set(0.0); result[vertices[0]][vertices[0]] = 27.0 * lambda[vertices[0]] - 9.0; - }; + } // edge inline static void D2Phi3e(const DimVec<double>& lambda, int* vertices, @@ -702,7 +702,7 @@ namespace AMDiS { result[vertices[0]][vertices[0]] = 27.0 * lambda[vertices[1]]; result[vertices[0]][vertices[1]] = result[vertices[1]][vertices[0]] = 27.0 * lambda[vertices[0]] - 4.5; - }; + } // face inline static void D2Phi3f(const DimVec<double>& lambda, int* vertices, @@ -715,7 +715,7 @@ namespace AMDiS { result[vertices[2]][vertices[0]] = 27.0 * lambda[vertices[1]]; result[vertices[1]][vertices[2]] = result[vertices[2]][vertices[1]] = 27.0 * lambda[vertices[0]]; - }; + } // ===== Lagrange4 ================================================ @@ -726,7 +726,7 @@ namespace AMDiS { result.set(0.0); result[vertices[0]][vertices[0]] = (128.0 * lambda[vertices[0]] - 96.0) * lambda[vertices[0]] + 44.0 / 3.0; - }; + } // edge inline static void D2Phi4e0(const DimVec<double>& lambda, int* vertices, @@ -738,7 +738,7 @@ namespace AMDiS { result[vertices[0]][vertices[1]] = result[vertices[1]][vertices[0]] = (128.0 * lambda[vertices[0]] - 64.0) * lambda[vertices[0]] + 16.0 / 3.0; - }; + } inline static void D2Phi4e1(const DimVec<double>& lambda, int* vertices, DimMat<double>& result) @@ -751,7 +751,7 @@ namespace AMDiS { 4.0 * (8.0 * lambda[vertices[0]] - 1.0) * (8.0 * lambda[vertices[1]] - 1.0); result[vertices[1]][vertices[1]] = 32.0 * lambda[vertices[0]] * (4.0 * lambda[vertices[0]] - 1.0); - }; + } // face inline static void D2Phi4f(const DimVec<double>& lambda, int* vertices, @@ -769,7 +769,7 @@ namespace AMDiS { result[vertices[1]][vertices[2]] = result[vertices[2]][vertices[1]] = 32.0 * (4.0 * lambda[vertices[0]] - 1.0) * lambda[vertices[0]]; - }; + } // center inline static void D2Phi4c(const DimVec<double>& lambda, int* vertices, @@ -794,7 +794,7 @@ namespace AMDiS { result[vertices[2]][vertices[3]] = result[vertices[3]][vertices[2]] = 256.0 * lambda[vertices[0]] * lambda[vertices[1]]; - }; + } }; }; diff --git a/AMDiS/src/Marker.cc b/AMDiS/src/Marker.cc index c0e055736ce3a6bb387bfb786544777f215b8476..68b98c992b519ffe7da0c7911b505398482851b9 100644 --- a/AMDiS/src/Marker.cc +++ b/AMDiS/src/Marker.cc @@ -47,7 +47,7 @@ namespace AMDiS { void Marker::markElement(AdaptInfo *adaptInfo, ElInfo *elInfo) { Element *el = elInfo->getElement(); double lError = el->getEstimation(row); - + if (adaptInfo->isRefinementAllowed(row == -1 ? 0 : row) && lError > markRLimit) { if ((maxRefineLevel == -1) || (elInfo->getLevel() < maxRefineLevel)) { setMark(el, adaptInfo->getRefineBisections(row == -1 ? 0 : row)); @@ -71,11 +71,9 @@ namespace AMDiS { } TraverseStack stack; - ElInfo *elInfo = NULL; - elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL); + ElInfo *elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL); while (elInfo) { markElement(adaptInfo, elInfo); - elInfo = stack.traverseNext(elInfo); } @@ -87,7 +85,7 @@ namespace AMDiS { if (elMarkCoarsen) markFlag |= 2; - return(markFlag); + return markFlag; } diff --git a/AMDiS/src/Marker.h b/AMDiS/src/Marker.h index 46dfa2658773c25c4064382eafc2e78f8a6f85cf..890cca512b86f0ae2adbb0a78464a13736bb0bcf 100644 --- a/AMDiS/src/Marker.h +++ b/AMDiS/src/Marker.h @@ -49,7 +49,7 @@ namespace AMDiS { /** \brief * Constructor. */ - Marker() {}; + Marker() {} /** \brief * Constructor. @@ -65,12 +65,12 @@ namespace AMDiS { GET_PARAMETER(0, name + "->p", "%f", &p); GET_PARAMETER(0, name + "->info", "%d", &info); GET_PARAMETER(0, name + "->max refinement level", "%d", &maxRefineLevel); - }; + } /** \brief * destructor */ - virtual ~Marker() {}; + virtual ~Marker() {} /** \brief * Marks element with newMark. If \ref maximumMarking is set, the element @@ -97,7 +97,7 @@ namespace AMDiS { elMarkCoarsen++; } } - }; + } /** \brief * Can be used by sub classes. Called before traversal. @@ -124,14 +124,15 @@ namespace AMDiS { */ inline void setMaximumMarking(bool maxMark) { maximumMarking = maxMark; - }; + } inline int getElMarkRefine() { - return elMarkRefine; }; + return elMarkRefine; + } inline int getElMarkCoarsen() { return elMarkCoarsen; - }; + } /** \brief * Creates a scalr marker depending on the strategy set in parameters. @@ -224,7 +225,7 @@ namespace AMDiS { */ GRMarker(std::string name_, int row_) : Marker(name_, row_) - {}; + {} /** \brief * Implementation of Marker::markElement(). @@ -233,7 +234,7 @@ namespace AMDiS { Element *el = elInfo->getElement(); if(adaptInfo->isRefinementAllowed(row == -1 ? 0 : row)) setMark(el, adaptInfo->getRefineBisections(row == -1 ? 0 : row)); - }; + } }; // =========================================================================== @@ -261,7 +262,7 @@ namespace AMDiS { { GET_PARAMETER(0, name + "->MSGamma", "%f", &MSGamma); GET_PARAMETER(0, name + "->MSGammaC", "%f", &MSGammaC); - }; + } /** \brief * Implementation of MarkScal::initMarking(). @@ -274,7 +275,7 @@ namespace AMDiS { markRLimit = MSGammaP * adaptInfo->getEstMax(row == -1 ? 0 : row); markCLimit = MSGammaCP * adaptInfo->getEstMax(row == -1 ? 0 : row); - }; + } protected: /** \brief @@ -313,7 +314,7 @@ namespace AMDiS { { GET_PARAMETER(0, name + "->ESTheta", "%f", &ESTheta); GET_PARAMETER(0, name + "->ESThetaC", "%f", &ESThetaC); - }; + } /** \brief * Implementation of MarkScal::initMarking(). @@ -360,7 +361,7 @@ namespace AMDiS { GET_PARAMETER(0, name + "->GERSThetaStar", "%f", &GERSThetaStar); GET_PARAMETER(0, name + "->GERSNu", "%f", &GERSNu); GET_PARAMETER(0, name + "->GERSThetaC", "%f", &GERSThetaC); - }; + } /** \brief * Implementation of Marker::markMesh(). diff --git a/AMDiS/src/Operator.cc b/AMDiS/src/Operator.cc index f4ab8bcb4b3990e7d24f67bbe636666dc25b7359..365781618c8abf44d5b1e5d1a5394bf91b3e2e14 100644 --- a/AMDiS/src/Operator.cc +++ b/AMDiS/src/Operator.cc @@ -44,7 +44,7 @@ namespace AMDiS { int phiDegree = phi->getDegree(); int maxTermDegree = 0; - for (int i = 0; i < static_cast<int>( terms->size()); i++) { + for (int i = 0; i < static_cast<int>(terms->size()); i++) { OperatorTerm *term = (*terms)[i]; maxTermDegree = max(maxTermDegree, term->degree); } @@ -67,20 +67,120 @@ namespace AMDiS { return properties.isSet(SYMMETRIC); } + double *OperatorTerm::getVectorAtQPs(DOFVectorBase<double>* vec, + const ElInfo* elInfo, + SubAssembler* subAssembler, + Quadrature *quad) + { + FUNCNAME("OperatorTerm::getVectorAtQPs()"); + + TEST_EXIT(elInfo->getMesh() == vec->getFESpace()->getMesh()) + ("There is something wrong!\n"); + + return subAssembler->getVectorAtQPs(vec, elInfo, quad); + } + + double *OperatorTerm::getVectorAtQPs(DOFVectorBase<double>* vec, + const ElInfo* smallElInfo, + const ElInfo* largeElInfo, + SubAssembler* subAssembler, + Quadrature *quad) + { + FUNCNAME("OperatorTerm::getVectorAtQPs()"); + + TEST_EXIT(smallElInfo->getMesh() == vec->getFESpace()->getMesh() || + largeElInfo->getMesh() == vec->getFESpace()->getMesh()) + ("There is something wrong!\n"); + + if (smallElInfo->getLevel() == largeElInfo->getLevel()) { + + // Both elements have the same size, so we can use the simple procedure + // to determine the vecAtQPs. + + if (vec->getFESpace()->getMesh() == smallElInfo->getMesh()) { + return subAssembler->getVectorAtQPs(vec, smallElInfo, quad); + } else { + return subAssembler->getVectorAtQPs(vec, largeElInfo, quad); + } + + } else { + + // The two elements are different. If the vector is defined on the mesh of the + // small element, we can still use the simple procedure to determine the vecAtQPs. + + if (vec->getFESpace()->getMesh() == largeElInfo->getMesh()) { + return subAssembler->getVectorAtQPs(vec, smallElInfo, largeElInfo, quad); + } else { + return subAssembler->getVectorAtQPs(vec, smallElInfo, quad); + } + + } + } + + WorldVector<double>* OperatorTerm::getGradientsAtQPs(DOFVectorBase<double>* vec, + const ElInfo* elInfo, + SubAssembler* subAssembler, + Quadrature *quad) + { + FUNCNAME("OperatorTerm::getGradientsAtQPs()"); + + TEST_EXIT(elInfo->getMesh() == vec->getFESpace()->getMesh()) + ("There is something wrong!\n"); + + return subAssembler->getGradientsAtQPs(vec, elInfo, quad); + } + + WorldVector<double>* OperatorTerm::getGradientsAtQPs(DOFVectorBase<double>* vec, + const ElInfo* smallElInfo, + const ElInfo* largeElInfo, + SubAssembler* subAssembler, + Quadrature *quad) + { + FUNCNAME("OperatorTerm::getGradientsAtQPs()"); + + TEST_EXIT(smallElInfo->getMesh() == vec->getFESpace()->getMesh() || + largeElInfo->getMesh() == vec->getFESpace()->getMesh()) + ("There is something wrong!\n"); + + if (smallElInfo->getLevel() == largeElInfo->getLevel()) { + + // Both elements have the same size, so we can use the simple procedure + // to determine the gradients. + + if (vec->getFESpace()->getMesh() == smallElInfo->getMesh()) { + return subAssembler->getGradientsAtQPs(vec, smallElInfo, quad); + } else { + return subAssembler->getGradientsAtQPs(vec, largeElInfo, quad); + } + + } else { + + // The two elements are different. If the vector is defined on the mesh of the + // small element, we can still use the simple procedure to determine the gradients. + + if (vec->getFESpace()->getMesh() == largeElInfo->getMesh()) { + return subAssembler->getGradientsAtQPs(vec, smallElInfo, largeElInfo, quad); + } else { + return subAssembler->getGradientsAtQPs(vec, smallElInfo, quad); + } + + } + } + void OperatorTerm::lalt(const DimVec<WorldVector<double> >& Lambda, const WorldMatrix<double>& matrix, DimMat<double>& LALt, bool symm, double factor) { - int i, j, k, l; + int j, k, l; const int dimOfWorld = Global::getGeo(WORLD); int dim = LALt.getNumRows() - 1; double val = 0.0; if (symm) { - for (i = 0; i <= dim; i++) { + for (int i = 0; i <= dim; i++) { val = 0.0; for (k = 0; k < dimOfWorld; k++) for (l = 0; l < dimOfWorld; l++) @@ -98,7 +198,7 @@ namespace AMDiS { } } } else { - for (i = 0; i <= dim; i++) { + for (int i = 0; i <= dim; i++) { for (j = 0; j <= dim; j++) { val = 0.0; for (k = 0; k < dimOfWorld; k++) @@ -113,14 +213,13 @@ namespace AMDiS { void OperatorTerm::lalt_kl(const DimVec<WorldVector<double> >& Lambda, int k, int l, - DimMat<double>& LALt, - double factor) + DimMat<double>& LALt, + double factor) { - int i, j; int dim = LALt.getNumRows() - 1; - for (i = 0; i <= dim; i++) - for (j = 0; j <= dim; j++) + for (int i = 0; i <= dim; i++) + for (int j = 0; j <= dim; j++) LALt[i][j] += factor * Lambda[i][k] * Lambda[j][l]; } @@ -151,18 +250,16 @@ namespace AMDiS { } void OperatorTerm::lb(const DimVec<WorldVector<double> >& Lambda, - const WorldVector<double>& b, - DimVec<double>& Lb, - double factor) + const WorldVector<double>& b, + DimVec<double>& Lb, + double factor) { - int i, j; - int dim = Lb.getSize() - 1; - const int dimOfWorld = Global::getGeo(WORLD); - - double val = 0.0; + int dim = Lb.getSize() - 1; + const int dimOfWorld = Global::getGeo(WORLD); - for (i = 0; i <= dim; i++) { - for (val = j = 0; j < dimOfWorld; j++) + for (int i = 0; i <= dim; i++) { + double val = 0.0; + for (int j = 0; j < dimOfWorld; j++) val += Lambda[i][j] * b[j]; val *= factor; Lb[i] += val; @@ -170,13 +267,14 @@ namespace AMDiS { } Operator::Operator(Flag operatorType, - const FiniteElemSpace *rowFESpace_, - const FiniteElemSpace *colFESpace_) - : rowFESpace(rowFESpace_), - colFESpace(colFESpace_ ? colFESpace_ : rowFESpace_), + const FiniteElemSpace *row, + const FiniteElemSpace *col) + : rowFESpace(row), + colFESpace(col ? col : row), type(operatorType), fillFlag(Mesh::CALL_LEAF_EL | Mesh::FILL_COORDS | Mesh::FILL_DET | Mesh::FILL_GRD_LAMBDA), + needDualTraverse(false), uhOld(NULL), optimized(true) { @@ -198,7 +296,7 @@ namespace AMDiS { nRow = rowFESpace->getBasisFcts()->getNumber(); nCol = colFESpace->getBasisFcts()->getNumber(); - }; + } void Operator::setUhOld(const DOFVectorBase<double> *uhOld_) { @@ -249,6 +347,25 @@ namespace AMDiS { assembler[myRank]->calculateElementVector(elInfo, userVec, factor); } + void Operator::getElementVector(const ElInfo *mainElInfo, + const ElInfo *auxElInfo, + const ElInfo *smallElInfo, + const ElInfo *largeElInfo, + ElementVector *userVec, + double factor) + { + int myRank = omp_get_thread_num(); + + if (!assembler[myRank]) { + initAssembler(myRank, NULL, NULL, NULL, NULL); + } + + assembler[myRank]->calculateElementVector(mainElInfo, auxElInfo, + smallElInfo, largeElInfo, + userVec, factor); + } + + void Operator::initAssembler(int rank, Quadrature *quad2, Quadrature *quad1GrdPsi, @@ -275,26 +392,575 @@ namespace AMDiS { } + + VecAtQP_ZOT::VecAtQP_ZOT(DOFVectorBase<double> *dv, + AbstractFunction<double, double> *af) + : ZeroOrderTerm(af ? af->getDegree() : 0), vec(dv), f(af) + { + TEST_EXIT(dv)("No vector!\n"); + + auxFESpaces.push_back(dv->getFESpace()); + } + + MultVecAtQP_ZOT::MultVecAtQP_ZOT(DOFVectorBase<double> *dv1, + DOFVectorBase<double> *dv2, + AbstractFunction<double, double> *af1, + AbstractFunction<double, double> *af2) + : ZeroOrderTerm(af1->getDegree() + af2->getDegree()), + vec1(dv1), vec2(dv2), f1(af1), f2(af2) + { + TEST_EXIT(dv1)("No first vector!\n"); + TEST_EXIT(dv2)("No second vector!\n"); + + auxFESpaces.push_back(dv1->getFESpace()); + auxFESpaces.push_back(dv2->getFESpace()); + } + + Vec2AtQP_ZOT::Vec2AtQP_ZOT(DOFVectorBase<double> *dv1, + DOFVectorBase<double> *dv2, + BinaryAbstractFunction<double, double, double> *af) + : ZeroOrderTerm(af->getDegree()), vec1(dv1), vec2(dv2), f(af) + { + TEST_EXIT(dv1)("No first vector!\n"); + TEST_EXIT(dv2)("No second vector!\n"); + + auxFESpaces.push_back(dv1->getFESpace()); + auxFESpaces.push_back(dv2->getFESpace()); + } + + Vec3AtQP_ZOT::Vec3AtQP_ZOT(DOFVectorBase<double> *dv1, + DOFVectorBase<double> *dv2, + DOFVectorBase<double> *dv3, + TertiaryAbstractFunction<double, double, double, double> *af) + : ZeroOrderTerm(af->getDegree()), vec1(dv1), vec2(dv2), vec3(dv3), f(af) + { + TEST_EXIT(dv1)("No first vector!\n"); + TEST_EXIT(dv2)("No second vector!\n"); + TEST_EXIT(dv3)("No thierd vector!\n"); + + auxFESpaces.push_back(dv1->getFESpace()); + auxFESpaces.push_back(dv2->getFESpace()); + auxFESpaces.push_back(dv3->getFESpace()); + } + + FctGradientCoords_ZOT::FctGradientCoords_ZOT(DOFVectorBase<double> *dv, + BinaryAbstractFunction<double, WorldVector<double>, WorldVector<double> > *af) + : ZeroOrderTerm(af->getDegree()), vec(dv), f(af) + { + TEST_EXIT(dv)("No vector!\n"); + + auxFESpaces.push_back(dv->getFESpace()); + } + + VecGradCoordsAtQP_ZOT::VecGradCoordsAtQP_ZOT(DOFVectorBase<double> *dv, + TertiaryAbstractFunction<double, double, WorldVector<double>, WorldVector<double> > *af) + : ZeroOrderTerm(af->getDegree()), vec(dv), f(af) + { + TEST_EXIT(dv)("No vector!\n"); + + auxFESpaces.push_back(dv->getFESpace()); + } + + VecAndCoordsAtQP_ZOT::VecAndCoordsAtQP_ZOT(DOFVectorBase<double> *dv, + BinaryAbstractFunction<double, double, WorldVector<double> > *af) + : ZeroOrderTerm(af->getDegree()), vec(dv), f(af) + { + TEST_EXIT(dv)("No vector!\n"); + + auxFESpaces.push_back(dv->getFESpace()); + } + + Vec2AndGradAtQP_ZOT::Vec2AndGradAtQP_ZOT(DOFVectorBase<double> *dv1, DOFVectorBase<double> *dv2, + TertiaryAbstractFunction<double, double, WorldVector<double>, double > *af) + : ZeroOrderTerm(af->getDegree()), vec1(dv1), vec2(dv2), f(af) + { + TEST_EXIT(dv1)("No first vector!\n"); + TEST_EXIT(dv2)("No second vector!\n"); + + auxFESpaces.push_back(dv1->getFESpace()); + auxFESpaces.push_back(dv2->getFESpace()); + } + + FctGradient_ZOT::FctGradient_ZOT(DOFVectorBase<double> *dv, + AbstractFunction<double, WorldVector<double> > *af) + : ZeroOrderTerm(af->getDegree()), vec(dv), f(af) + { + TEST_EXIT(dv)("No vector!\n"); + + auxFESpaces.push_back(dv->getFESpace()); + } + + VecAndGradAtQP_ZOT::VecAndGradAtQP_ZOT(DOFVectorBase<double> *dv, + BinaryAbstractFunction<double, double, WorldVector<double> > *af) + : ZeroOrderTerm(af->getDegree()), vec(dv), f(af) + { + TEST_EXIT(dv)("No vector!\n"); + + auxFESpaces.push_back(dv->getFESpace()); + } + + VecAndGradVecAtQP_ZOT::VecAndGradVecAtQP_ZOT(DOFVectorBase<double> *dv, + DOFVectorBase<double> *dGrd, + BinaryAbstractFunction<double, double, WorldVector<double> > *af) + : ZeroOrderTerm(af->getDegree()), vec(dv), vecGrd(dGrd), f(af) + { + TEST_EXIT(dv)("No vector!\n"); + TEST_EXIT(dGrd)("No gradient vector!\n"); + + auxFESpaces.push_back(dv->getFESpace()); + auxFESpaces.push_back(dGrd->getFESpace()); + } + + VecAndGradVec2AtQP_ZOT::VecAndGradVec2AtQP_ZOT(DOFVectorBase<double> *dv, + DOFVectorBase<double> *dGrd1, + DOFVectorBase<double> *dGrd2, + TertiaryAbstractFunction<double, double, WorldVector<double>, WorldVector<double> > *af) + : ZeroOrderTerm(af->getDegree()), vec(dv), vecGrd1(dGrd1), vecGrd2(dGrd2), f(af) + { + TEST_EXIT(dv)("No vector!\n"); + TEST_EXIT(dGrd1)("No first gradient vector!\n"); + TEST_EXIT(dGrd2)("No second gradient vector!\n"); + + auxFESpaces.push_back(dv->getFESpace()); + auxFESpaces.push_back(dGrd1->getFESpace()); + auxFESpaces.push_back(dGrd2->getFESpace()); + } + + VecOfDOFVecsAtQP_ZOT::VecOfDOFVecsAtQP_ZOT(const std::vector<DOFVectorBase<double>*>& dv, + AbstractFunction<double, std::vector<double> > *af) + : ZeroOrderTerm(af->getDegree()), vecs(dv), f(af) + { + vecsAtQPs.resize(vecs.size()); + + for (int i = 0; i < static_cast<int>(dv.size()); i++) { + TEST_EXIT(dv[i])("One vector is NULL!\n"); + + auxFESpaces.push_back(dv[i]->getFESpace()); + } + } + + VecOfGradientsAtQP_ZOT::VecOfGradientsAtQP_ZOT(const std::vector<DOFVectorBase<double>*>& dv, + AbstractFunction<double, std::vector<WorldVector<double>*> > *af) + : ZeroOrderTerm(af->getDegree()), vecs(dv), f(af) + { + gradsAtQPs.resize(vecs.size()); + + for (int i = 0; i < static_cast<int>(dv.size()); i++) { + TEST_EXIT(dv[i])("One vector is NULL!\n"); + + auxFESpaces.push_back(dv[i]->getFESpace()); + } + } + + VecDivergence_ZOT::VecDivergence_ZOT(int nComponents, + DOFVectorBase<double> *vec0, + DOFVectorBase<double> *vec1, + DOFVectorBase<double> *vec2) + : ZeroOrderTerm(0) + { + vecs.resize(nComponents); + gradsAtQPs.resize(nComponents); + vecs[0] = vec0; + vecs[1] = vec1; + vecs[2] = vec2; + + auxFESpaces.push_back(vec0->getFESpace()); + if (vec1) + auxFESpaces.push_back(vec1->getFESpace()); + if (vec2) + auxFESpaces.push_back(vec2->getFESpace()); + } + + + VecAndVecOfGradientsAtQP_ZOT::VecAndVecOfGradientsAtQP_ZOT(DOFVector<double> *v, + const std::vector<DOFVector<double>*>& dv, + BinaryAbstractFunction<double, double, std::vector<WorldVector<double>*> > *af) + : ZeroOrderTerm(af->getDegree()), vec(v), vecs(dv), f(af) + { + gradsAtQPs.resize(vecs.size()); + + TEST_EXIT(v)("No vector!\n"); + + auxFESpaces.push_back(v->getFESpace()); + for (int i = 0; i < static_cast<int>(dv.size()); i++) { + TEST_EXIT(dv[i])("One gradient vector is NULL!\n"); + + auxFESpaces.push_back(dv[i]->getFESpace()); + } + } + + General_ZOT::General_ZOT(std::vector<DOFVectorBase<double>*> vecs, + std::vector<DOFVectorBase<double>*> grads, + TertiaryAbstractFunction<double, WorldVector<double>, std::vector<double>, std::vector<WorldVector<double> > > *af) + : ZeroOrderTerm(af->getDegree()), vecs_(vecs), grads_(grads), f_(af) + { + vecsAtQPs_.resize(vecs_.size()); + gradsAtQPs_.resize(grads_.size()); + + for (int i = 0; i < static_cast<int>(vecs.size()); i++) { + TEST_EXIT(vecs[i])("One vector is NULL!\n"); + + auxFESpaces.push_back(vecs[i]->getFESpace()); + } + + for (int i = 0; i < static_cast<int>(grads.size()); i++) { + TEST_EXIT(grads[i])("One gradient vector is NULL!\n"); + + auxFESpaces.push_back(grads[i]->getFESpace()); + } + } + + GeneralParametric_ZOT::GeneralParametric_ZOT(std::vector<DOFVectorBase<double>*> vecs, + std::vector<DOFVectorBase<double>*> grads, + QuartAbstractFunction<double, + WorldVector<double>, + WorldVector<double>, + std::vector<double>, + std::vector<WorldVector<double> > > *af) + : ZeroOrderTerm(af->getDegree()), vecs_(vecs), grads_(grads), f_(af) + { + vecsAtQPs_.resize(vecs_.size()); + gradsAtQPs_.resize(grads_.size()); + + for (int i = 0; i < static_cast<int>(vecs.size()); i++) { + TEST_EXIT(vecs[i])("One vector is NULL!\n"); + + auxFESpaces.push_back(vecs[i]->getFESpace()); + } + + for (int i = 0; i < static_cast<int>(grads.size()); i++) { + TEST_EXIT(grads[i])("One gradient vector is NULL!\n"); + + auxFESpaces.push_back(grads[i]->getFESpace()); + } + } + + VecAtQP_FOT::VecAtQP_FOT(DOFVectorBase<double> *dv, + AbstractFunction<double, double> *af, + WorldVector<double> *wv) + : FirstOrderTerm(af->getDegree()), vec(dv), f(af), b(wv) + { + TEST_EXIT(dv)("No vector!\n"); + + auxFESpaces.push_back(dv->getFESpace()); + } + + VectorGradient_FOT::VectorGradient_FOT(DOFVectorBase<double> *dv, + AbstractFunction<WorldVector<double>, WorldVector<double> > *af) + : FirstOrderTerm(af->getDegree()), vec(dv), f(af) + { + TEST_EXIT(dv)("No vector!\n"); + + auxFESpaces.push_back(dv->getFESpace()); + } + + VectorFct_FOT::VectorFct_FOT(DOFVectorBase<double> *dv, + AbstractFunction<WorldVector<double>, double> *fct) + : FirstOrderTerm(fct->getDegree()), vec(dv), vecFct(fct) + { + TEST_EXIT(dv)("No vector!\n"); + + auxFESpaces.push_back(dv->getFESpace()); + } + + VecGrad_FOT::VecGrad_FOT(DOFVectorBase<double> *dv1, DOFVectorBase<double> *dv2, + BinaryAbstractFunction<WorldVector<double>, double, WorldVector<double> > *fct) + : FirstOrderTerm(fct->getDegree()), vec1(dv1), vec2(dv2), vecFct(fct) + { + TEST_EXIT(dv1)("No first vector!\n"); + TEST_EXIT(dv2)("No second vector!\n"); + + auxFESpaces.push_back(dv1->getFESpace()); + auxFESpaces.push_back(dv2->getFESpace()); + } + + General_FOT::General_FOT(std::vector<DOFVectorBase<double>*> vecs, + std::vector<DOFVectorBase<double>*> grads, + TertiaryAbstractFunction<WorldVector<double>, + WorldVector<double>, + std::vector<double>, + std::vector<WorldVector<double> > > *af) + : FirstOrderTerm(af->getDegree()), vecs_(vecs), grads_(grads), f_(af) + { + vecsAtQPs_.resize(vecs_.size()); + gradsAtQPs_.resize(grads_.size()); + + for (int i = 0; i < static_cast<int>(vecs.size()); i++) { + TEST_EXIT(vecs[i])("One vector is NULL!\n"); + + auxFESpaces.push_back(vecs[i]->getFESpace()); + } + + for (int i = 0; i < static_cast<int>(grads.size()); i++) { + TEST_EXIT(grads[i])("One gradient vector is NULL!\n"); + + auxFESpaces.push_back(grads[i]->getFESpace()); + } + } + + GeneralParametric_FOT::GeneralParametric_FOT(std::vector<DOFVectorBase<double>*> vecs, + std::vector<DOFVectorBase<double>*> grads, + QuartAbstractFunction<WorldVector<double>, + WorldVector<double>, + WorldVector<double>, + std::vector<double>, + std::vector<WorldVector<double> > > *af) + : FirstOrderTerm(af->getDegree()), vecs_(vecs), grads_(grads), f_(af) + { + vecsAtQPs_.resize(vecs_.size()); + gradsAtQPs_.resize(grads_.size()); + + for (int i = 0; i < static_cast<int>(vecs.size()); i++) { + TEST_EXIT(vecs[i])("One vector is NULL!\n"); + + auxFESpaces.push_back(vecs[i]->getFESpace()); + } + + for (int i = 0; i < static_cast<int>(grads.size()); i++) { + TEST_EXIT(grads[i])("One gradient vector is NULL!\n"); + + auxFESpaces.push_back(grads[i]->getFESpace()); + } + } + + MatrixFct_SOT::MatrixFct_SOT(DOFVectorBase<double> *dv, + AbstractFunction<WorldMatrix<double>, double> *fct, + AbstractFunction<WorldVector<double>, WorldMatrix<double> > *div, + bool sym) + : SecondOrderTerm(fct->getDegree()), + vec(dv), + matrixFct(fct), + divFct(div), + symmetric(sym) + { + setSymmetric(symmetric); + + TEST_EXIT(dv)("No vector!\n"); + + auxFESpaces.push_back(dv->getFESpace()); + } + + VecAtQP_SOT::VecAtQP_SOT(DOFVectorBase<double> *dv, + AbstractFunction<double, double> *af) + : SecondOrderTerm(af->getDegree()), vec(dv), f(af) + { + setSymmetric(true); + + TEST_EXIT(dv)("No vector!\n"); + + auxFESpaces.push_back(dv->getFESpace()); + } + + Vec2AtQP_SOT::Vec2AtQP_SOT(DOFVectorBase<double> *dv1, DOFVectorBase<double> *dv2, + BinaryAbstractFunction<double, double, double> *af) + : SecondOrderTerm(af->getDegree()), vec1(dv1), vec2(dv2), f(af) + { + setSymmetric(true); + + TEST_EXIT(dv1)("No first vector!\n"); + TEST_EXIT(dv2)("No second vector!\n"); + + auxFESpaces.push_back(dv1->getFESpace()); + auxFESpaces.push_back(dv2->getFESpace()); + } + + MatrixGradient_SOT::MatrixGradient_SOT(DOFVectorBase<double> *dv, + AbstractFunction<WorldMatrix<double>, WorldVector<double> > *af, + AbstractFunction<WorldVector<double>, WorldMatrix<double> > *divAf, + bool symm) + : SecondOrderTerm(af->getDegree()), vec(dv), f(af), divFct(divAf), symmetric(symm) + { + setSymmetric(symmetric); + + TEST_EXIT(dv)("No vector!\n"); + + auxFESpaces.push_back(dv->getFESpace()); + } + + FctGradient_SOT::FctGradient_SOT(DOFVectorBase<double> *dv, + AbstractFunction<double, WorldVector<double> > *af) + : SecondOrderTerm(af->getDegree()), vec(dv), f(af) + { + TEST_EXIT(dv)("No vector!\n"); + + auxFESpaces.push_back(dv->getFESpace()); + } + + VecAndGradientAtQP_SOT::VecAndGradientAtQP_SOT(DOFVectorBase<double> *dv, + BinaryAbstractFunction<double, double, WorldVector<double> > *af) + : SecondOrderTerm(af->getDegree()), vec(dv), f(af) + { + TEST_EXIT(dv)("No vector!\n"); + + auxFESpaces.push_back(dv->getFESpace()); + } + + VecMatrixGradientAtQP_SOT::VecMatrixGradientAtQP_SOT(DOFVectorBase<double> *dv, + BinaryAbstractFunction<WorldMatrix<double>, double, WorldVector<double> > *af, + AbstractFunction<WorldVector<double>, WorldMatrix<double> > *divAf, + bool symm) + : SecondOrderTerm(af->getDegree()), vec(dv), f(af), + divFct(divAf), symmetric(symm) + { + setSymmetric(symmetric); + + TEST_EXIT(dv)("No vector!\n"); + + auxFESpaces.push_back(dv->getFESpace()); + } + + VecGradCoordsAtQP_SOT::VecGradCoordsAtQP_SOT(DOFVectorBase<double> *dv, + TertiaryAbstractFunction<double, double, + WorldVector<double>, WorldVector<double> > *af) + : SecondOrderTerm(af->getDegree()), vec(dv), f(af) + { + TEST_EXIT(dv)("No vector!\n"); + + auxFESpaces.push_back(dv->getFESpace()); + } + + VecAndCoordsAtQP_SOT::VecAndCoordsAtQP_SOT(DOFVectorBase<double> *dv, + BinaryAbstractFunction<double, double, WorldVector<double> > *af) + : SecondOrderTerm(af->getDegree()), vec(dv), f(af) + { + setSymmetric(true); + + TEST_EXIT(dv)("No vector!\n"); + + auxFESpaces.push_back(dv->getFESpace()); + } + + MatrixGradientAndCoords_SOT::MatrixGradientAndCoords_SOT(DOFVectorBase<double> *dv, + BinaryAbstractFunction<WorldMatrix<double>, + WorldVector<double>, WorldVector<double> > *af, + AbstractFunction<WorldVector<double>, + WorldMatrix<double> > *divAf, + bool symm) + : SecondOrderTerm(af->getDegree()), vec(dv), f(af), divFct(divAf), symmetric(symm) + { + setSymmetric(symmetric); + + TEST_EXIT(dv)("No vector!\n"); + + auxFESpaces.push_back(dv->getFESpace()); + } + + General_SOT::General_SOT(std::vector<DOFVectorBase<double>*> vecs, + std::vector<DOFVectorBase<double>*> grads, + TertiaryAbstractFunction<WorldMatrix<double>, + WorldVector<double>, + std::vector<double>, + std::vector<WorldVector<double> > > *f, + AbstractFunction<WorldVector<double>, + WorldMatrix<double> > *divFct, + bool symmetric) + : SecondOrderTerm(f->getDegree()), + vecs_(vecs), + grads_(grads), + f_(f), + divFct_(divFct), + symmetric_(symmetric) + { + vecsAtQPs_.resize(vecs_.size()); + gradsAtQPs_.resize(grads_.size()); + + for (int i = 0; i < static_cast<int>(vecs.size()); i++) { + TEST_EXIT(vecs[i])("One vector is NULL!\n"); + + auxFESpaces.push_back(vecs[i]->getFESpace()); + } + + for (int i = 0; i < static_cast<int>(grads.size()); i++) { + TEST_EXIT(grads[i])("One gradient vector is NULL!\n"); + + auxFESpaces.push_back(grads[i]->getFESpace()); + } + } + + GeneralParametric_SOT::GeneralParametric_SOT(std::vector<DOFVectorBase<double>*> vecs, + std::vector<DOFVectorBase<double>*> grads, + QuartAbstractFunction<WorldMatrix<double>, + WorldVector<double>, + WorldVector<double>, + std::vector<double>, + std::vector<WorldVector<double> > > *f, + AbstractFunction<WorldVector<double>, + WorldMatrix<double> > *divFct, + bool symmetric) + : SecondOrderTerm(f->getDegree()), + vecs_(vecs), + grads_(grads), + f_(f), + divFct_(divFct), + symmetric_(symmetric) + { + vecsAtQPs_.resize(vecs_.size()); + gradsAtQPs_.resize(grads_.size()); + + for (int i = 0; i < static_cast<int>(vecs.size()); i++) { + TEST_EXIT(vecs[i])("One vector is NULL!\n"); + + auxFESpaces.push_back(vecs[i]->getFESpace()); + } + + for (int i = 0; i < static_cast<int>(grads.size()); i++) { + TEST_EXIT(grads[i])("One gradient vector is NULL!\n"); + + auxFESpaces.push_back(grads[i]->getFESpace()); + } + } + + VecAndGradAtQP_SOT::VecAndGradAtQP_SOT(DOFVectorBase<double> *dv, + BinaryAbstractFunction<double, double, WorldVector<double> > *af) + : SecondOrderTerm(af->getDegree()), vec(dv), f(af) + { + TEST_EXIT(dv)("No vector!\n"); + + auxFESpaces.push_back(dv->getFESpace()); + } + + VecAtQP_IJ_SOT::VecAtQP_IJ_SOT(DOFVectorBase<double> *dv, + AbstractFunction<double, double> *af, + int x_i, int x_j) + : SecondOrderTerm(af->getDegree()), vec(dv), f(af), xi(x_i), xj(x_j) + { + setSymmetric(xi == xj); + + TEST_EXIT(dv)("No vector!\n"); + + auxFESpaces.push_back(dv->getFESpace()); + } + + + void MatrixFct_SOT::initElement(const ElInfo* elInfo, SubAssembler* subAssembler, Quadrature *quad) { - vecAtQPs = subAssembler->getVectorAtQPs(vec, elInfo, quad); + vecAtQPs = getVectorAtQPs(vec, elInfo, subAssembler, quad); } void VecAtQP_SOT::initElement(const ElInfo* elInfo, SubAssembler* subAssembler, Quadrature* quad) { - vecAtQPs = subAssembler->getVectorAtQPs(vec, elInfo, quad); + vecAtQPs = getVectorAtQPs(vec, elInfo, subAssembler, quad); + } + + void VecAtQP_SOT::initElement(const ElInfo* smallElInfo, + const ElInfo* largeElInfo, + SubAssembler* subAssembler, + Quadrature* quad) + { + vecAtQPs = getVectorAtQPs(vec, smallElInfo, largeElInfo, subAssembler, quad); } void Vec2AtQP_SOT::initElement(const ElInfo* elInfo, SubAssembler* subAssembler, Quadrature *quad) { - vecAtQPs1 = subAssembler->getVectorAtQPs(vec1, elInfo, quad); - vecAtQPs2 = subAssembler->getVectorAtQPs(vec2, elInfo, quad); + vecAtQPs1 = getVectorAtQPs(vec1, elInfo, subAssembler, quad); + vecAtQPs2 = getVectorAtQPs(vec2, elInfo, subAssembler, quad); } void CoordsAtQP_SOT::initElement(const ElInfo* elInfo, @@ -308,37 +974,37 @@ namespace AMDiS { SubAssembler* subAssembler, Quadrature *quad) { - gradAtQPs = subAssembler->getGradientsAtQPs(vec, elInfo, quad); + gradAtQPs = getGradientsAtQPs(vec, elInfo, subAssembler, quad); } void FctGradient_SOT::initElement(const ElInfo* elInfo, SubAssembler* subAssembler, Quadrature *quad) { - gradAtQPs = subAssembler->getGradientsAtQPs(vec, elInfo, quad); + gradAtQPs = getGradientsAtQPs(vec, elInfo, subAssembler, quad); } void VecAndGradientAtQP_SOT::initElement(const ElInfo* elInfo, SubAssembler* subAssembler, Quadrature *quad) { - vecAtQPs = subAssembler->getVectorAtQPs(vec, elInfo, quad); - gradAtQPs = subAssembler->getGradientsAtQPs(vec, elInfo, quad); + vecAtQPs = getVectorAtQPs(vec, elInfo, subAssembler, quad); + gradAtQPs = getGradientsAtQPs(vec, elInfo, subAssembler, quad); } void VecMatrixGradientAtQP_SOT::initElement(const ElInfo* elInfo, SubAssembler* subAssembler, Quadrature *quad) { - vecAtQPs = subAssembler->getVectorAtQPs(vec, elInfo, quad); - gradAtQPs = subAssembler->getGradientsAtQPs(vec, elInfo, quad); + vecAtQPs = getVectorAtQPs(vec, elInfo, subAssembler, quad); + gradAtQPs = getGradientsAtQPs(vec, elInfo, subAssembler, quad); } void VecAndCoordsAtQP_SOT::initElement(const ElInfo* elInfo, SubAssembler* subAssembler, Quadrature *quad) { - vecAtQPs = subAssembler->getVectorAtQPs(vec, elInfo, quad); + vecAtQPs = getVectorAtQPs(vec, elInfo, subAssembler, quad); coordsAtQPs = subAssembler->getCoordsAtQPs(elInfo, quad); } @@ -346,7 +1012,7 @@ namespace AMDiS { SubAssembler* subAssembler, Quadrature *quad) { - gradAtQPs = subAssembler->getGradientsAtQPs(vec, elInfo, quad); + gradAtQPs = getGradientsAtQPs(vec, elInfo, subAssembler, quad); coordsAtQPs = subAssembler->getCoordsAtQPs(elInfo, quad); } @@ -354,8 +1020,8 @@ namespace AMDiS { SubAssembler* subAssembler, Quadrature *quad) { - vecAtQPs = subAssembler->getVectorAtQPs(vec, elInfo, quad); - gradAtQPs = subAssembler->getGradientsAtQPs(vec, elInfo, quad); + vecAtQPs = getVectorAtQPs(vec, elInfo, subAssembler, quad); + gradAtQPs = getGradientsAtQPs(vec, elInfo, subAssembler, quad); coordsAtQPs = subAssembler->getCoordsAtQPs(elInfo, quad); } @@ -363,7 +1029,7 @@ namespace AMDiS { SubAssembler* subAssembler, Quadrature *quad) { - vecAtQPs = subAssembler->getVectorAtQPs(vec, elInfo, quad); + vecAtQPs = getVectorAtQPs(vec, elInfo, subAssembler, quad); } void CoordsAtQP_FOT::initElement(const ElInfo* elInfo, @@ -384,14 +1050,14 @@ namespace AMDiS { SubAssembler* subAssembler, Quadrature *quad) { - gradAtQPs = subAssembler->getGradientsAtQPs(vec, elInfo, quad); + gradAtQPs = getGradientsAtQPs(vec, elInfo, subAssembler, quad); } void VectorFct_FOT::initElement(const ElInfo* elInfo, SubAssembler* subAssembler, Quadrature *quad) { - vecAtQPs = subAssembler->getVectorAtQPs(vec, elInfo, quad); + vecAtQPs = getVectorAtQPs(vec, elInfo, subAssembler, quad); } void VecFctAtQP_FOT::initElement(const ElInfo* elInfo, @@ -405,39 +1071,63 @@ namespace AMDiS { SubAssembler* subAssembler, Quadrature *quad) { - vecAtQPs = subAssembler->getVectorAtQPs(vec, elInfo, quad); + vecAtQPs = getVectorAtQPs(vec, elInfo, subAssembler, quad); } + void VecAtQP_ZOT::initElement(const ElInfo* smallElInfo, + const ElInfo* largeElInfo, + SubAssembler* subAssembler, + Quadrature *quad) + { + vecAtQPs = getVectorAtQPs(vec, smallElInfo, largeElInfo, subAssembler, quad); + } + + void MultVecAtQP_ZOT::initElement(const ElInfo* elInfo, SubAssembler* subAssembler, Quadrature *quad) { - vecAtQPs1 = subAssembler->getVectorAtQPs(vec1, elInfo, quad); - vecAtQPs2 = subAssembler->getVectorAtQPs(vec2, elInfo, quad); + vecAtQPs1 = getVectorAtQPs(vec1, elInfo, subAssembler, quad); + vecAtQPs2 = getVectorAtQPs(vec2, elInfo, subAssembler, quad); } void Vec2AtQP_ZOT::initElement(const ElInfo* elInfo, SubAssembler* subAssembler, Quadrature *quad) { - vecAtQPs1 = subAssembler->getVectorAtQPs(vec1, elInfo, quad); - vecAtQPs2 = subAssembler->getVectorAtQPs(vec2, elInfo, quad); + TEST_EXIT(vec1->getFESpace() == vec2->getFESpace()) + ("Not yet implemented!\n"); + + vecAtQPs1 = getVectorAtQPs(vec1, elInfo, subAssembler, quad); + vecAtQPs2 = getVectorAtQPs(vec2, elInfo, subAssembler, quad); + } + + void Vec2AtQP_ZOT::initElement(const ElInfo* smallElInfo, + const ElInfo* largeElInfo, + SubAssembler* subAssembler, + Quadrature *quad) + { + TEST_EXIT(vec1->getFESpace() == vec2->getFESpace()) + ("Not yet implemented!\n"); + + vecAtQPs1 = getVectorAtQPs(vec1, smallElInfo, largeElInfo, subAssembler, quad); + vecAtQPs2 = getVectorAtQPs(vec2, smallElInfo, largeElInfo, subAssembler, quad); } void Vec3AtQP_ZOT::initElement(const ElInfo* elInfo, SubAssembler* subAssembler, Quadrature *quad) { - vecAtQPs1 = subAssembler->getVectorAtQPs(vec1, elInfo, quad); - vecAtQPs2 = subAssembler->getVectorAtQPs(vec2, elInfo, quad); - vecAtQPs3 = subAssembler->getVectorAtQPs(vec3, elInfo, quad); + vecAtQPs1 = getVectorAtQPs(vec1, elInfo, subAssembler, quad); + vecAtQPs2 = getVectorAtQPs(vec2, elInfo, subAssembler, quad); + vecAtQPs3 = getVectorAtQPs(vec3, elInfo, subAssembler, quad); } void VecAndCoordsAtQP_ZOT::initElement(const ElInfo* elInfo, SubAssembler* subAssembler, Quadrature *quad) { - vecAtQPs = subAssembler->getVectorAtQPs(vec, elInfo, quad); + vecAtQPs = getVectorAtQPs(vec, elInfo, subAssembler, quad); coordsAtQPs = subAssembler->getCoordsAtQPs(elInfo, quad); } @@ -445,16 +1135,16 @@ namespace AMDiS { SubAssembler* subAssembler, Quadrature *quad) { - vecAtQPs1 = subAssembler->getVectorAtQPs(vec1, elInfo, quad); - vecAtQPs2 = subAssembler->getVectorAtQPs(vec2, elInfo, quad); - gradAtQPs = subAssembler->getGradientsAtQPs(vec1, elInfo, quad); + vecAtQPs1 = getVectorAtQPs(vec1, elInfo, subAssembler, quad); + vecAtQPs2 = getVectorAtQPs(vec2, elInfo, subAssembler, quad); + gradAtQPs = getGradientsAtQPs(vec1, elInfo, subAssembler, quad); } void FctGradientCoords_ZOT::initElement(const ElInfo* elInfo, SubAssembler* subAssembler, Quadrature *quad) { - gradAtQPs = subAssembler->getGradientsAtQPs(vec, elInfo, quad); + gradAtQPs = getGradientsAtQPs(vec, elInfo, subAssembler, quad); coordsAtQPs = subAssembler->getCoordsAtQPs(elInfo, quad); } @@ -462,8 +1152,8 @@ namespace AMDiS { SubAssembler* subAssembler, Quadrature *quad) { - vecAtQPs = subAssembler->getVectorAtQPs(vec, elInfo, quad); - gradAtQPs = subAssembler->getGradientsAtQPs(vec, elInfo, quad); + vecAtQPs = getVectorAtQPs(vec, elInfo, subAssembler, quad); + gradAtQPs = getGradientsAtQPs(vec, elInfo, subAssembler, quad); coordsAtQPs = subAssembler->getCoordsAtQPs(elInfo, quad); } @@ -471,32 +1161,32 @@ namespace AMDiS { SubAssembler* subAssembler, Quadrature *quad) { - vecAtQPs = subAssembler->getVectorAtQPs(vec, elInfo, quad); - gradAtQPs = subAssembler->getGradientsAtQPs(vec, elInfo, quad); + vecAtQPs = getVectorAtQPs(vec, elInfo, subAssembler, quad); + gradAtQPs = getGradientsAtQPs(vec, elInfo, subAssembler, quad); } void VecAndGradVecAtQP_ZOT::initElement(const ElInfo* elInfo, SubAssembler* subAssembler, Quadrature *quad) { - vecAtQPs = subAssembler->getVectorAtQPs(vec, elInfo, quad); - gradAtQPs = subAssembler->getGradientsAtQPs(vecGrd, elInfo, quad); + vecAtQPs = getVectorAtQPs(vec, elInfo, subAssembler, quad); + gradAtQPs = getGradientsAtQPs(vecGrd, elInfo, subAssembler, quad); } void VecAndGradVec2AtQP_ZOT::initElement(const ElInfo* elInfo, SubAssembler* subAssembler, Quadrature *quad) { - vecAtQPs = subAssembler->getVectorAtQPs(vec, elInfo, quad); - grad1AtQPs = subAssembler->getGradientsAtQPs(vecGrd1, elInfo, quad); - grad2AtQPs = subAssembler->getGradientsAtQPs(vecGrd2, elInfo, quad); + vecAtQPs = getVectorAtQPs(vec, elInfo, subAssembler, quad); + grad1AtQPs = getGradientsAtQPs(vecGrd1, elInfo, subAssembler, quad); + grad2AtQPs = getGradientsAtQPs(vecGrd2, elInfo, subAssembler, quad); } void FctGradient_ZOT::initElement(const ElInfo* elInfo, SubAssembler* subAssembler, Quadrature *quad) { - gradAtQPs = subAssembler->getGradientsAtQPs(vec, elInfo, quad); + gradAtQPs = getGradientsAtQPs(vec, elInfo, subAssembler, quad); } void CoordsAtQP_ZOT::initElement(const ElInfo* elInfo, @@ -505,90 +1195,90 @@ namespace AMDiS { coordsAtQPs = subAssembler->getCoordsAtQPs(elInfo, quad); } - void MatrixFct_SOT::getLALt(const ElInfo *elInfo, int numPoints, DimMat<double> **LALt) const { + void MatrixFct_SOT::getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const { const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { lalt(Lambda, (*matrixFct)(vecAtQPs[iq]), *(LALt[iq]), symmetric, 1.0); } } - void VecAtQP_SOT::getLALt(const ElInfo *elInfo, int numPoints, DimMat<double> **LALt) const { + void VecAtQP_SOT::getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const { const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { l1lt(Lambda, *(LALt[iq]), (*f)(vecAtQPs[iq])); } } - void Vec2AtQP_SOT::getLALt(const ElInfo *elInfo, int numPoints, DimMat<double> **LALt) const { + void Vec2AtQP_SOT::getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const { const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { l1lt(Lambda, *(LALt[iq]), (*f)(vecAtQPs1[iq], vecAtQPs2[iq])); } } - void CoordsAtQP_SOT::getLALt(const ElInfo *elInfo, int numPoints, DimMat<double> **LALt) const { + void CoordsAtQP_SOT::getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const { const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { l1lt(Lambda, (*LALt[iq]), (*g)(coordsAtQPs[iq])); } } - void MatrixGradient_SOT::getLALt(const ElInfo *elInfo, int numPoints, DimMat<double> **LALt) const { + void MatrixGradient_SOT::getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const { const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { lalt(Lambda, (*f)(gradAtQPs[iq]), (*LALt[iq]), symmetric, 1.0); } } - void FctGradient_SOT::getLALt(const ElInfo *elInfo, int numPoints, DimMat<double> **LALt) const { + void FctGradient_SOT::getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const { const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { l1lt(Lambda, *(LALt[iq]), (*f)(gradAtQPs[iq])); } } - void VecAndGradientAtQP_SOT::getLALt(const ElInfo *elInfo, int numPoints, + void VecAndGradientAtQP_SOT::getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const { const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { l1lt(Lambda, *(LALt[iq]), (*f)(vecAtQPs[iq], gradAtQPs[iq])); } } - void VecMatrixGradientAtQP_SOT::getLALt(const ElInfo *elInfo, int numPoints, + void VecMatrixGradientAtQP_SOT::getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const { const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { lalt(Lambda, (*f)(vecAtQPs[iq], gradAtQPs[iq]), (*LALt[iq]), symmetric, 1.0); } } - void VecAndCoordsAtQP_SOT::getLALt(const ElInfo *elInfo, int numPoints, DimMat<double> **LALt) + void VecAndCoordsAtQP_SOT::getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const { const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { l1lt(Lambda, *(LALt[iq]), (*f)(vecAtQPs[iq], coordsAtQPs[iq])); } } - void MatrixGradientAndCoords_SOT::getLALt(const ElInfo *elInfo, int numPoints, + void MatrixGradientAndCoords_SOT::getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const { const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { lalt(Lambda, (*f)(gradAtQPs[iq], coordsAtQPs[iq]), (*LALt[iq]), symmetric, 1.0); } } - void VecGradCoordsAtQP_SOT::getLALt(const ElInfo *elInfo, int numPoints, + void VecGradCoordsAtQP_SOT::getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const { const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { l1lt(Lambda, *(LALt[iq]), (*f)(vecAtQPs[iq], gradAtQPs[iq], coordsAtQPs[iq])); } } - void VecAtQP_FOT::getLb(const ElInfo *elInfo, int numPoints, VectorOfFixVecs<DimVec<double> >& Lb) const { + void VecAtQP_FOT::getLb(const ElInfo *elInfo, int nPoints, VectorOfFixVecs<DimVec<double> >& Lb) const { const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { if (b) lb(Lambda, *b, Lb[iq], (*f)(vecAtQPs[iq])); else @@ -596,125 +1286,132 @@ namespace AMDiS { } } - void CoordsAtQP_FOT::getLb(const ElInfo *elInfo, int numPoints, VectorOfFixVecs<DimVec<double> >& Lb) const { + void CoordsAtQP_FOT::getLb(const ElInfo *elInfo, int nPoints, VectorOfFixVecs<DimVec<double> >& Lb) const { const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { l1(Lambda, Lb[iq], (*g)(coordsAtQPs[iq])); } } - void VecCoordsAtQP_FOT::getLb(const ElInfo *elInfo, int numPoints, + void VecCoordsAtQP_FOT::getLb(const ElInfo *elInfo, int nPoints, VectorOfFixVecs<DimVec<double> >& Lb) const { const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { lb(Lambda, b, Lb[iq], (*g)(coordsAtQPs[iq])); } } - void VectorGradient_FOT::getLb(const ElInfo *elInfo, int numPoints, VectorOfFixVecs<DimVec<double> >& Lb) const { + void VectorGradient_FOT::getLb(const ElInfo *elInfo, int nPoints, VectorOfFixVecs<DimVec<double> >& Lb) const { const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); if (f) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { lb(Lambda, (*f)(gradAtQPs[iq]), Lb[iq], 1.0); } } else { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { lb(Lambda, gradAtQPs[iq], Lb[iq], 1.0); } } } - void VectorFct_FOT::getLb(const ElInfo *elInfo, int numPoints, VectorOfFixVecs<DimVec<double> >& Lb) const { + void VectorFct_FOT::getLb(const ElInfo *elInfo, int nPoints, VectorOfFixVecs<DimVec<double> >& Lb) const { const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { lb(Lambda, (*vecFct)(vecAtQPs[iq]), Lb[iq], 1.0); } } - void VecFctAtQP_FOT::getLb(const ElInfo *elInfo, int numPoints, VectorOfFixVecs<DimVec<double> >& Lb) const { + void VecFctAtQP_FOT::getLb(const ElInfo *elInfo, int nPoints, VectorOfFixVecs<DimVec<double> >& Lb) const { const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { lb(Lambda, (*g)(coordsAtQPs[iq]), Lb[iq], 1.0); } } - void VecAtQP_ZOT::getC(const ElInfo *, int numPoints, double *C) const { + void VecAtQP_ZOT::getC(const ElInfo *, int nPoints, double *C) const { if (f) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { C[iq] += (*f)(vecAtQPs[iq]); } } else { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { C[iq] += vecAtQPs[iq]; } } } - void VecAtQP_ZOT::eval(int numPoints, - const double *uhAtQP, + void VecAtQP_ZOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, double fac) const { - for (int iq = 0; iq < numPoints; iq++) { - result[iq] += fac * (*f)(vecAtQPs[iq]) * uhAtQP[iq]; + if (f) { + for (int iq = 0; iq < nPoints; iq++) { + result[iq] += fac * (*f)(vecAtQPs[iq]) * uhAtQP[iq]; + } + } else { + for (int iq = 0; iq < nPoints; iq++) { + result[iq] += fac * vecAtQPs[iq] * uhAtQP[iq]; + } } } - void MultVecAtQP_ZOT::getC(const ElInfo *, int numPoints, double *C) const { - for (int iq = 0; iq < numPoints; iq++) { + + void MultVecAtQP_ZOT::getC(const ElInfo *, int nPoints, double *C) const { + for (int iq = 0; iq < nPoints; iq++) { C[iq] += (*f1)(vecAtQPs1[iq]) * (*f2)(vecAtQPs2[iq]); } } - void MultVecAtQP_ZOT::eval(int numPoints, - const double *uhAtQP, + void MultVecAtQP_ZOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, double fac) const { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { result[iq] += fac * (*f1)(vecAtQPs1[iq]) * (*f2)(vecAtQPs2[iq]) * uhAtQP[iq]; } } - void Vec2AtQP_ZOT::getC(const ElInfo *, int numPoints, double *C) const { - for (int iq = 0; iq < numPoints; iq++) { + void Vec2AtQP_ZOT::getC(const ElInfo *, int nPoints, double *C) const { + for (int iq = 0; iq < nPoints; iq++) { C[iq] += (*f)(vecAtQPs1[iq], vecAtQPs2[iq]); } } - void Vec2AtQP_ZOT::eval(int numPoints, - const double *uhAtQP, + void Vec2AtQP_ZOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, double fac) const { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { result[iq] += fac * (*f)(vecAtQPs1[iq], vecAtQPs2[iq]) * uhAtQP[iq]; } } - void Vec3AtQP_ZOT::getC(const ElInfo *, int numPoints, double *C) const { - for (int iq = 0; iq < numPoints; iq++) { + void Vec3AtQP_ZOT::getC(const ElInfo *, int nPoints, double *C) const { + for (int iq = 0; iq < nPoints; iq++) { C[iq] += (*f)(vecAtQPs1[iq], vecAtQPs2[iq], vecAtQPs3[iq]); } } - void Vec3AtQP_ZOT::eval(int numPoints, + void Vec3AtQP_ZOT::eval(int nPoints, const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, double fac) const { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { result[iq] += fac * (*f)(vecAtQPs1[iq], vecAtQPs2[iq], vecAtQPs3[iq]) * @@ -723,59 +1420,59 @@ namespace AMDiS { } - void VecAndCoordsAtQP_ZOT::getC(const ElInfo *, int numPoints, double *C) const { - for (int iq = 0; iq < numPoints; iq++) { + void VecAndCoordsAtQP_ZOT::getC(const ElInfo *, int nPoints, double *C) const { + for (int iq = 0; iq < nPoints; iq++) { C[iq] += (*f)(vecAtQPs[iq], coordsAtQPs[iq]); } } - void VecAndCoordsAtQP_ZOT::eval(int numPoints, - const double *uhAtQP, + void VecAndCoordsAtQP_ZOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, double fac) const { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { result[iq] += fac * (*f)(vecAtQPs[iq], coordsAtQPs[iq]) * uhAtQP[iq]; } } - void FctGradientCoords_ZOT::getC(const ElInfo *, int numPoints, double *C) const { - for (int iq = 0; iq < numPoints; iq++) { + void FctGradientCoords_ZOT::getC(const ElInfo *, int nPoints, double *C) const { + for (int iq = 0; iq < nPoints; iq++) { C[iq] += (*f)(gradAtQPs[iq], coordsAtQPs[iq]); } } - void FctGradientCoords_ZOT::eval(int numPoints, - const double *uhAtQP, + void FctGradientCoords_ZOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, double fac) const { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { result[iq] += fac * (*f)(gradAtQPs[iq], coordsAtQPs[iq]) * uhAtQP[iq]; } } - void VecGradCoordsAtQP_ZOT::getC(const ElInfo *, int numPoints, double *C) const { - for (int iq = 0; iq < numPoints; iq++) { + void VecGradCoordsAtQP_ZOT::getC(const ElInfo *, int nPoints, double *C) const { + for (int iq = 0; iq < nPoints; iq++) { C[iq] += (*f)(vecAtQPs[iq], gradAtQPs[iq], coordsAtQPs[iq]); } } - void VecGradCoordsAtQP_ZOT::eval(int numPoints, - const double *uhAtQP, + void VecGradCoordsAtQP_ZOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, double fac) const { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { result[iq] += fac * (*f)(vecAtQPs[iq], gradAtQPs[iq], coordsAtQPs[iq]) * @@ -783,14 +1480,14 @@ namespace AMDiS { } } - void Vec2AndGradAtQP_ZOT::eval(int numPoints, + void Vec2AndGradAtQP_ZOT::eval(int nPoints, const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, double fac) const { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { result[iq] += fac * (*f)(vecAtQPs1[iq], gradAtQPs[iq], vecAtQPs2[iq]) * @@ -798,115 +1495,99 @@ namespace AMDiS { } } - void Vec2AndGradAtQP_ZOT::getC(const ElInfo *, int numPoints, double *C) const + void Vec2AndGradAtQP_ZOT::getC(const ElInfo *, int nPoints, double *C) const { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { C[iq] += (*f)(vecAtQPs1[iq], gradAtQPs[iq], vecAtQPs2[iq]); } } - void VecAndGradAtQP_ZOT::getC(const ElInfo *, int numPoints, double *C) const { - for (int iq = 0; iq < numPoints; iq++) { + void VecAndGradAtQP_ZOT::getC(const ElInfo *, int nPoints, double *C) const { + for (int iq = 0; iq < nPoints; iq++) { C[iq] += (*f)(vecAtQPs[iq], gradAtQPs[iq]); } } - void VecAndGradAtQP_ZOT::eval(int numPoints, - const double *uhAtQP, + void VecAndGradAtQP_ZOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, double fac) const { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) result[iq] += - fac * - (*f)(vecAtQPs[iq], gradAtQPs[iq]) * - uhAtQP[iq]; - } + fac * (*f)(vecAtQPs[iq], gradAtQPs[iq]) * uhAtQP[iq]; } - void VecAndGradVecAtQP_ZOT::getC(const ElInfo *, int numPoints, double *C) const + void VecAndGradVecAtQP_ZOT::getC(const ElInfo *, int nPoints, double *C) const { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) C[iq] += (*f)(vecAtQPs[iq], gradAtQPs[iq]); - } } - void VecAndGradVecAtQP_ZOT::eval(int numPoints, - const double *uhAtQP, + void VecAndGradVecAtQP_ZOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, double fac) const { - for (int iq = 0; iq < numPoints; iq++) { - result[iq] += - fac * - (*f)(vecAtQPs[iq], gradAtQPs[iq]) * - uhAtQP[iq]; - } + for (int iq = 0; iq < nPoints; iq++) + result[iq] += fac * (*f)(vecAtQPs[iq], gradAtQPs[iq]) * uhAtQP[iq]; } - void VecAndGradVec2AtQP_ZOT::getC(const ElInfo *, int numPoints, double *C) const { - for (int iq = 0; iq < numPoints; iq++) { + void VecAndGradVec2AtQP_ZOT::getC(const ElInfo *, int nPoints, double *C) const { + for (int iq = 0; iq < nPoints; iq++) C[iq] += (*f)(vecAtQPs[iq], grad1AtQPs[iq], grad2AtQPs[iq]); - } } - void VecAndGradVec2AtQP_ZOT::eval(int numPoints, - const double *uhAtQP, + void VecAndGradVec2AtQP_ZOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, double fac) const { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) result[iq] += - fac * - (*f)(vecAtQPs[iq], grad1AtQPs[iq], grad2AtQPs[iq]) * - uhAtQP[iq]; - } + fac * (*f)(vecAtQPs[iq], grad1AtQPs[iq], grad2AtQPs[iq]) * uhAtQP[iq]; } - void FctGradient_ZOT::getC(const ElInfo *, int numPoints, double *C) const { - for (int iq = 0; iq < numPoints; iq++) { + void FctGradient_ZOT::getC(const ElInfo *, int nPoints, double *C) const { + for (int iq = 0; iq < nPoints; iq++) C[iq] += (*f)(gradAtQPs[iq]); - } } - void FctGradient_ZOT::eval(int numPoints, - const double *uhAtQP, + void FctGradient_ZOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, double fac) const { - for (int iq = 0; iq < numPoints; iq++) { - result[iq] += fac * (*f)(gradAtQPs[iq]) * uhAtQP[iq]; - } + for (int iq = 0; iq < nPoints; iq++) + result[iq] += fac * (*f)(gradAtQPs[iq]) * uhAtQP[iq]; } - void CoordsAtQP_ZOT::getC(const ElInfo *elInfo, int numPoints, double *C) const { - for (int iq = 0; iq < numPoints; iq++) { - C[iq] += (*g)(coordsAtQPs[iq]); - } + void CoordsAtQP_ZOT::getC(const ElInfo *elInfo, int nPoints, double *C) const { + for (int iq = 0; iq < nPoints; iq++) + C[iq] += (*g)(coordsAtQPs[iq]); } - void CoordsAtQP_ZOT::eval(int numPoints, - const double *uhAtQP, + void CoordsAtQP_ZOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, double fac) const { - for (int iq = 0; iq < numPoints; iq++) { - result[iq] += fac * (*g)(coordsAtQPs[iq]) * uhAtQP[iq]; - } + for (int iq = 0; iq < nPoints; iq++) + result[iq] += fac * (*g)(coordsAtQPs[iq]) * uhAtQP[iq]; } - void MatrixFct_SOT::eval(int numPoints, - const double *uhAtQP, + void MatrixFct_SOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -914,7 +1595,7 @@ namespace AMDiS { { int dow = Global::getGeo(WORLD); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double resultQP = 0.0; WorldMatrix<double> A = (*matrixFct)(vecAtQPs[iq]); @@ -935,13 +1616,13 @@ namespace AMDiS { } } - void MatrixFct_SOT::weakEval(int numPoints, + void MatrixFct_SOT::weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const { if (grdUhAtQP) { WorldMatrix<double> A; - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { A = (*matrixFct)(vecAtQPs[iq]); result[iq] += A * grdUhAtQP[iq]; } @@ -949,8 +1630,8 @@ namespace AMDiS { } - void Matrix_SOT::eval(int numPoints, - const double *uhAtQP, + void Matrix_SOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -959,7 +1640,7 @@ namespace AMDiS { int dow = Global::getGeo(WORLD); if (D2UhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double resultQP = 0.0; for (int i = 0; i < dow; i++) { for (int j = 0; j < dow; j++) { @@ -971,12 +1652,12 @@ namespace AMDiS { } } - void Matrix_SOT::weakEval(int numPoints, + void Matrix_SOT::weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const { if (grdUhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { result[iq] += matrix * grdUhAtQP[iq]; } } @@ -984,8 +1665,8 @@ namespace AMDiS { - void MatrixGradient_SOT::eval(int numPoints, - const double *uhAtQP, + void MatrixGradient_SOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -993,7 +1674,7 @@ namespace AMDiS { { int dow = Global::getGeo(WORLD); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double resultQP = 0.0; WorldMatrix<double> A = (*f)(gradAtQPs[iq]); @@ -1012,23 +1693,23 @@ namespace AMDiS { result[iq] += resultQP * factor; } - }; + } - void MatrixGradient_SOT::weakEval(int numPoints, + void MatrixGradient_SOT::weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const { if (grdUhAtQP) { WorldMatrix<double> A; - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { A = (*f)(gradAtQPs[iq]); result[iq] += A * grdUhAtQP[iq]; } } } - void VecAtQP_SOT::eval(int numPoints, - const double *uhAtQP, + void VecAtQP_SOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -1037,7 +1718,7 @@ namespace AMDiS { int dow = Global::getGeo(WORLD); if (D2UhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double factor = (*f)(vecAtQPs[iq]); double resultQP = 0.0; for (int i = 0; i < dow; i++) { @@ -1048,19 +1729,19 @@ namespace AMDiS { } } - void VecAtQP_SOT::weakEval(int numPoints, + void VecAtQP_SOT::weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const { if (grdUhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double factor = (*f)(vecAtQPs[iq]); axpy(factor, grdUhAtQP[iq], result[iq]); } } } - void Vec2AtQP_SOT::eval(int numPoints, + void Vec2AtQP_SOT::eval(int nPoints, const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, @@ -1070,7 +1751,7 @@ namespace AMDiS { int dow = Global::getGeo(WORLD); if (D2UhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double factor = (*f)(vecAtQPs1[iq], vecAtQPs2[iq]); double resultQP = 0.0; for (int i = 0; i < dow; i++) { @@ -1081,20 +1762,20 @@ namespace AMDiS { } } - void Vec2AtQP_SOT::weakEval(int numPoints, + void Vec2AtQP_SOT::weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const { if (grdUhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double factor = (*f)(vecAtQPs1[iq], vecAtQPs2[iq]); axpy(factor, grdUhAtQP[iq], result[iq]); } } } - void CoordsAtQP_SOT::eval(int numPoints, - const double *uhAtQP, + void CoordsAtQP_SOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -1103,7 +1784,7 @@ namespace AMDiS { int dow = Global::getGeo(WORLD); if (D2UhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double factor = (*g)(coordsAtQPs[iq]); double resultQP = 0.0; for (int i = 0; i < dow; i++) { @@ -1114,20 +1795,20 @@ namespace AMDiS { } } - void CoordsAtQP_SOT::weakEval(int numPoints, + void CoordsAtQP_SOT::weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const { if (grdUhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double factor = (*g)(coordsAtQPs[iq]); axpy(factor, grdUhAtQP[iq], result[iq]); } } } - void FctGradient_SOT::eval(int numPoints, - const double *uhAtQP, + void FctGradient_SOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -1136,7 +1817,7 @@ namespace AMDiS { int dow = Global::getGeo(WORLD); if (D2UhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double factor = (*f)(gradAtQPs[iq]); double resultQP = 0.0; for (int i = 0; i < dow; i++) { @@ -1147,20 +1828,20 @@ namespace AMDiS { } } - void FctGradient_SOT::weakEval(int numPoints, + void FctGradient_SOT::weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const { if (grdUhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double factor = (*f)(gradAtQPs[iq]); axpy(factor, grdUhAtQP[iq], result[iq]); } } } - void VecAndGradientAtQP_SOT::eval(int numPoints, - const double *uhAtQP, + void VecAndGradientAtQP_SOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -1169,7 +1850,7 @@ namespace AMDiS { int dow = Global::getGeo(WORLD); if (D2UhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double factor = (*f)(vecAtQPs[iq], gradAtQPs[iq]); double resultQP = 0.0; for (int i = 0; i < dow; i++) { @@ -1180,19 +1861,19 @@ namespace AMDiS { } } - void VecAndGradientAtQP_SOT::weakEval(int numPoints, + void VecAndGradientAtQP_SOT::weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const { if (grdUhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double factor = (*f)(vecAtQPs[iq], gradAtQPs[iq]); axpy(factor, grdUhAtQP[iq], result[iq]); } } } - void VecMatrixGradientAtQP_SOT::eval(int numPoints, + void VecMatrixGradientAtQP_SOT::eval(int nPoints, const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, @@ -1201,7 +1882,7 @@ namespace AMDiS { { int dow = Global::getGeo(WORLD); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double resultQP = 0.0; WorldMatrix<double> A = (*f)(vecAtQPs[iq], gradAtQPs[iq]); @@ -1222,21 +1903,21 @@ namespace AMDiS { } } - void VecMatrixGradientAtQP_SOT::weakEval(int numPoints, + void VecMatrixGradientAtQP_SOT::weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const { if (grdUhAtQP) { WorldMatrix<double> A; - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { A = (*f)(vecAtQPs[iq], gradAtQPs[iq]); result[iq] += A * grdUhAtQP[iq]; } } } - void VecAndCoordsAtQP_SOT::eval(int numPoints, - const double *uhAtQP, + void VecAndCoordsAtQP_SOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -1245,7 +1926,7 @@ namespace AMDiS { int dow = Global::getGeo(WORLD); if (D2UhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double factor = (*f)(vecAtQPs[iq], coordsAtQPs[iq]); double resultQP = 0.0; for (int i = 0; i < dow; i++) { @@ -1256,20 +1937,20 @@ namespace AMDiS { } } - void VecAndCoordsAtQP_SOT::weakEval(int numPoints, + void VecAndCoordsAtQP_SOT::weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const { if (grdUhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double factor = (*f)(vecAtQPs[iq], coordsAtQPs[iq]); axpy(factor, grdUhAtQP[iq], result[iq]); } } } - void MatrixGradientAndCoords_SOT::eval(int numPoints, - const double *uhAtQP, + void MatrixGradientAndCoords_SOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -1277,7 +1958,7 @@ namespace AMDiS { { int dow = Global::getGeo(WORLD); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double resultQP = 0.0; WorldMatrix<double> A = (*f)(gradAtQPs[iq], coordsAtQPs[iq]); @@ -1296,23 +1977,23 @@ namespace AMDiS { result[iq] += resultQP * factor; } - }; + } - void MatrixGradientAndCoords_SOT::weakEval(int numPoints, + void MatrixGradientAndCoords_SOT::weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const { if (grdUhAtQP) { WorldMatrix<double> A; - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { A = (*f)(gradAtQPs[iq], coordsAtQPs[iq]); result[iq] += A * grdUhAtQP[iq]; } } } - void VecGradCoordsAtQP_SOT::eval(int numPoints, - const double *uhAtQP, + void VecGradCoordsAtQP_SOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -1321,7 +2002,7 @@ namespace AMDiS { int dow = Global::getGeo(WORLD); if (D2UhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double factor = (*f)(vecAtQPs[iq], gradAtQPs[iq], coordsAtQPs[iq]); double resultQP = 0.0; for (int i = 0; i < dow; i++) { @@ -1332,20 +2013,20 @@ namespace AMDiS { } } - void VecGradCoordsAtQP_SOT::weakEval(int numPoints, + void VecGradCoordsAtQP_SOT::weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const { if (grdUhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double factor = (*f)(vecAtQPs[iq], gradAtQPs[iq], coordsAtQPs[iq]); axpy(factor, grdUhAtQP[iq], result[iq]); } } } - void VecAtQP_FOT::eval(int numPoints, - const double *uhAtQP, + void VecAtQP_FOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -1354,7 +2035,7 @@ namespace AMDiS { int dow = Global::getGeo(WORLD); if (grdUhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double factor = (*f)(vecAtQPs[iq]); double resultQP = 0.0; for (int i = 0; i < dow; i++) { @@ -1365,8 +2046,8 @@ namespace AMDiS { } } - void CoordsAtQP_FOT::eval(int numPoints, - const double *uhAtQP, + void CoordsAtQP_FOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -1375,7 +2056,7 @@ namespace AMDiS { int dow = Global::getGeo(WORLD); if (grdUhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double factor = (*g)(coordsAtQPs[iq]); double resultQP = 0.0; for (int i = 0; i < dow; i++) { @@ -1386,8 +2067,8 @@ namespace AMDiS { } } - void VecCoordsAtQP_FOT::eval(int numPoints, - const double *uhAtQP, + void VecCoordsAtQP_FOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -1396,7 +2077,7 @@ namespace AMDiS { int dow = Global::getGeo(WORLD); if (grdUhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double factor = (*g)(coordsAtQPs[iq]); double resultQP = 0.0; for (int i = 0; i < dow; i++) { @@ -1407,8 +2088,8 @@ namespace AMDiS { } } - void VectorGradient_FOT::eval(int numPoints, - const double *uhAtQP, + void VectorGradient_FOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -1416,35 +2097,35 @@ namespace AMDiS { { if (grdUhAtQP) { if (f) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { WorldVector<double> b = (*f)(gradAtQPs[iq]); result[iq] += b * grdUhAtQP[iq] * factor; } } else { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { result[iq] += gradAtQPs[iq] * grdUhAtQP[iq] * factor; } } } } - void VectorFct_FOT::eval(int numPoints, - const double *uhAtQP, + void VectorFct_FOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, double factor) const { if (grdUhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { WorldVector<double> b = (*vecFct)(vecAtQPs[iq]); result[iq] += b * grdUhAtQP[iq] * factor; } } } - void VecFctAtQP_FOT::eval(int numPoints, - const double *uhAtQP, + void VecFctAtQP_FOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -1453,7 +2134,7 @@ namespace AMDiS { int dow = Global::getGeo(WORLD); if (grdUhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double resultQP = 0.0; const WorldVector<double> &b = (*g)(coordsAtQPs[iq]); for (int i = 0; i < dow; i++) { @@ -1486,36 +2167,36 @@ namespace AMDiS { } void CoordsAtQP_IJ_SOT::getLALt(const ElInfo *elInfo, - int numPoints, + int nPoints, DimMat<double> **LALt) const { const DimVec<WorldVector<double> > Lambda = elInfo->getGrdLambda(); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { lalt_kl(Lambda, xi, xj, *(LALt[iq]), (*g)(coordsAtQPs[iq])); } } - void CoordsAtQP_IJ_SOT::eval(int numPoints, - const double *uhAtQP, + void CoordsAtQP_IJ_SOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, double f) const { if (D2UhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double factor = (*g)(coordsAtQPs[iq]); result[iq] = D2UhAtQP[iq][xi][xj] * factor * f; } } } - void CoordsAtQP_IJ_SOT::weakEval(int numPoints, + void CoordsAtQP_IJ_SOT::weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const { if (grdUhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double factor = (*g)(coordsAtQPs[iq]); result[iq][xi] += grdUhAtQP[iq][xj] * factor; } @@ -1526,40 +2207,40 @@ namespace AMDiS { SubAssembler* subAssembler, Quadrature *quad) { - vecAtQPs = subAssembler->getVectorAtQPs(vec, elInfo, quad); + vecAtQPs = getVectorAtQPs(vec, elInfo, subAssembler, quad); } void VecAtQP_IJ_SOT::getLALt(const ElInfo *elInfo, - int numPoints, + int nPoints, DimMat<double> **LALt) const { const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { lalt_kl(Lambda, xi, xj, *(LALt[iq]), (*f)(vecAtQPs[iq])); } } - void VecAtQP_IJ_SOT::eval(int numPoints, - const double *uhAtQP, + void VecAtQP_IJ_SOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, double fac) const { if (D2UhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double factor = (*f)(vecAtQPs[iq]); result[iq] = D2UhAtQP[iq][xi][xj] * factor * fac; } } } - void VecAtQP_IJ_SOT::weakEval(int numPoints, + void VecAtQP_IJ_SOT::weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const { if (grdUhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double factor = (*f)(vecAtQPs[iq]); result[iq][xi] += grdUhAtQP[iq][xj] * factor; } @@ -1573,16 +2254,16 @@ namespace AMDiS { { int size = static_cast<int>(vecs.size()); for (int i = 0; i < size; i++) { - vecsAtQPs[i] = subAssembler->getVectorAtQPs(vecs[i], elInfo, quad); + vecsAtQPs[i] = getVectorAtQPs(vecs[i], elInfo, subAssembler, quad); } } - void VecOfDOFVecsAtQP_ZOT::getC(const ElInfo *, int numPoints, double *C) const + void VecOfDOFVecsAtQP_ZOT::getC(const ElInfo *, int nPoints, double *C) const { int size = static_cast<int>(vecs.size()); std::vector<double> arg(size); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { for (int i = 0; i < size; i++) { arg[i] = vecsAtQPs[i][iq]; } @@ -1590,8 +2271,8 @@ namespace AMDiS { } } - void VecOfDOFVecsAtQP_ZOT::eval(int numPoints, - const double *uhAtQP, + void VecOfDOFVecsAtQP_ZOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -1600,7 +2281,7 @@ namespace AMDiS { int size = static_cast<int>(vecs.size()); std::vector<double> arg(size); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { for (int i = 0; i < size; i++) { arg[i] = vecsAtQPs[i][iq]; } @@ -1615,7 +2296,7 @@ namespace AMDiS { { int i ,size = static_cast<int>(vecs.size()); for(i = 0; i < size; i++) { - gradsAtQPs[i] = subAssembler->getGradientsAtQPs(vecs[i], elInfo, quad); + gradsAtQPs[i] = getGradientsAtQPs(vecs[i], elInfo, subAssembler, quad); } } @@ -1625,17 +2306,17 @@ namespace AMDiS { { int size = static_cast<int>(vecs.size()); for (int i = 0; i < size; i++) { - gradsAtQPs[i] = subAssembler->getGradientsAtQPs(vecs[i], elInfo, quad); + gradsAtQPs[i] = getGradientsAtQPs(vecs[i], elInfo, subAssembler, quad); } } - void VecOfGradientsAtQP_ZOT::getC(const ElInfo *, int numPoints, double *C) const + void VecOfGradientsAtQP_ZOT::getC(const ElInfo *, int nPoints, double *C) const { int size = static_cast<int>(vecs.size()); std::vector<WorldVector<double>*> arg(size); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { for (int i = 0; i < size; i++) { arg[i] = &(gradsAtQPs[i][iq]); } @@ -1643,8 +2324,8 @@ namespace AMDiS { } } - void VecOfGradientsAtQP_ZOT::eval(int numPoints, - const double *uhAtQP, + void VecOfGradientsAtQP_ZOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -1653,7 +2334,7 @@ namespace AMDiS { int size = static_cast<int>(vecs.size()); std::vector<WorldVector<double>*> arg(size); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { for (int i = 0; i < size; i++) { arg[i] = &(gradsAtQPs[i][iq]); } @@ -1661,19 +2342,19 @@ namespace AMDiS { } } - void VecDivergence_ZOT::getC(const ElInfo *, int numPoints, double *C) const + void VecDivergence_ZOT::getC(const ElInfo *, int nPoints, double *C) const { int size = static_cast<int>(vecs.size()); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { for (int i = 0; i < size; i++) { C[iq] += gradsAtQPs[i][iq][i]; } } } - void VecDivergence_ZOT::eval(int numPoints, - const double *uhAtQP, + void VecDivergence_ZOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -1681,7 +2362,7 @@ namespace AMDiS { { int size = static_cast<int>(vecs.size()); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double d = 0.0; for (int i = 0; i < size; i++) { d += gradsAtQPs[i][iq][i]; @@ -1690,8 +2371,8 @@ namespace AMDiS { } } - void VecAndGradAtQP_SOT::eval(int numPoints, - const double *uhAtQP, + void VecAndGradAtQP_SOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -1700,7 +2381,7 @@ namespace AMDiS { int dow = Global::getGeo(WORLD); if (D2UhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double factor = (*f)(vecAtQPs[iq], gradAtQPs[iq]); double resultQP = 0.0; for (int i = 0; i < dow; i++) { @@ -1711,21 +2392,21 @@ namespace AMDiS { } } - void VecAndGradAtQP_SOT::weakEval(int numPoints, + void VecAndGradAtQP_SOT::weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const { if (grdUhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double factor = (*f)(vecAtQPs[iq], gradAtQPs[iq]); axpy(factor, grdUhAtQP[iq], result[iq]); } } } - void VecAndGradAtQP_SOT::getLALt(const ElInfo *elInfo, int numPoints, DimMat<double> **LALt) const { + void VecAndGradAtQP_SOT::getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const { const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { l1lt(Lambda, *(LALt[iq]), (*f)(vecAtQPs[iq], gradAtQPs[iq])); } } @@ -1734,44 +2415,44 @@ namespace AMDiS { SubAssembler* subAssembler, Quadrature *quad) { - vecAtQPs = subAssembler->getVectorAtQPs(vec, elInfo, quad); - gradAtQPs = subAssembler->getGradientsAtQPs(vec, elInfo, quad); + vecAtQPs = getVectorAtQPs(vec, elInfo, subAssembler, quad); + gradAtQPs = getGradientsAtQPs(vec, elInfo, subAssembler, quad); } void General_SOT::initElement(const ElInfo* elInfo, SubAssembler* subAssembler, Quadrature *quad) { - int numVecs = static_cast<int>(vecs_.size()); - int numGrads = static_cast<int>(grads_.size()); + int nVecs = static_cast<int>(vecs_.size()); + int nGrads = static_cast<int>(grads_.size()); coordsAtQPs_ = subAssembler->getCoordsAtQPs(elInfo, quad); - for (int i = 0; i < numVecs; i++) { - vecsAtQPs_[i] = subAssembler->getVectorAtQPs(vecs_[i], elInfo, quad); + for (int i = 0; i < nVecs; i++) { + vecsAtQPs_[i] = getVectorAtQPs(vecs_[i], elInfo, subAssembler, quad); } - for (int i = 0; i < numGrads; i++) { - gradsAtQPs_[i] = subAssembler->getGradientsAtQPs(grads_[i], elInfo, quad); + for (int i = 0; i < nGrads; i++) { + gradsAtQPs_[i] = getGradientsAtQPs(grads_[i], elInfo, subAssembler, quad); } } void General_SOT::getLALt(const ElInfo *elInfo, - int numPoints, + int nPoints, DimMat<double> **LALt) const { - int numVecs = static_cast<int>(vecs_.size()); - int numGrads = static_cast<int>(grads_.size()); + int nVecs = static_cast<int>(vecs_.size()); + int nGrads = static_cast<int>(grads_.size()); - std::vector<double> vecsArg(numVecs); - std::vector<WorldVector<double> > gradsArg(numGrads); + std::vector<double> vecsArg(nVecs); + std::vector<WorldVector<double> > gradsArg(nGrads); const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); - for (int iq = 0; iq < numPoints; iq++) { - for (int i = 0; i < numVecs; i++) { + for (int iq = 0; iq < nPoints; iq++) { + for (int i = 0; i < nVecs; i++) { vecsArg[i] = vecsAtQPs_[i][iq]; } - for (int i = 0; i < numGrads; i++) { + for (int i = 0; i < nGrads; i++) { gradsArg[i] = gradsAtQPs_[i][iq]; } lalt(Lambda, (*f_)(coordsAtQPs_[iq], vecsArg, gradsArg), @@ -1779,27 +2460,27 @@ namespace AMDiS { } } - void General_SOT::eval(int numPoints, - const double *uhAtQP, + void General_SOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, double factor) const { int dow = Global::getGeo(WORLD); - int numVecs = static_cast<int>(vecs_.size()); - int numGrads = static_cast<int>(grads_.size()); + int nVecs = static_cast<int>(vecs_.size()); + int nGrads = static_cast<int>(grads_.size()); - std::vector<double> vecsArg(numVecs); - std::vector<WorldVector<double> > gradsArg(numGrads); + std::vector<double> vecsArg(nVecs); + std::vector<WorldVector<double> > gradsArg(nGrads); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double resultQP = 0.0; - for (int i = 0; i < numVecs; i++) { + for (int i = 0; i < nVecs; i++) { vecsArg[i] = vecsAtQPs_[i][iq]; } - for (int i = 0; i < numGrads; i++) { + for (int i = 0; i < nGrads; i++) { gradsArg[i] = gradsAtQPs_[i][iq]; } @@ -1821,23 +2502,23 @@ namespace AMDiS { } } - void General_SOT::weakEval(int numPoints, + void General_SOT::weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const { - int numVecs = static_cast<int>(vecs_.size()); - int numGrads = static_cast<int>(grads_.size()); + int nVecs = static_cast<int>(vecs_.size()); + int nGrads = static_cast<int>(grads_.size()); - std::vector<double> vecsArg(numVecs); - std::vector<WorldVector<double> > gradsArg(numGrads); + std::vector<double> vecsArg(nVecs); + std::vector<WorldVector<double> > gradsArg(nGrads); if (grdUhAtQP) { WorldMatrix<double> A; - for (int iq = 0; iq < numPoints; iq++) { - for (int i = 0; i < numVecs; i++) { + for (int iq = 0; iq < nPoints; iq++) { + for (int i = 0; i < nVecs; i++) { vecsArg[i] = vecsAtQPs_[i][iq]; } - for (int i = 0; i < numGrads; i++) { + for (int i = 0; i < nGrads; i++) { gradsArg[i] = gradsAtQPs_[i][iq]; } A = (*f_)(coordsAtQPs_[iq], vecsArg, gradsArg); @@ -1850,36 +2531,36 @@ namespace AMDiS { SubAssembler* subAssembler, Quadrature *quad) { - int numVecs = static_cast<int>(vecs_.size()); - int numGrads = static_cast<int>(grads_.size()); + int nVecs = static_cast<int>(vecs_.size()); + int nGrads = static_cast<int>(grads_.size()); coordsAtQPs_ = subAssembler->getCoordsAtQPs(elInfo, quad); - for (int i = 0; i < numVecs; i++) { - vecsAtQPs_[i] = subAssembler->getVectorAtQPs(vecs_[i], elInfo, quad); + for (int i = 0; i < nVecs; i++) { + vecsAtQPs_[i] = getVectorAtQPs(vecs_[i], elInfo, subAssembler, quad); } - for (int i = 0; i < numGrads; i++) { - gradsAtQPs_[i] = subAssembler->getGradientsAtQPs(grads_[i], elInfo, quad); + for (int i = 0; i < nGrads; i++) { + gradsAtQPs_[i] = getGradientsAtQPs(grads_[i], elInfo, subAssembler, quad); } } void General_FOT::getLb(const ElInfo *elInfo, - int numPoints, + int nPoints, VectorOfFixVecs<DimVec<double> >& result) const { - int numVecs = static_cast<int>(vecs_.size()); - int numGrads = static_cast<int>(grads_.size()); + int nVecs = static_cast<int>(vecs_.size()); + int nGrads = static_cast<int>(grads_.size()); - std::vector<double> vecsArg(numVecs); - std::vector<WorldVector<double> > gradsArg(numGrads); + std::vector<double> vecsArg(nVecs); + std::vector<WorldVector<double> > gradsArg(nGrads); const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); - for (int iq = 0; iq < numPoints; iq++) { - for (int i = 0; i < numVecs; i++) { + for (int iq = 0; iq < nPoints; iq++) { + for (int i = 0; i < nVecs; i++) { vecsArg[i] = vecsAtQPs_[i][iq]; } - for (int i = 0; i < numGrads; i++) { + for (int i = 0; i < nGrads; i++) { gradsArg[i] = gradsAtQPs_[i][iq]; } lb(Lambda, (*f_)(coordsAtQPs_[iq], vecsArg, gradsArg), @@ -1887,28 +2568,28 @@ namespace AMDiS { } } - void General_FOT::eval(int numPoints, - const double *uhAtQP, + void General_FOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, double factor) const { int dow = Global::getGeo(WORLD); - int numVecs = static_cast<int>(vecs_.size()); - int numGrads = static_cast<int>(grads_.size()); + int nVecs = static_cast<int>(vecs_.size()); + int nGrads = static_cast<int>(grads_.size()); - std::vector<double> vecsArg(numVecs); - std::vector<WorldVector<double> > gradsArg(numGrads); + std::vector<double> vecsArg(nVecs); + std::vector<WorldVector<double> > gradsArg(nGrads); if (grdUhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double resultQP = 0.0; - for (int i = 0; i < numVecs; i++) { + for (int i = 0; i < nVecs; i++) { vecsArg[i] = vecsAtQPs_[i][iq]; } - for (int i = 0; i < numGrads; i++) { + for (int i = 0; i < nGrads; i++) { gradsArg[i] = gradsAtQPs_[i][iq]; } @@ -1925,56 +2606,56 @@ namespace AMDiS { void General_ZOT::initElement(const ElInfo* elInfo, SubAssembler* subAssembler, Quadrature *quad) { - int numVecs = static_cast<int>(vecs_.size()); - int numGrads = static_cast<int>(grads_.size()); + int nVecs = static_cast<int>(vecs_.size()); + int nGrads = static_cast<int>(grads_.size()); coordsAtQPs_ = subAssembler->getCoordsAtQPs(elInfo, quad); - for (int i = 0; i < numVecs; i++) { - vecsAtQPs_[i] = subAssembler->getVectorAtQPs(vecs_[i], elInfo, quad); + for (int i = 0; i < nVecs; i++) { + vecsAtQPs_[i] = getVectorAtQPs(vecs_[i], elInfo, subAssembler, quad); } - for (int i = 0; i < numGrads; i++) { - gradsAtQPs_[i] = subAssembler->getGradientsAtQPs(grads_[i], elInfo, quad); + for (int i = 0; i < nGrads; i++) { + gradsAtQPs_[i] = getGradientsAtQPs(grads_[i], elInfo, subAssembler, quad); } } - void General_ZOT::getC(const ElInfo *, int numPoints, double *C) const + void General_ZOT::getC(const ElInfo *, int nPoints, double *C) const { - int numVecs = static_cast<int>(vecs_.size()); - int numGrads = static_cast<int>(grads_.size()); + int nVecs = static_cast<int>(vecs_.size()); + int nGrads = static_cast<int>(grads_.size()); - std::vector<double> vecsArg(numVecs); - std::vector<WorldVector<double> > gradsArg(numGrads); + std::vector<double> vecsArg(nVecs); + std::vector<WorldVector<double> > gradsArg(nGrads); - for (int iq = 0; iq < numPoints; iq++) { - for (int i = 0; i < numVecs; i++) { + for (int iq = 0; iq < nPoints; iq++) { + for (int i = 0; i < nVecs; i++) { vecsArg[i] = vecsAtQPs_[i][iq]; } - for (int i = 0; i < numGrads; i++) { + for (int i = 0; i < nGrads; i++) { gradsArg[i] = gradsAtQPs_[i][iq]; } C[iq] += (*f_)(coordsAtQPs_[iq], vecsArg, gradsArg); } } - void General_ZOT::eval(int numPoints, - const double *uhAtQP, + void General_ZOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, double fac) const { - int numVecs = static_cast<int>(vecs_.size()); - int numGrads = static_cast<int>(grads_.size()); + int nVecs = static_cast<int>(vecs_.size()); + int nGrads = static_cast<int>(grads_.size()); - std::vector<double> vecsArg(numVecs); - std::vector<WorldVector<double> > gradsArg(numGrads); + std::vector<double> vecsArg(nVecs); + std::vector<WorldVector<double> > gradsArg(nGrads); - for (int iq = 0; iq < numPoints; iq++) { - for (int i = 0; i < numVecs; i++) { + for (int iq = 0; iq < nPoints; iq++) { + for (int i = 0; i < nVecs; i++) { vecsArg[i] = vecsAtQPs_[i][iq]; } - for (int i = 0; i < numGrads; i++) { + for (int i = 0; i < nGrads; i++) { gradsArg[i] = gradsAtQPs_[i][iq]; } result[iq] += fac * (*f_)(coordsAtQPs_[iq], vecsArg, gradsArg) * uhAtQP[iq]; @@ -1988,37 +2669,37 @@ namespace AMDiS { SubAssembler* subAssembler, Quadrature *quad) { - int numVecs = static_cast<int>(vecs_.size()); - int numGrads = static_cast<int>(grads_.size()); + int nVecs = static_cast<int>(vecs_.size()); + int nGrads = static_cast<int>(grads_.size()); elInfo->getElementNormal(elementNormal_); coordsAtQPs_ = subAssembler->getCoordsAtQPs(elInfo, quad); - for (int i = 0; i < numVecs; i++) { - vecsAtQPs_[i] = subAssembler->getVectorAtQPs(vecs_[i], elInfo, quad); + for (int i = 0; i < nVecs; i++) { + vecsAtQPs_[i] = getVectorAtQPs(vecs_[i], elInfo, subAssembler, quad); } - for (int i = 0; i < numGrads; i++) { - gradsAtQPs_[i] = subAssembler->getGradientsAtQPs(grads_[i], elInfo, quad); + for (int i = 0; i < nGrads; i++) { + gradsAtQPs_[i] = getGradientsAtQPs(grads_[i], elInfo, subAssembler, quad); } } void GeneralParametric_SOT::getLALt(const ElInfo *elInfo, - int numPoints, + int nPoints, DimMat<double> **LALt) const { - int numVecs = static_cast<int>(vecs_.size()); - int numGrads = static_cast<int>(grads_.size()); + int nVecs = static_cast<int>(vecs_.size()); + int nGrads = static_cast<int>(grads_.size()); - std::vector<double> vecsArg(numVecs); - std::vector<WorldVector<double> > gradsArg(numGrads); + std::vector<double> vecsArg(nVecs); + std::vector<WorldVector<double> > gradsArg(nGrads); const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); - for (int iq = 0; iq < numPoints; iq++) { - for (int i = 0; i < numVecs; i++) { + for (int iq = 0; iq < nPoints; iq++) { + for (int i = 0; i < nVecs; i++) { vecsArg[i] = vecsAtQPs_[i][iq]; } - for (int i = 0; i < numGrads; i++) { + for (int i = 0; i < nGrads; i++) { gradsArg[i] = gradsAtQPs_[i][iq]; } lalt(Lambda, (*f_)(coordsAtQPs_[iq], elementNormal_, vecsArg, gradsArg), @@ -2026,27 +2707,27 @@ namespace AMDiS { } } - void GeneralParametric_SOT::eval(int numPoints, - const double *uhAtQP, + void GeneralParametric_SOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, double factor) const { int dow = Global::getGeo(WORLD); - int numVecs = static_cast<int>(vecs_.size()); - int numGrads = static_cast<int>(grads_.size()); + int nVecs = static_cast<int>(vecs_.size()); + int nGrads = static_cast<int>(grads_.size()); - std::vector<double> vecsArg(numVecs); - std::vector<WorldVector<double> > gradsArg(numGrads); + std::vector<double> vecsArg(nVecs); + std::vector<WorldVector<double> > gradsArg(nGrads); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double resultQP = 0.0; - for (int i = 0; i < numVecs; i++) { + for (int i = 0; i < nVecs; i++) { vecsArg[i] = vecsAtQPs_[i][iq]; } - for (int i = 0; i < numGrads; i++) { + for (int i = 0; i < nGrads; i++) { gradsArg[i] = gradsAtQPs_[i][iq]; } @@ -2068,23 +2749,23 @@ namespace AMDiS { } } - void GeneralParametric_SOT::weakEval(int numPoints, + void GeneralParametric_SOT::weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const { - int numVecs = static_cast<int>(vecs_.size()); - int numGrads = static_cast<int>(grads_.size()); + int nVecs = static_cast<int>(vecs_.size()); + int nGrads = static_cast<int>(grads_.size()); - std::vector<double> vecsArg(numVecs); - std::vector<WorldVector<double> > gradsArg(numGrads); + std::vector<double> vecsArg(nVecs); + std::vector<WorldVector<double> > gradsArg(nGrads); if (grdUhAtQP) { WorldMatrix<double> A; - for (int iq = 0; iq < numPoints; iq++) { - for (int i = 0; i < numVecs; i++) { + for (int iq = 0; iq < nPoints; iq++) { + for (int i = 0; i < nVecs; i++) { vecsArg[i] = vecsAtQPs_[i][iq]; } - for (int i = 0; i < numGrads; i++) { + for (int i = 0; i < nGrads; i++) { gradsArg[i] = gradsAtQPs_[i][iq]; } A = (*f_)(coordsAtQPs_[iq], elementNormal_, vecsArg, gradsArg); @@ -2097,64 +2778,64 @@ namespace AMDiS { SubAssembler* subAssembler, Quadrature *quad) { - int numVecs = static_cast<int>(vecs_.size()); - int numGrads = static_cast<int>(grads_.size()); + int nVecs = static_cast<int>(vecs_.size()); + int nGrads = static_cast<int>(grads_.size()); elInfo->getElementNormal(elementNormal_); coordsAtQPs_ = subAssembler->getCoordsAtQPs(elInfo, quad); - for (int i = 0; i < numVecs; i++) { - vecsAtQPs_[i] = subAssembler->getVectorAtQPs(vecs_[i], elInfo, quad); + for (int i = 0; i < nVecs; i++) { + vecsAtQPs_[i] = getVectorAtQPs(vecs_[i], elInfo, subAssembler, quad); } - for (int i = 0; i < numGrads; i++) { - gradsAtQPs_[i] = subAssembler->getGradientsAtQPs(grads_[i], elInfo, quad); + for (int i = 0; i < nGrads; i++) { + gradsAtQPs_[i] = getGradientsAtQPs(grads_[i], elInfo, subAssembler, quad); } } void GeneralParametric_FOT::getLb(const ElInfo *elInfo, - int numPoints, + int nPoints, VectorOfFixVecs<DimVec<double> >& result) const { - int numVecs = static_cast<int>(vecs_.size()); - int numGrads = static_cast<int>(grads_.size()); + int nVecs = static_cast<int>(vecs_.size()); + int nGrads = static_cast<int>(grads_.size()); - std::vector<double> vecsArg(numVecs); - std::vector<WorldVector<double> > gradsArg(numGrads); + std::vector<double> vecsArg(nVecs); + std::vector<WorldVector<double> > gradsArg(nGrads); const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); - for (int iq = 0; iq < numPoints; iq++) { - for (int i = 0; i < numVecs; i++) { + for (int iq = 0; iq < nPoints; iq++) { + for (int i = 0; i < nVecs; i++) { vecsArg[i] = vecsAtQPs_[i][iq]; } - for (int i = 0; i < numGrads; i++) { + for (int i = 0; i < nGrads; i++) { gradsArg[i] = gradsAtQPs_[i][iq]; } lb(Lambda, (*f_)(coordsAtQPs_[iq], elementNormal_, vecsArg, gradsArg), result[iq], 1.0); } } - void GeneralParametric_FOT::eval(int numPoints, - const double *uhAtQP, + void GeneralParametric_FOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, double factor) const { int dow = Global::getGeo(WORLD); - int numVecs = static_cast<int>(vecs_.size()); - int numGrads = static_cast<int>(grads_.size()); + int nVecs = static_cast<int>(vecs_.size()); + int nGrads = static_cast<int>(grads_.size()); - std::vector<double> vecsArg(numVecs); - std::vector<WorldVector<double> > gradsArg(numGrads); + std::vector<double> vecsArg(nVecs); + std::vector<WorldVector<double> > gradsArg(nGrads); if (grdUhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double resultQP = 0.0; - for (int i = 0; i < numVecs; i++) { + for (int i = 0; i < nVecs; i++) { vecsArg[i] = vecsAtQPs_[i][iq]; } - for (int i = 0; i < numGrads; i++) { + for (int i = 0; i < nGrads; i++) { gradsArg[i] = gradsAtQPs_[i][iq]; } @@ -2171,57 +2852,57 @@ namespace AMDiS { void GeneralParametric_ZOT::initElement(const ElInfo* elInfo, SubAssembler* subAssembler, Quadrature *quad) { - int numVecs = static_cast<int>(vecs_.size()); - int numGrads = static_cast<int>(grads_.size()); + int nVecs = static_cast<int>(vecs_.size()); + int nGrads = static_cast<int>(grads_.size()); elInfo->getElementNormal(elementNormal_); coordsAtQPs_ = subAssembler->getCoordsAtQPs(elInfo, quad); - for (int i = 0; i < numVecs; i++) { - vecsAtQPs_[i] = subAssembler->getVectorAtQPs(vecs_[i], elInfo, quad); + for (int i = 0; i < nVecs; i++) { + vecsAtQPs_[i] = getVectorAtQPs(vecs_[i], elInfo, subAssembler, quad); } - for (int i = 0; i < numGrads; i++) { - gradsAtQPs_[i] = subAssembler->getGradientsAtQPs(grads_[i], elInfo, quad); + for (int i = 0; i < nGrads; i++) { + gradsAtQPs_[i] = getGradientsAtQPs(grads_[i], elInfo, subAssembler, quad); } } - void GeneralParametric_ZOT::getC(const ElInfo *, int numPoints, double *C) const + void GeneralParametric_ZOT::getC(const ElInfo *, int nPoints, double *C) const { - int numVecs = static_cast<int>(vecs_.size()); - int numGrads = static_cast<int>(grads_.size()); + int nVecs = static_cast<int>(vecs_.size()); + int nGrads = static_cast<int>(grads_.size()); - std::vector<double> vecsArg(numVecs); - std::vector<WorldVector<double> > gradsArg(numGrads); + std::vector<double> vecsArg(nVecs); + std::vector<WorldVector<double> > gradsArg(nGrads); - for (int iq = 0; iq < numPoints; iq++) { - for (int i = 0; i < numVecs; i++) { + for (int iq = 0; iq < nPoints; iq++) { + for (int i = 0; i < nVecs; i++) { vecsArg[i] = vecsAtQPs_[i][iq]; } - for (int i = 0; i < numGrads; i++) { + for (int i = 0; i < nGrads; i++) { gradsArg[i] = gradsAtQPs_[i][iq]; } C[iq] += (*f_)(coordsAtQPs_[iq], elementNormal_, vecsArg, gradsArg); } } - void GeneralParametric_ZOT::eval(int numPoints, - const double *uhAtQP, + void GeneralParametric_ZOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, double fac) const { - int numVecs = static_cast<int>(vecs_.size()); - int numGrads = static_cast<int>(grads_.size()); + int nVecs = static_cast<int>(vecs_.size()); + int nGrads = static_cast<int>(grads_.size()); - std::vector<double> vecsArg(numVecs); - std::vector<WorldVector<double> > gradsArg(numGrads); + std::vector<double> vecsArg(nVecs); + std::vector<WorldVector<double> > gradsArg(nGrads); - for (int iq = 0; iq < numPoints; iq++) { - for (int i = 0; i < numVecs; i++) { + for (int iq = 0; iq < nPoints; iq++) { + for (int i = 0; i < nVecs; i++) { vecsArg[i] = vecsAtQPs_[i][iq]; } - for (int i = 0; i < numGrads; i++) { + for (int i = 0; i < nGrads; i++) { gradsArg[i] = gradsAtQPs_[i][iq]; } result[iq] += fac * (*f_)(coordsAtQPs_[iq], elementNormal_, vecsArg, gradsArg) * uhAtQP[iq]; @@ -2234,18 +2915,18 @@ namespace AMDiS { { int size = static_cast<int>(vecs.size()); for (int i = 0; i < size; i++) { - gradsAtQPs[i] = subAssembler->getGradientsAtQPs(vecs[i], elInfo, quad); + gradsAtQPs[i] = getGradientsAtQPs(vecs[i], elInfo, subAssembler, quad); } - vecAtQPs = subAssembler->getVectorAtQPs(vec, elInfo, quad); + vecAtQPs = getVectorAtQPs(vec, elInfo, subAssembler, quad); } - void VecAndVecOfGradientsAtQP_ZOT::getC(const ElInfo *, int numPoints, + void VecAndVecOfGradientsAtQP_ZOT::getC(const ElInfo *, int nPoints, double *C) const { int size = static_cast<int>(vecs.size()); std::vector<WorldVector<double>*> arg(size); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { for (int i = 0; i < size; i++) { arg[i] = &(gradsAtQPs[i][iq]); } @@ -2253,8 +2934,8 @@ namespace AMDiS { } } - void VecAndVecOfGradientsAtQP_ZOT::eval(int numPoints, - const double *uhAtQP, + void VecAndVecOfGradientsAtQP_ZOT::eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -2263,7 +2944,7 @@ namespace AMDiS { int size = static_cast<int>(vecs.size()); std::vector<WorldVector<double>*> arg(size); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { for (int i = 0; i < size; i++) { arg[i] = &(gradsAtQPs[i][iq]); } @@ -2275,18 +2956,28 @@ namespace AMDiS { SubAssembler* subAssembler, Quadrature *quad) { - vecAtQPs = subAssembler->getVectorAtQPs(vec1, elInfo, quad); - gradAtQPs = subAssembler->getGradientsAtQPs(vec2, elInfo, quad); + vecAtQPs = getVectorAtQPs(vec1, elInfo, subAssembler, quad); + gradAtQPs = getGradientsAtQPs(vec2, elInfo, subAssembler, quad); + } + + void VecGrad_FOT::initElement(const ElInfo* smallElInfo, + const ElInfo* largeElInfo, + SubAssembler* subAssembler, + Quadrature *quad) + { + vecAtQPs = getVectorAtQPs(vec1, smallElInfo, largeElInfo, subAssembler, quad); + gradAtQPs = getGradientsAtQPs(vec2, smallElInfo, largeElInfo, subAssembler, quad); } - void VecGrad_FOT::getLb(const ElInfo *elInfo, int numPoints, VectorOfFixVecs<DimVec<double> >& Lb) const { + void VecGrad_FOT::getLb(const ElInfo *elInfo, int nPoints, + VectorOfFixVecs<DimVec<double> >& Lb) const { const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { lb(Lambda, (*vecFct)(vecAtQPs[iq], gradAtQPs[iq]), Lb[iq], 1.0); } } - void VecGrad_FOT::eval(int numPoints, + void VecGrad_FOT::eval(int nPoints, const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, @@ -2294,7 +2985,7 @@ namespace AMDiS { double factor) const { if (grdUhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { WorldVector<double> b = (*vecFct)(vecAtQPs[iq], gradAtQPs[iq]); result[iq] += b * grdUhAtQP[iq] * factor; } diff --git a/AMDiS/src/Operator.h b/AMDiS/src/Operator.h index fa863da028b8e3cac11a6753a8bc2c7ce92f616c..998a7b6c6a377a8a271df925d4ed93279e595ed8 100644 --- a/AMDiS/src/Operator.h +++ b/AMDiS/src/Operator.h @@ -67,55 +67,53 @@ namespace AMDiS { * degree_ is used to determine the degree of the needed quadrature * for the assemblage. */ - OperatorTerm(int degree_) + OperatorTerm(int deg) : properties(0), - degree(degree_) + degree(deg), + auxFESpaces(0) {} - /** \brief - * Destructor. - */ - virtual ~OperatorTerm() - {} + /// Destructor. + virtual ~OperatorTerm() {} /** \brief * Virtual method. It's called by SubAssembler::initElement() for - * each OperatorTerm belonging to this SubAssembler. Here e.g. vectors - * and coordinates at quadrature points can be calculated. + * each OperatorTerm belonging to this SubAssembler. E.g., vectors + * and coordinates at quadrature points can be calculated here. */ virtual void initElement(const ElInfo*, SubAssembler*, Quadrature *quad = NULL) {} - /** \brief - * Specifies whether the matrix of the term is symmetric - */ + virtual void initElement(const ElInfo* largeElInfo, + const ElInfo* smallElInfo, + SubAssembler*, + Quadrature *quad = NULL) + {} + + /// Returs \auxFESpaces, the list of all aux fe spaces the operator makes use off. + std::vector<const FiniteElemSpace*>& getAuxFESpaces() { + return auxFESpaces; + } + + /// Specifies whether the matrix of the term is symmetric void setSymmetric(bool symm); - /** \brief - * Returns true, if the term is piecewise constant, returns false otherwise - */ + /// Returns true, if the term is piecewise constant, returns false otherwise inline bool isPWConst() { return (degree == 0); } - /** \brief - * Returns true, if the term has a symmetric matrix, - * returns false otherwise. - */ + /// Returns true, if the term has a symmetric matrix, returns false otherwise. bool isSymmetric(); - /** \brief - * Returns \ref degree. - */ + /// Returns \ref degree. inline int getDegree() { return degree; } - /** \brief - * Evaluation of the OperatorTerm at all quadrature points. - */ + /// Evaluation of the OperatorTerm at all quadrature points. virtual void eval(int nPoints, const double *uhAtQP, const WorldVector<double> *grdUhAtQP, @@ -123,10 +121,40 @@ namespace AMDiS { double *result, double factor) const = 0; - protected: /** \brief - * Evaluation of \f$ \Lambda \cdot A \cdot \Lambda^t\f$. + * Determines the value of a dof vector at the quadrature points of a given + * element. It is used by all VecAtQP like operator terms. */ + double *getVectorAtQPs(DOFVectorBase<double>* vec, + const ElInfo* elInfo, + SubAssembler* subAssembler, + Quadrature *quad); + + /** \brief + * Determines the value of a dof vector at the quadrature points of a given + * element. This function is used, if an operator is assembled on two different + * meshes using the dual traverse. The element, i.e. the small or the large one, + * is choosen, which corresponds to the mesh the dof vector is defined on. + */ + double *getVectorAtQPs(DOFVectorBase<double>* vec, + const ElInfo* smallElInfo, + const ElInfo* largeElInfo, + SubAssembler* subAssembler, + Quadrature *quad); + + WorldVector<double>* getGradientsAtQPs(DOFVectorBase<double>* vec, + const ElInfo* elInfo, + SubAssembler* subAssembler, + Quadrature *quad); + + WorldVector<double>* getGradientsAtQPs(DOFVectorBase<double>* vec, + const ElInfo* smallElInfo, + const ElInfo* largeElInfo, + SubAssembler* subAssembler, + Quadrature *quad); + + protected: + /// Evaluation of \f$ \Lambda \cdot A \cdot \Lambda^t\f$. static void lalt(const DimVec<WorldVector<double> >& Lambda, const WorldMatrix<double>& matrix, DimMat<double>& LALt, @@ -151,9 +179,7 @@ namespace AMDiS { DimMat<double>& LALt, double factor); - /** \brief - * Evaluation of \f$ \Lambda \cdot b\f$. - */ + /// Evaluation of \f$ \Lambda \cdot b\f$. static void lb(const DimVec<WorldVector<double> >& Lambda, const WorldVector<double>& b, DimVec<double>& Lb, @@ -182,30 +208,22 @@ namespace AMDiS { } protected: - /** \brief - * Stores the properties of this OperatorTerm - */ + /// Stores the properties of this OperatorTerm Flag properties; - /** \brief - * Polynomial degree of the term. Used to detemine the degree of the - * quadrature. - */ + /// Polynomial degree of the term. Used to detemine the degree of the quadrature. int degree; - /** \brief - * Pointer to the Operator this OperatorTerm belongs to. - */ + /// List off all fe spaces, the operator term makes use off. + std::vector<const FiniteElemSpace*> auxFESpaces; + + /// Pointer to the Operator this OperatorTerm belongs to. Operator* operat; - /** \brief - * Constant Flag for piecewise constant terms - */ + /// Flag for piecewise constant terms static const Flag PW_CONST; - /** \brief - * Constant Flag for symmetric terms - */ + /// Flag for symmetric terms static const Flag SYMMETRIC; friend class SubAssembler; @@ -228,9 +246,7 @@ namespace AMDiS { class SecondOrderTerm : public OperatorTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. SecondOrderTerm(int deg) : OperatorTerm(deg) {} @@ -257,8 +273,6 @@ namespace AMDiS { }; - // ============================================================================ - /** * \ingroup Assembler * @@ -268,9 +282,7 @@ namespace AMDiS { class Laplace_SOT : public SecondOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. Laplace_SOT() : SecondOrderTerm(0) { @@ -280,11 +292,11 @@ namespace AMDiS { /** \brief * Implenetation of SecondOrderTerm::getLALt(). */ - inline void getLALt(const ElInfo *elInfo, int numPoints, DimMat<double> **LALt) const + inline void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const { const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { l1lt(Lambda, *(LALt[iq]), 1.0); } } @@ -327,8 +339,6 @@ namespace AMDiS { } }; - // ============================================================================ - /** * \ingroup Assembler * @@ -339,9 +349,7 @@ namespace AMDiS { class FactorLaplace_SOT : public SecondOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. FactorLaplace_SOT(double f) : SecondOrderTerm(0) { @@ -351,9 +359,7 @@ namespace AMDiS { setSymmetric(true); } - /** \brief - * Constructor. - */ + /// Constructor. FactorLaplace_SOT(double *fptr) : SecondOrderTerm(0), factor(fptr) @@ -364,10 +370,10 @@ namespace AMDiS { /** \brief * Implements SecondOrderTerm::getLALt(). */ - inline void getLALt(const ElInfo *elInfo, int numPoints, DimMat<double> **LALt) const + inline void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const { const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); - for (int iq = 0; iq < numPoints; iq++) + for (int iq = 0; iq < nPoints; iq++) l1lt(Lambda, *(LALt[iq]), (*factor)); } @@ -375,7 +381,7 @@ namespace AMDiS { /** \brief * Implenetation of SecondOrderTerm::eval(). */ - void eval(int numPoints, + void eval(int nPoints, const double *, const WorldVector<double> *, const WorldMatrix<double> *D2UhAtQP, @@ -385,7 +391,7 @@ namespace AMDiS { int dow = Global::getGeo(WORLD); if (D2UhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double resultQP = 0.0; for (int i = 0; i < dow; i++) { resultQP += D2UhAtQP[iq][i][i]; @@ -398,12 +404,12 @@ namespace AMDiS { /** \brief * Implenetation of SecondOrderTerm::weakEval(). */ - void weakEval(int numPoints, + void weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const { if (grdUhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { axpy(*factor, grdUhAtQP[iq], result[iq]); } } @@ -416,8 +422,6 @@ namespace AMDiS { double *factor; }; - // ============================================================================ - /** * \ingroup Assembler * @@ -429,21 +433,11 @@ namespace AMDiS { class MatrixFct_SOT : public SecondOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. MatrixFct_SOT(DOFVectorBase<double> *dv, AbstractFunction<WorldMatrix<double>, double> *fct, AbstractFunction<WorldVector<double>, WorldMatrix<double> > *div, - bool sym = false) - : SecondOrderTerm(fct->getDegree()), - vec(dv), - matrixFct(fct), - divFct(div), - symmetric(sym) - { - setSymmetric(symmetric); - } + bool sym = false); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -454,13 +448,13 @@ namespace AMDiS { /** \brief * Implements SecondOrderTerm::getLALt(). */ - void getLALt(const ElInfo *elInfo, int numPoints, DimMat<double> **LALt) const; + void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const; /** \brief * Implenetation of SecondOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -469,7 +463,7 @@ namespace AMDiS { /** \brief * Implenetation of SecondOrderTerm::weakEval(). */ - void weakEval(int numPoints, + void weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const; @@ -489,6 +483,9 @@ namespace AMDiS { */ AbstractFunction<WorldMatrix<double>, double>* matrixFct; + /** \brief + * + */ AbstractFunction<WorldVector<double>, WorldMatrix<double> >* divFct; /** \brief @@ -497,8 +494,6 @@ namespace AMDiS { bool symmetric; }; - // ============================================================================ - /** * \ingroup Assembler * @@ -508,12 +503,9 @@ namespace AMDiS { */ class Matrix_SOT : public SecondOrderTerm { public: - /** \brief - * Constructor - */ + /// Constructor Matrix_SOT(WorldMatrix<double> mat) - : SecondOrderTerm(0), - matrix(mat) + : SecondOrderTerm(0), matrix(mat) { symmetric = matrix.isSymmetric(); setSymmetric(symmetric); @@ -522,19 +514,19 @@ namespace AMDiS { /** \brief * Implements SecondOrderTerm::getLALt(). */ - inline void getLALt(const ElInfo *elInfo, int numPoints, DimMat<double> **LALt) const{ + inline void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const{ const DimVec<WorldVector<double> >& Lambda = elInfo->getGrdLambda(); //double det = elInfo->getDet(); int iq; - for(iq = 0; iq < numPoints; iq++) + for(iq = 0; iq < nPoints; iq++) lalt(Lambda, matrix, *(LALt[iq]), symmetric, 1.0); } /** \brief * Implenetation of SecondOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -543,7 +535,7 @@ namespace AMDiS { /** \brief * Implenetation of SecondOrderTerm::weakEval(). */ - void weakEval(int numPoints, + void weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const; @@ -559,8 +551,6 @@ namespace AMDiS { bool symmetric; }; - // ============================================================================ - /** * \ingroup Assembler * @@ -572,13 +562,9 @@ namespace AMDiS { class FactorIJ_SOT : public SecondOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. FactorIJ_SOT(int x_i, int x_j, double f) - : SecondOrderTerm(0), - xi(x_i), - xj(x_j) + : SecondOrderTerm(0), xi(x_i), xj(x_j) { factor = new double; *factor = f; @@ -586,14 +572,9 @@ namespace AMDiS { setSymmetric(xi == xj); } - /** \brief - * Constructor. - */ + /// Constructor. FactorIJ_SOT(int x_i, int x_j, double *fptr) - : SecondOrderTerm(0), - xi(x_i), - xj(x_j), - factor(fptr) + : SecondOrderTerm(0), xi(x_i), xj(x_j), factor(fptr) { setSymmetric(xi == xj); } @@ -601,18 +582,18 @@ namespace AMDiS { /** \brief * Implements SecondOrderTerm::getLALt(). */ - inline void getLALt(const ElInfo *elInfo, int numPoints, DimMat<double> **LALt) const + inline void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const { const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); int iq; - for(iq = 0; iq < numPoints; iq++) + for(iq = 0; iq < nPoints; iq++) lalt_kl(Lambda, xi, xj, *(LALt[iq]), (*factor)); } /** \brief * Implenetation of SecondOrderTerm::eval(). */ - void eval(int numPoints, + void eval(int nPoints, const double *, const WorldVector<double> *, const WorldMatrix<double> *D2UhAtQP, @@ -621,7 +602,7 @@ namespace AMDiS { { int iq; if(D2UhAtQP) { - for(iq = 0; iq < numPoints; iq++) { + for(iq = 0; iq < nPoints; iq++) { result[iq] += (*factor) * D2UhAtQP[iq][xi][xj] * fac; } } @@ -630,13 +611,13 @@ namespace AMDiS { /** \brief * Implenetation of SecondOrderTerm::weakEval(). */ - void weakEval(int numPoints, + void weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const { if(grdUhAtQP) { int iq; - for(iq = 0; iq < numPoints; iq++) { + for(iq = 0; iq < nPoints; iq++) { result[iq][xi] += (*factor) * grdUhAtQP[iq][xj]; } } @@ -654,8 +635,6 @@ namespace AMDiS { double *factor; }; - // ============================================================================ - /** * \ingroup Assembler * @@ -666,59 +645,43 @@ namespace AMDiS { */ class VecAtQP_SOT : public SecondOrderTerm { public: - /** \brief - * Constructor. - */ - VecAtQP_SOT(DOFVectorBase<double> *dv, - AbstractFunction<double, double> *f_) - : SecondOrderTerm(f_->getDegree()), vec(dv), f(f_) - { - setSymmetric(true); - } + /// Constructor. + VecAtQP_SOT(DOFVectorBase<double> *dv, AbstractFunction<double, double> *af); - /** \brief - * Implementation of \ref OperatorTerm::initElement(). - */ + /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, Quadrature *quad = NULL); - /** \brief - * Implements SecondOrderTerm::getLALt(). - */ - void getLALt(const ElInfo *elInfo, int numPoints, DimMat<double> **LALt) const; + /// Implementation of \ref OperatorTerm::initElement() for multilpe meshes. + void initElement(const ElInfo* smallElInfo, + const ElInfo* largeElInfo, + SubAssembler* subAssembler, + Quadrature *quad = NULL); - /** \brief - * Implenetation of SecondOrderTerm::eval(). - */ - void eval(int numPoints, - const double *uhAtQP, + /// Implements SecondOrderTerm::getLALt(). + void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const; + + /// Implenetation of SecondOrderTerm::eval(). + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, double factor) const; - /** \brief - * Implenetation of SecondOrderTerm::weakEval(). - */ - void weakEval(int numPoints, + /// Implenetation of SecondOrderTerm::weakEval(). + void weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const; protected: - /** \brief - * DOFVector to be evaluated at quadrature points. - */ + /// DOFVector to be evaluated at quadrature points. DOFVectorBase<double>* vec; - /** \brief - * Pointer to an array containing the DOFVector evaluated at quadrature - * points. - */ + /// Pointer to an array containing the DOFVector evaluated at quadrature points. double* vecAtQPs; - /** \brief - * Function evaluated at \ref vecAtQPs. - */ + /// Function evaluated at \ref vecAtQPs. AbstractFunction<double, double> *f; }; @@ -732,18 +695,9 @@ namespace AMDiS { */ class Vec2AtQP_SOT : public SecondOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. Vec2AtQP_SOT(DOFVectorBase<double> *dv1, DOFVectorBase<double> *dv2, - BinaryAbstractFunction<double, double, double> *f_) - : SecondOrderTerm(f_->getDegree()), - vec1(dv1), - vec2(dv2), - f(f_) - { - setSymmetric(true); - } + BinaryAbstractFunction<double, double, double> *af); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -754,12 +708,12 @@ namespace AMDiS { /** \brief * Implements SecondOrderTerm::getLALt(). */ - void getLALt(const ElInfo *elInfo, int numPoints, DimMat<double> **LALt) const; + void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const; /** \brief * Implenetation of SecondOrderTerm::eval(). */ - void eval(int numPoints, + void eval(int nPoints, const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, @@ -769,7 +723,7 @@ namespace AMDiS { /** \brief * Implenetation of SecondOrderTerm::weakEval(). */ - void weakEval(int numPoints, + void weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const; @@ -793,8 +747,6 @@ namespace AMDiS { BinaryAbstractFunction<double, double, double> *f; }; - // ============================================================================ - /** * \ingroup Assembler * @@ -804,11 +756,9 @@ namespace AMDiS { */ class CoordsAtQP_SOT : public SecondOrderTerm { public: - /** \brief - * Constructor. - */ - CoordsAtQP_SOT(AbstractFunction<double, WorldVector<double> > *g_) - : SecondOrderTerm(g_->getDegree()), g(g_) + /// Constructor. + CoordsAtQP_SOT(AbstractFunction<double, WorldVector<double> > *af) + : SecondOrderTerm(af->getDegree()), g(af) { setSymmetric(true); } @@ -822,13 +772,13 @@ namespace AMDiS { /** \brief * Implements SecondOrderTerm::getLALt(). */ - void getLALt(const ElInfo *elInfo, int numPoints, DimMat<double> **LALt) const; + void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const; /** \brief * Implenetation of SecondOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -837,7 +787,7 @@ namespace AMDiS { /** \brief * Implenetation of SecondOrderTerm::weakEval(). */ - void weakEval(int numPoints, + void weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const; @@ -854,8 +804,6 @@ namespace AMDiS { AbstractFunction<double, WorldVector<double> > *g; }; - // ============================================================================ - /** * \ingroup Assembler * @@ -867,17 +815,11 @@ namespace AMDiS { class MatrixGradient_SOT : public SecondOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. MatrixGradient_SOT(DOFVectorBase<double> *dv, - AbstractFunction<WorldMatrix<double>, WorldVector<double> > *f_, - AbstractFunction<WorldVector<double>, WorldMatrix<double> > *divFct_, - bool symm = false) - : SecondOrderTerm(f_->getDegree()), vec(dv), f(f_), divFct(divFct_), symmetric(symm) - { - setSymmetric(symmetric); - } + AbstractFunction<WorldMatrix<double>, WorldVector<double> > *af, + AbstractFunction<WorldVector<double>, WorldMatrix<double> > *divAf, + bool symm = false); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -888,13 +830,13 @@ namespace AMDiS { /** \brief * Implements SecondOrderTerm::getLALt(). */ - void getLALt(const ElInfo *elInfo, int numPoints, DimMat<double> **LALt) const; + void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const; /** \brief * Implenetation of SecondOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -903,7 +845,7 @@ namespace AMDiS { /** \brief * Implenetation of SecondOrderTerm::weakEval(). */ - void weakEval(int numPoints, + void weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const; @@ -929,8 +871,6 @@ namespace AMDiS { bool symmetric; }; - // ============================================================================ - /** * \ingroup Assembler * @@ -942,14 +882,9 @@ namespace AMDiS { class FctGradient_SOT : public SecondOrderTerm { public: - /** \brief - * Constructor. - */ - FctGradient_SOT(DOFVectorBase<double> *dv, - AbstractFunction<double, WorldVector<double> > *f_) - : SecondOrderTerm(f_->getDegree()), vec(dv), f(f_) - { - } + /// Constructor. + FctGradient_SOT(DOFVectorBase<double> *dv, + AbstractFunction<double, WorldVector<double> > *af); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -960,13 +895,13 @@ namespace AMDiS { /** \brief * Implements SecondOrderTerm::getLALt(). */ - void getLALt(const ElInfo *elInfo, int numPoints, DimMat<double> **LALt) const; + void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const; /** \brief * Implenetation of SecondOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -975,7 +910,7 @@ namespace AMDiS { /** \brief * Implenetation of SecondOrderTerm::weakEval(). */ - void weakEval(int numPoints, + void weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const; @@ -995,10 +930,6 @@ namespace AMDiS { }; - // Ergaenzung Andreas - - // ============================================================================ - /** * \ingroup Assembler * @@ -1010,15 +941,9 @@ namespace AMDiS { class VecAndGradientAtQP_SOT : public SecondOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. VecAndGradientAtQP_SOT(DOFVectorBase<double> *dv, - BinaryAbstractFunction<double, double, - WorldVector<double> > *f_) - : SecondOrderTerm(f_->getDegree()), vec(dv), f(f_) - { - } + BinaryAbstractFunction<double, double, WorldVector<double> > *af); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -1029,13 +954,13 @@ namespace AMDiS { /** \brief * Implements SecondOrderTerm::getLALt(). */ - void getLALt(const ElInfo *elInfo, int numPoints, DimMat<double> **LALt) const; + void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const; /** \brief * Implenetation of SecondOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -1044,7 +969,7 @@ namespace AMDiS { /** \brief * Implenetation of SecondOrderTerm::weakEval(). */ - void weakEval(int numPoints, + void weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const; @@ -1064,8 +989,6 @@ namespace AMDiS { WorldVector<double>* gradAtQPs; }; - // ============================================================================ - /** * \ingroup Assembler * @@ -1077,20 +1000,11 @@ namespace AMDiS { class VecMatrixGradientAtQP_SOT : public SecondOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. VecMatrixGradientAtQP_SOT(DOFVectorBase<double> *dv, - BinaryAbstractFunction<WorldMatrix<double>, - double, WorldVector<double> > *f_, - AbstractFunction<WorldVector<double>, - WorldMatrix<double> > *divFct_, - bool symm = false) - : SecondOrderTerm(f_->getDegree()), vec(dv), f(f_), - divFct(divFct_), symmetric(symm) - { - setSymmetric(symmetric); - } + BinaryAbstractFunction<WorldMatrix<double>, double, WorldVector<double> > *af, + AbstractFunction<WorldVector<double>, WorldMatrix<double> > *divAf, + bool symm = false); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -1101,13 +1015,13 @@ namespace AMDiS { /** \brief * Implements SecondOrderTerm::getLALt(). */ - void getLALt(const ElInfo *elInfo, int numPoints, DimMat<double> **LALt) const; + void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const; /** \brief * Implenetation of SecondOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -1116,32 +1030,30 @@ namespace AMDiS { /** \brief * Implenetation of SecondOrderTerm::weakEval(). */ - void weakEval(int numPoints, + void weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const; - + protected: DOFVectorBase<double>* vec; - + /** \brief * Function wich maps \ref gradAtQPs to a double. */ BinaryAbstractFunction<WorldMatrix<double>, double, WorldVector<double> > *f; - - AbstractFunction<WorldVector<double>, WorldMatrix<double> > *divFct; - - /** \brief - * Pointer to a WorldVector<double> array containing the gradients of the DOFVector - * at each quadrature point. - */ - double* vecAtQPs; - WorldVector<double>* gradAtQPs; - - bool symmetric; -}; - - // ============================================================================ + + AbstractFunction<WorldVector<double>, WorldMatrix<double> > *divFct; + + /** \brief + * Pointer to a WorldVector<double> array containing the gradients of the DOFVector + * at each quadrature point. + */ + double* vecAtQPs; + WorldVector<double>* gradAtQPs; + + bool symmetric; + }; /** * \ingroup Assembler @@ -1154,16 +1066,10 @@ namespace AMDiS { class VecGradCoordsAtQP_SOT : public SecondOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. VecGradCoordsAtQP_SOT(DOFVectorBase<double> *dv, TertiaryAbstractFunction<double, double, - WorldVector<double>, - WorldVector<double> > *f_) - : SecondOrderTerm(f_->getDegree()), vec(dv), f(f_) - { - } + WorldVector<double>, WorldVector<double> > *af); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -1174,13 +1080,13 @@ namespace AMDiS { /** \brief * Implements SecondOrderTerm::getLALt(). */ - void getLALt(const ElInfo *elInfo, int numPoints, DimMat<double> **LALt) const; + void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const; /** \brief * Implenetation of SecondOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -1189,7 +1095,7 @@ namespace AMDiS { /** \brief * Implenetation of SecondOrderTerm::weakEval(). */ - void weakEval(int numPoints, + void weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const; @@ -1213,8 +1119,6 @@ namespace AMDiS { }; - // ============================================================================ - /** * \ingroup Assembler * @@ -1225,15 +1129,9 @@ namespace AMDiS { */ class VecAndCoordsAtQP_SOT : public SecondOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. VecAndCoordsAtQP_SOT(DOFVectorBase<double> *dv, - BinaryAbstractFunction<double, double, WorldVector<double> > *f_) - : SecondOrderTerm(f_->getDegree()), vec(dv), f(f_) - { - setSymmetric(true); - } + BinaryAbstractFunction<double, double, WorldVector<double> > *af); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -1244,16 +1142,16 @@ namespace AMDiS { /** \brief * Implements SecondOrderTerm::eval(). */ - void getLALt(const ElInfo *elInfo, int numPoints, DimMat<double> **LALt) const; + void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const; - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, double factor) const; - void weakEval(int numPoints, + void weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const; @@ -1277,8 +1175,6 @@ namespace AMDiS { BinaryAbstractFunction<double, double, WorldVector<double> > *f; }; - // ============================================================================ - /** * \ingroup Assembler * @@ -1290,20 +1186,14 @@ namespace AMDiS { class MatrixGradientAndCoords_SOT : public SecondOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. MatrixGradientAndCoords_SOT(DOFVectorBase<double> *dv, BinaryAbstractFunction<WorldMatrix<double>, WorldVector<double> , - WorldVector<double> > *f_, + WorldVector<double> > *af, AbstractFunction<WorldVector<double>, - WorldMatrix<double> > *divFct_, - bool symm = false) - : SecondOrderTerm(f_->getDegree()), vec(dv), f(f_), divFct(divFct_), symmetric(symm) - { - setSymmetric(symmetric); - } + WorldMatrix<double> > *divAf, + bool symm = false); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -1314,13 +1204,13 @@ namespace AMDiS { /** \brief * Implements SecondOrderTerm::getLALt(). */ - void getLALt(const ElInfo *elInfo, int numPoints, DimMat<double> **LALt) const; + void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const; /** \brief * Implenetation of SecondOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -1329,7 +1219,7 @@ namespace AMDiS { /** \brief * Implenetation of SecondOrderTerm::weakEval(). */ - void weakEval(int numPoints, + void weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const; @@ -1358,13 +1248,10 @@ namespace AMDiS { bool symmetric; }; - // Ende Andreas Ergaenzung - - // ============================================================================ - class General_SOT : public SecondOrderTerm { public: + /// Constructor. General_SOT(std::vector<DOFVectorBase<double>*> vecs, std::vector<DOFVectorBase<double>*> grads, TertiaryAbstractFunction<WorldMatrix<double>, @@ -1373,17 +1260,7 @@ namespace AMDiS { std::vector<WorldVector<double> > > *f, AbstractFunction<WorldVector<double>, WorldMatrix<double> > *divFct, - bool symmetric) - : SecondOrderTerm(f->getDegree()), - vecs_(vecs), - grads_(grads), - f_(f), - divFct_(divFct), - symmetric_(symmetric) - { - vecsAtQPs_.resize(vecs_.size()); - gradsAtQPs_.resize(grads_.size()); - } + bool symmetric); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -1395,13 +1272,13 @@ namespace AMDiS { /** \brief * Implements SecondOrderTerm::getLALt(). */ - void getLALt(const ElInfo *elInfo, int numPoints, DimMat<double> **LALt) const; + void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const; /** \brief * Implenetation of SecondOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -1410,7 +1287,7 @@ namespace AMDiS { /** \brief * Implenetation of SecondOrderTerm::weakEval(). */ - void weakEval(int numPoints, + void weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const; @@ -1436,12 +1313,10 @@ namespace AMDiS { bool symmetric_; }; - - // ============================================================================ - class GeneralParametric_SOT : public SecondOrderTerm { public: + /// Constructor. GeneralParametric_SOT(std::vector<DOFVectorBase<double>*> vecs, std::vector<DOFVectorBase<double>*> grads, QuartAbstractFunction<WorldMatrix<double>, @@ -1451,17 +1326,7 @@ namespace AMDiS { std::vector<WorldVector<double> > > *f, AbstractFunction<WorldVector<double>, WorldMatrix<double> > *divFct, - bool symmetric) - : SecondOrderTerm(f->getDegree()), - vecs_(vecs), - grads_(grads), - f_(f), - divFct_(divFct), - symmetric_(symmetric) - { - vecsAtQPs_.resize(vecs_.size()); - gradsAtQPs_.resize(grads_.size()); - } + bool symmetric); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -1473,13 +1338,13 @@ namespace AMDiS { /** \brief * Implements SecondOrderTerm::getLALt(). */ - void getLALt(const ElInfo *elInfo, int numPoints, DimMat<double> **LALt) const; + void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const; /** \brief * Implenetation of SecondOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -1488,7 +1353,7 @@ namespace AMDiS { /** \brief * Implenetation of SecondOrderTerm::weakEval(). */ - void weakEval(int numPoints, + void weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const; @@ -1530,9 +1395,7 @@ namespace AMDiS { class FirstOrderTerm : public OperatorTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. FirstOrderTerm(int deg) : OperatorTerm(deg) {} @@ -1546,14 +1409,14 @@ namespace AMDiS { * Evaluation of \f$ \Lambda b \f$. */ virtual void getLb(const ElInfo *elInfo, - int numPoints, + int nPoints, VectorOfFixVecs<DimVec<double> >& result) const = 0; /** \brief * Implenetation of FirstOrderTerm::eval(). */ - void eval(int numPoints, - const double *, + void eval(int nPoints, + const double *, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *, double *result, @@ -1562,7 +1425,7 @@ namespace AMDiS { int dow = Global::getGeo(WORLD); if (grdUhAtQP) { - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double resultQP = 0.0; for (int i = 0; i < dow; i++) { resultQP += grdUhAtQP[iq][i]; @@ -1571,9 +1434,8 @@ namespace AMDiS { } } } - }; - // ============================================================================ + }; /** * \ingroup Assembler @@ -1585,9 +1447,7 @@ namespace AMDiS { class Simple_FOT : public FirstOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. Simple_FOT() : FirstOrderTerm(0) {} @@ -1596,19 +1456,17 @@ namespace AMDiS { * Implements FirstOrderTerm::getLb(). */ inline void getLb(const ElInfo *elInfo, - int numPoints, + int nPoints, VectorOfFixVecs<DimVec<double> >& Lb) const { const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { l1(Lambda, Lb[iq], 1.0); } } }; - // ============================================================================ - /** * \ingroup Assembler * @@ -1619,29 +1477,27 @@ namespace AMDiS { class FactorSimple_FOT : public FirstOrderTerm { public: - /** \brief - * Constructors. - */ - FactorSimple_FOT(double f) : - FirstOrderTerm(0) + /// Constructor. + FactorSimple_FOT(double f) + : FirstOrderTerm(0) { - factor = NEW double; + factor = NEW double; *factor = f; } + /// Constructor. FactorSimple_FOT(double *fptr) - : FirstOrderTerm(0), - factor(fptr) + : FirstOrderTerm(0), factor(fptr) {} /** \brief * Implements FirstOrderTerm::getLb(). */ - inline void getLb(const ElInfo *elInfo, int numPoints, VectorOfFixVecs<DimVec<double> >& Lb) const + inline void getLb(const ElInfo *elInfo, int nPoints, VectorOfFixVecs<DimVec<double> >& Lb) const { const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { l1(Lambda, Lb[iq], (*factor)); } } @@ -1653,8 +1509,6 @@ namespace AMDiS { double *factor; }; - // ============================================================================ - /** * \ingroup Assembler * @@ -1664,24 +1518,21 @@ namespace AMDiS { class Vector_FOT : public FirstOrderTerm { public: - /** \brief - * Constructor. - */ - Vector_FOT(WorldVector<double> b_) - : FirstOrderTerm(0), b(b_) - { - } + /// Constructor. + Vector_FOT(WorldVector<double> wv) + : FirstOrderTerm(0), b(wv) + {} /** \brief * Implements FirstOrderTerm::getLb(). */ inline void getLb(const ElInfo *elInfo, - int numPoints, + int nPoints, VectorOfFixVecs<DimVec<double> >&Lb) const { const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { lb(Lambda, b, Lb[iq], 1.0); } } @@ -1689,15 +1540,15 @@ namespace AMDiS { /** \brief * Implements FirstOrderTerm::eval(). */ - void eval(int numPoints, - const double *, + void eval(int nPoints, + const double *, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *, double *result, double factor) const { if (grdUhAtQP) { - for(int iq = 0; iq < numPoints; iq++) { + for(int iq = 0; iq < nPoints; iq++) { result[iq] += b * grdUhAtQP[iq] * factor; } } @@ -1710,8 +1561,6 @@ namespace AMDiS { WorldVector<double> b; }; - // ============================================================================ - /** * \ingroup Assembler * @@ -1721,15 +1570,10 @@ namespace AMDiS { class VecAtQP_FOT : public FirstOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. VecAtQP_FOT(DOFVectorBase<double> *dv, - AbstractFunction<double, double> *f_, - WorldVector<double> *b_) - : FirstOrderTerm(f_->getDegree()), vec(dv), f(f_), b(b_) - { - } + AbstractFunction<double, double> *af, + WorldVector<double> *wv); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -1740,13 +1584,13 @@ namespace AMDiS { /** \brief * Implements FirstOrderTerm::getLb(). */ - void getLb(const ElInfo *elInfo, int numPoints, VectorOfFixVecs<DimVec<double> >& Lb) const; + void getLb(const ElInfo *elInfo, int nPoints, VectorOfFixVecs<DimVec<double> >& Lb) const; /** \brief * Implements FirstOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -1773,8 +1617,6 @@ namespace AMDiS { WorldVector<double> *b; }; - // ============================================================================ - /** * \ingroup Assembler * @@ -1784,11 +1626,9 @@ namespace AMDiS { class CoordsAtQP_FOT : public FirstOrderTerm { public: - /** \brief - * Constructor. - */ - CoordsAtQP_FOT(AbstractFunction<double, WorldVector<double> > *g_) - : FirstOrderTerm(g_->getDegree()), g(g_) + /// Constructor. + CoordsAtQP_FOT(AbstractFunction<double, WorldVector<double> > *af) + : FirstOrderTerm(af->getDegree()), g(af) {} /** \brief @@ -1800,13 +1640,13 @@ namespace AMDiS { /** \brief * Implements FistOrderTerm::getLb(). */ - void getLb(const ElInfo *elInfo, int numPoints,VectorOfFixVecs<DimVec<double> >&Lb) const; + void getLb(const ElInfo *elInfo, int nPoints,VectorOfFixVecs<DimVec<double> >&Lb) const; /** \brief * Implements FirstOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -1833,12 +1673,10 @@ namespace AMDiS { class VecCoordsAtQP_FOT : public FirstOrderTerm { public: - /** \brief - * Constructor. - */ - VecCoordsAtQP_FOT(AbstractFunction<double, WorldVector<double> > *g_, - WorldVector<double> b_) - : FirstOrderTerm(g_->getDegree()), g(g_), b(b_) + /// Constructor. + VecCoordsAtQP_FOT(AbstractFunction<double, WorldVector<double> > *af, + WorldVector<double> wv) + : FirstOrderTerm(af->getDegree()), g(af), b(wv) {} /** \brief @@ -1850,13 +1688,14 @@ namespace AMDiS { /** \brief * Implements FistOrderTerm::getLb(). */ - void getLb(const ElInfo *elInfo, int numPoints,VectorOfFixVecs<DimVec<double> >& Lb) const; + void getLb(const ElInfo *elInfo, int nPoints, + VectorOfFixVecs<DimVec<double> >& Lb) const; /** \brief * Implements FirstOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -1879,8 +1718,6 @@ namespace AMDiS { WorldVector<double> b; }; - // ============================================================================ - /** * \ingroup Assembler * @@ -1890,13 +1727,9 @@ namespace AMDiS { class VectorGradient_FOT : public FirstOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. VectorGradient_FOT(DOFVectorBase<double> *dv, - AbstractFunction<WorldVector<double>, WorldVector<double> > *f_) - : FirstOrderTerm(f_->getDegree()), vec(dv), f(f_) - {} + AbstractFunction<WorldVector<double>, WorldVector<double> > *af); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -1907,13 +1740,14 @@ namespace AMDiS { /** \brief * Implements FirstOrderTerm::getLb(). */ - void getLb(const ElInfo *elInfo, int numPoints, VectorOfFixVecs<DimVec<double> >& Lb) const; + void getLb(const ElInfo *elInfo, int nPoints, + VectorOfFixVecs<DimVec<double> >& Lb) const; /** \brief * Implements FirstOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -1933,8 +1767,6 @@ namespace AMDiS { WorldVector<double> *gradAtQPs; }; - // ============================================================================ - /** * \ingroup Assembler * @@ -1944,13 +1776,9 @@ namespace AMDiS { class VectorFct_FOT : public FirstOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. VectorFct_FOT(DOFVectorBase<double> *dv, - AbstractFunction<WorldVector<double>, double> *vecFct_) - : FirstOrderTerm(vecFct_->getDegree()), vec(dv), vecFct(vecFct_) - {} + AbstractFunction<WorldVector<double>, double> *fct); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -1966,8 +1794,8 @@ namespace AMDiS { /** \brief * Implements FirstOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -1990,9 +1818,6 @@ namespace AMDiS { AbstractFunction<WorldVector<double>, double> *vecFct; }; - - // ============================================================================ - /** * \ingroup Assembler * @@ -2002,11 +1827,9 @@ namespace AMDiS { class VecFctAtQP_FOT : public FirstOrderTerm { public: - /** \brief - * Constructor. - */ - VecFctAtQP_FOT(AbstractFunction<WorldVector<double>, WorldVector<double> > *g_) - : FirstOrderTerm(g_->getDegree()), g(g_) + /// Constructor. + VecFctAtQP_FOT(AbstractFunction<WorldVector<double>, WorldVector<double> > *af) + : FirstOrderTerm(af->getDegree()), g(af) {} /** \brief @@ -2018,13 +1841,13 @@ namespace AMDiS { /** \brief * Implements FistOrderTerm::getLb(). */ - void getLb(const ElInfo *elInfo, int numPoints,VectorOfFixVecs<DimVec<double> >&Lb) const; + void getLb(const ElInfo *elInfo, int nPoints,VectorOfFixVecs<DimVec<double> >&Lb) const; /** \brief * Implements FirstOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -2052,31 +1875,26 @@ namespace AMDiS { class VecGrad_FOT : public FirstOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. VecGrad_FOT(DOFVectorBase<double> *dv1, DOFVectorBase<double> *dv2, - BinaryAbstractFunction<WorldVector<double>, double, - WorldVector<double> > *vecFct_) - : FirstOrderTerm(vecFct_->getDegree()), vec1(dv1), vec2(dv2), vecFct(vecFct_) - {} + BinaryAbstractFunction<WorldVector<double>, double, WorldVector<double> > *fct); - /** \brief - * Implementation of \ref OperatorTerm::initElement(). - */ + /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, Quadrature *quad = NULL); + + /// Implementation of \ref OperatorTerm::initElement() for multilpe meshes. + void initElement(const ElInfo* smallElInfo, + const ElInfo* largeElInfo, + SubAssembler* subAssembler, + Quadrature *quad = NULL); - /** \brief - * Implements FirstOrderTerm::getLb(). - */ + /// Implements FirstOrderTerm::getLb(). void getLb(const ElInfo *elInfo, int qPoint, VectorOfFixVecs<DimVec<double> >& Lb) const; - /** \brief - * Implements FirstOrderTerm::eval(). - */ - void eval(int numPoints, + /// Implements FirstOrderTerm::eval(). + void eval(int nPoints, const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, @@ -2103,28 +1921,16 @@ namespace AMDiS { BinaryAbstractFunction<WorldVector<double>, double, WorldVector<double> > *vecFct; }; - // ============================================================================ - class General_FOT : public FirstOrderTerm { public: - /** /brief - * Constructor - */ + /// Constructor General_FOT(std::vector<DOFVectorBase<double>*> vecs, std::vector<DOFVectorBase<double>*> grads, TertiaryAbstractFunction<WorldVector<double>, WorldVector<double>, std::vector<double>, - std::vector<WorldVector<double> > > *f) - : FirstOrderTerm(f->getDegree()), - vecs_(vecs), - grads_(grads), - f_(f) - { - vecsAtQPs_.resize(vecs_.size()); - gradsAtQPs_.resize(grads_.size()); - } + std::vector<WorldVector<double> > > *f); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -2136,14 +1942,14 @@ namespace AMDiS { /** \brief * Implements FirstOrderTerm::getLb(). */ - void getLb(const ElInfo *elInfo, int numPoints, + void getLb(const ElInfo *elInfo, int nPoints, VectorOfFixVecs<DimVec<double> >& result) const; /** \brief * Implenetation of FirstOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -2166,50 +1972,35 @@ namespace AMDiS { std::vector<WorldVector<double>*> gradsAtQPs_; }; - - - // ============================================================================ - class GeneralParametric_FOT : public FirstOrderTerm { public: - /** /brief - * Constructor - */ + /// Constructor GeneralParametric_FOT(std::vector<DOFVectorBase<double>*> vecs, std::vector<DOFVectorBase<double>*> grads, QuartAbstractFunction<WorldVector<double>, WorldVector<double>, WorldVector<double>, std::vector<double>, - std::vector<WorldVector<double> > > *f) - : FirstOrderTerm(f->getDegree()), - vecs_(vecs), - grads_(grads), - f_(f) - { - vecsAtQPs_.resize(vecs_.size()); - gradsAtQPs_.resize(grads_.size()); - } + std::vector<WorldVector<double> > > *f); /** \brief * Implementation of \ref OperatorTerm::initElement(). */ - void initElement(const ElInfo*, - SubAssembler* , + void initElement(const ElInfo*, SubAssembler*, Quadrature *quad= NULL); /** \brief * Implements FirstOrderTerm::getLb(). */ - void getLb(const ElInfo *elInfo, int numPoints, + void getLb(const ElInfo *elInfo, int nPoints, VectorOfFixVecs<DimVec<double> >& result) const; /** \brief * Implenetation of FirstOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -2248,9 +2039,7 @@ namespace AMDiS { class ZeroOrderTerm : public OperatorTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. ZeroOrderTerm(int deg) : OperatorTerm(deg) {} /** \brief @@ -2262,13 +2051,11 @@ namespace AMDiS { * Evaluates \f$ c \f$ */ virtual void getC(const ElInfo *elInfo, - int numPoints, + int nPoints, double *result) const = 0; }; - // ============================================================================ - /** * \ingroup Assembler * @@ -2278,9 +2065,7 @@ namespace AMDiS { class Simple_ZOT : public ZeroOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. Simple_ZOT(double f = 1.0) : ZeroOrderTerm(0), factor(f) {} /** \brief @@ -2315,8 +2100,6 @@ namespace AMDiS { double factor; }; - // ============================================================================ - /** * \ingroup Assembler * @@ -2326,30 +2109,31 @@ namespace AMDiS { class VecAtQP_ZOT : public ZeroOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. VecAtQP_ZOT(DOFVectorBase<double> *dv, - AbstractFunction<double, double> *f_) - : ZeroOrderTerm(f_ ? f_->getDegree() : 0), vec(dv), f(f_) - {} + AbstractFunction<double, double> *ab); - /** \brief - * Implementation of \ref OperatorTerm::initElement(). - */ - void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, + /// Implementation of \ref OperatorTerm::initElement(). + void initElement(const ElInfo* elInfo, + SubAssembler* subAssembler, + Quadrature *quad = NULL); + + /// Implementation of \ref OperatorTerm::initElement() for multilpe meshes. + void initElement(const ElInfo* smallElInfo, + const ElInfo* largeElInfo, + SubAssembler* subAssembler, Quadrature *quad = NULL); /** \brief * Implements ZeroOrderTerm::getC(). */ - void getC(const ElInfo *, int numPoints, double *C) const; + void getC(const ElInfo *, int nPoints, double *C) const; /** \brief * Implements ZeroOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -2381,16 +2165,11 @@ namespace AMDiS { class MultVecAtQP_ZOT : public ZeroOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. MultVecAtQP_ZOT(DOFVectorBase<double> *dv1, DOFVectorBase<double> *dv2, - AbstractFunction<double, double> *f1_, - AbstractFunction<double, double> *f2_) - : ZeroOrderTerm(f1->getDegree()+f2_->getDegree()), - vec1(dv1), vec2(dv2), f1(f1_), f2(f2_) - {} + AbstractFunction<double, double> *f1, + AbstractFunction<double, double> *f2); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -2401,13 +2180,13 @@ namespace AMDiS { /** \brief * Implements ZeroOrderTerm::getC(). */ - void getC(const ElInfo *, int numPoints, double *C) const; + void getC(const ElInfo *, int nPoints, double *C) const; /** \brief * Implements ZeroOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -2433,10 +2212,6 @@ namespace AMDiS { AbstractFunction<double, double> *f2; }; - // ============================================================================ - - - /** * \ingroup Assembler * @@ -2446,53 +2221,44 @@ namespace AMDiS { class Vec2AtQP_ZOT : public ZeroOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. Vec2AtQP_ZOT(DOFVectorBase<double> *dv1, DOFVectorBase<double> *dv2, - BinaryAbstractFunction<double, double, double> *f_) - : ZeroOrderTerm(f_->getDegree()), - vec1(dv1), vec2(dv2), f(f_) - {} + BinaryAbstractFunction<double, double, double> *f); - /** \brief - * Implementation of \ref OperatorTerm::initElement(). - */ + /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, Quadrature *quad = NULL); - /** \brief - * Implements ZeroOrderTerm::getC(). - */ - void getC(const ElInfo *, int numPoints, double *C) const; + /// Implementation of \ref OperatorTerm::initElement() for multilpe meshes. + void initElement(const ElInfo* smallElInfo, + const ElInfo* largeElInfo, + SubAssembler* subAssembler, + Quadrature *quad = NULL); - /** \brief - * Implements ZeroOrderTerm::eval(). - */ - void eval(int numPoints, - const double *uhAtQP, + /// Implements ZeroOrderTerm::getC(). + void getC(const ElInfo *, int nPoints, double *C) const; + + /// Implements ZeroOrderTerm::eval(). + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, double fac) const; protected: - /** \brief - * DOFVector to be evaluated at quadrature points. - */ + /// First DOFVector to be evaluated at quadrature points. DOFVectorBase<double>* vec1; + /// Second DOFVector to be evaluated at quadrature points. DOFVectorBase<double>* vec2; - /** \brief - * Vector v at quadrature points. - */ + /// Values of the first DOFVector at the quadrature points. double *vecAtQPs1; + /// Values of the second DOFVector at the quadrature points. double *vecAtQPs2; - /** \brief - * Function for c. - */ + /// Function for c. BinaryAbstractFunction<double, double, double> *f; }; @@ -2506,19 +2272,11 @@ namespace AMDiS { class Vec3AtQP_ZOT : public ZeroOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. Vec3AtQP_ZOT(DOFVectorBase<double> *dv1, DOFVectorBase<double> *dv2, DOFVectorBase<double> *dv3, - TertiaryAbstractFunction<double, double, double, double> *f_) - : ZeroOrderTerm(f_->getDegree()), - vec1(dv1), - vec2(dv2), - vec3(dv3), - f(f_) - {} + TertiaryAbstractFunction<double, double, double, double> *f); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -2529,12 +2287,12 @@ namespace AMDiS { /** \brief * Implements ZeroOrderTerm::getC(). */ - void getC(const ElInfo *, int numPoints, double *C) const; + void getC(const ElInfo *, int nPoints, double *C) const; /** \brief * Implements ZeroOrderTerm::eval(). */ - void eval(int numPoints, + void eval(int nPoints, const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, @@ -2562,7 +2320,6 @@ namespace AMDiS { TertiaryAbstractFunction<double, double, double, double> *f; }; - // ============================================================================ /** * \ingroup Assembler @@ -2573,14 +2330,9 @@ namespace AMDiS { class FctGradientCoords_ZOT : public ZeroOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. FctGradientCoords_ZOT(DOFVectorBase<double> *dv, - BinaryAbstractFunction<double, - WorldVector<double>, WorldVector<double> > *f_) - : ZeroOrderTerm(f_->getDegree()), vec(dv), f(f_) - {} + BinaryAbstractFunction<double, WorldVector<double>, WorldVector<double> > *f); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -2591,13 +2343,13 @@ namespace AMDiS { /** \brief * Implements SecondOrderTerm::getC(). */ - void getC(const ElInfo *elInfo, int numPoints, double *C) const; + void getC(const ElInfo *elInfo, int nPoints, double *C) const; /** \brief * Implements ZeroOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -2621,8 +2373,6 @@ namespace AMDiS { }; - // ============================================================================ - /** * \ingroup Assembler * @@ -2631,13 +2381,9 @@ namespace AMDiS { class VecGradCoordsAtQP_ZOT : public ZeroOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. VecGradCoordsAtQP_ZOT(DOFVectorBase<double> *dv, - TertiaryAbstractFunction<double, double, WorldVector<double>, WorldVector<double> > *f_) - : ZeroOrderTerm(f_->getDegree()), vec(dv), f(f_) - {} + TertiaryAbstractFunction<double, double, WorldVector<double>, WorldVector<double> > *f); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -2648,13 +2394,13 @@ namespace AMDiS { /** \brief * Implements ZeroOrderTerm::getC(). */ - void getC(const ElInfo *, int numPoints, double *C) const; + void getC(const ElInfo *, int nPoints, double *C) const; /** \brief * Implements ZeroOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -2684,9 +2430,6 @@ namespace AMDiS { TertiaryAbstractFunction<double, double, WorldVector<double>, WorldVector<double> > *f; }; - - // ============================================================================ - /** * \ingroup Assembler * @@ -2695,13 +2438,9 @@ namespace AMDiS { class VecAndCoordsAtQP_ZOT : public ZeroOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. VecAndCoordsAtQP_ZOT(DOFVectorBase<double> *dv, - BinaryAbstractFunction<double, double, WorldVector<double> > *f_) - : ZeroOrderTerm(f_->getDegree()), vec(dv), f(f_) - {} + BinaryAbstractFunction<double, double, WorldVector<double> > *f); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -2712,13 +2451,13 @@ namespace AMDiS { /** \brief * Implements ZeroOrderTerm::getC(). */ - void getC(const ElInfo *, int numPoints, double *C) const; + void getC(const ElInfo *, int nPoints, double *C) const; /** \brief * Implements ZeroOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -2755,14 +2494,9 @@ namespace AMDiS { class Vec2AndGradAtQP_ZOT : public ZeroOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. Vec2AndGradAtQP_ZOT(DOFVectorBase<double> *dv1, DOFVectorBase<double> *dv2, - TertiaryAbstractFunction<double, double, WorldVector<double>, - double > *f_) - : ZeroOrderTerm(f_->getDegree()), vec1(dv1), vec2(dv2), f(f_) - {} + TertiaryAbstractFunction<double, double, WorldVector<double>, double > *af); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -2773,13 +2507,13 @@ namespace AMDiS { /** \brief * Implements ZeroOrderTerm::getC(). */ - void getC(const ElInfo *, int numPoints, double *C) const; + void getC(const ElInfo *, int nPoints, double *C) const; /** \brief * Implements ZeroOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -2809,7 +2543,6 @@ namespace AMDiS { TertiaryAbstractFunction<double, double, WorldVector<double>, double > *f; }; - // ============================================================================ /** * \ingroup Assembler @@ -2820,13 +2553,9 @@ namespace AMDiS { class FctGradient_ZOT : public ZeroOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. FctGradient_ZOT(DOFVectorBase<double> *dv, - AbstractFunction<double, WorldVector<double> > *f_) - : ZeroOrderTerm(f_->getDegree()), vec(dv), f(f_) - {} + AbstractFunction<double, WorldVector<double> > *f); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -2837,13 +2566,13 @@ namespace AMDiS { /** \brief * Implements SecondOrderTerm::getC(). */ - void getC(const ElInfo *elInfo, int numPoints, double *C) const; + void getC(const ElInfo *elInfo, int nPoints, double *C) const; /** \brief * Implements ZeroOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -2865,8 +2594,6 @@ namespace AMDiS { }; - // ============================================================================ - /** * \ingroup Assembler * @@ -2875,13 +2602,9 @@ namespace AMDiS { class VecAndGradAtQP_ZOT : public ZeroOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. VecAndGradAtQP_ZOT(DOFVectorBase<double> *dv, - BinaryAbstractFunction<double, double, WorldVector<double> > *f_) - : ZeroOrderTerm(f_->getDegree()), vec(dv), f(f_) - {} + BinaryAbstractFunction<double, double, WorldVector<double> > *f); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -2892,13 +2615,13 @@ namespace AMDiS { /** \brief * Implements ZeroOrderTerm::getC(). */ - void getC(const ElInfo *, int numPoints, double *C) const; + void getC(const ElInfo *, int nPoints, double *C) const; /** \brief * Implements ZeroOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -2926,8 +2649,6 @@ namespace AMDiS { BinaryAbstractFunction<double, double, WorldVector<double> > *f; }; - // ============================================================================ - /** * \ingroup Assembler * @@ -2936,13 +2657,9 @@ namespace AMDiS { class VecAndGradAtQP_SOT : public SecondOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. VecAndGradAtQP_SOT(DOFVectorBase<double> *dv, - BinaryAbstractFunction<double, double, WorldVector<double> > *f_) - : SecondOrderTerm(f_->getDegree()), vec(dv), f(f_) - {} + BinaryAbstractFunction<double, double, WorldVector<double> > *af); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -2954,13 +2671,13 @@ namespace AMDiS { /** \brief * Implements SecondOrderTerm::getLALt(). */ - inline void getLALt(const ElInfo *elInfo, int numPoints, DimMat<double> **LALt) const; + inline void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const; /** \brief * Implements SecondOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -2969,7 +2686,7 @@ namespace AMDiS { /** \brief * Implements SecondOrderTerm::weakEval(). */ - void weakEval(int numPoints, + void weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const; @@ -2995,9 +2712,6 @@ namespace AMDiS { BinaryAbstractFunction<double, double, WorldVector<double> > *f; }; - - // ============================================================================ - /* * \ingroup Assembler * @@ -3007,12 +2721,9 @@ namespace AMDiS { class CoordsAtQP_ZOT : public ZeroOrderTerm { public: - /** \brief - * Constructor. - */ - CoordsAtQP_ZOT(AbstractFunction<double, WorldVector<double> > *g_) - : ZeroOrderTerm(g_->getDegree()), - g(g_) + /// Constructor. + CoordsAtQP_ZOT(AbstractFunction<double, WorldVector<double> > *af) + : ZeroOrderTerm(af->getDegree()), g(af) {} /** \brief @@ -3025,13 +2736,13 @@ namespace AMDiS { /** \brief * Implements ZeroOrderTerm::getC(). */ - void getC(const ElInfo *, int numPoints, double *C) const; + void getC(const ElInfo *, int nPoints, double *C) const; /** \brief * Implements ZeroOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -3049,8 +2760,6 @@ namespace AMDiS { AbstractFunction<double, WorldVector<double> > *g; }; - // ============================================================================ - /** * \ingroup Assembler * @@ -3062,12 +2771,10 @@ namespace AMDiS { class CoordsAtQP_IJ_SOT : public SecondOrderTerm { public: - /** \brief - * Constructor. - */ - CoordsAtQP_IJ_SOT(AbstractFunction<double, WorldVector<double> > *g_, + /// Constructor. + CoordsAtQP_IJ_SOT(AbstractFunction<double, WorldVector<double> > *af, int x_i, int x_j) - : SecondOrderTerm(g_->getDegree()), g(g_), xi(x_i), xj(x_j) + : SecondOrderTerm(af->getDegree()), g(af), xi(x_i), xj(x_j) { setSymmetric(xi == xj); } @@ -3081,13 +2788,13 @@ namespace AMDiS { /** \brief * Implements SecondOrderTerm::getLALt(). */ - inline void getLALt(const ElInfo *elInfo, int numPoints, DimMat<double> **LALt) const; + inline void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const; /** \brief * Implements SecondOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -3096,7 +2803,7 @@ namespace AMDiS { /** \brief * Implements SecondOrderTerm::weakEval(). */ - void weakEval(int numPoints, + void weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const; @@ -3117,8 +2824,6 @@ namespace AMDiS { int xi, xj; }; - // ============================================================================ - /** * \ingroup Assembler * @@ -3131,16 +2836,9 @@ namespace AMDiS { class VecAtQP_IJ_SOT : public SecondOrderTerm { public: - /** \brief - * Constructor. - */ - VecAtQP_IJ_SOT(DOFVectorBase<double> *dv, - AbstractFunction<double, double> *f_, - int x_i, int x_j) - : SecondOrderTerm(f_->getDegree()), vec(dv), f(f_), xi(x_i), xj(x_j) - { - setSymmetric(xi == xj); - } + /// Constructor. + VecAtQP_IJ_SOT(DOFVectorBase<double> *dv, AbstractFunction<double, double> *af, + int x_i, int x_j); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -3151,13 +2849,13 @@ namespace AMDiS { /** \brief * Implements SecondOrderTerm::getLALt(). */ - void getLALt(const ElInfo *elInfo, int numPoints, DimMat<double> **LALt) const; + void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const; /** \brief * Implements SecondOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -3166,7 +2864,7 @@ namespace AMDiS { /** \brief * Implements SecondOrderTerm::weakEval(). */ - void weakEval(int numPoints, + void weakEval(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const; @@ -3194,19 +2892,13 @@ namespace AMDiS { int xi, xj; }; - // ============================================================================ - class VecAndGradVecAtQP_ZOT : public ZeroOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. VecAndGradVecAtQP_ZOT(DOFVectorBase<double> *dv, DOFVectorBase<double> *dGrd, - BinaryAbstractFunction<double, double, WorldVector<double> > *f_) - : ZeroOrderTerm(f_->getDegree()), vec(dv), vecGrd(dGrd), f(f_) - {} + BinaryAbstractFunction<double, double, WorldVector<double> > *f); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -3217,13 +2909,13 @@ namespace AMDiS { /** \brief * Implements ZeroOrderTerm::getC(). */ - void getC(const ElInfo *, int numPoints, double *C) const; + void getC(const ElInfo *, int nPoints, double *C) const; /** \brief * Implements ZeroOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -3256,20 +2948,14 @@ namespace AMDiS { BinaryAbstractFunction<double, double, WorldVector<double> > *f; }; - // ============================================================================ - class VecAndGradVec2AtQP_ZOT : public ZeroOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. VecAndGradVec2AtQP_ZOT(DOFVectorBase<double> *dv, - DOFVectorBase<double> *dGrd1, DOFVectorBase<double> *dGrd2, - TertiaryAbstractFunction<double, - double, WorldVector<double>, WorldVector<double> > *f_) - : ZeroOrderTerm(f_->getDegree()), vec(dv), vecGrd1(dGrd1), vecGrd2(dGrd2), f(f_) - {} + DOFVectorBase<double> *dGrd1, + DOFVectorBase<double> *dGrd2, + TertiaryAbstractFunction<double, double, WorldVector<double>, WorldVector<double> > *af); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -3280,13 +2966,13 @@ namespace AMDiS { /** \brief * Implements ZeroOrderTerm::getC(). */ - void getC(const ElInfo *, int numPoints, double *C) const; + void getC(const ElInfo *, int nPoints, double *C) const; /** \brief * Implements ZeroOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -3333,15 +3019,9 @@ namespace AMDiS { class VecOfDOFVecsAtQP_ZOT : public ZeroOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. VecOfDOFVecsAtQP_ZOT(const std::vector<DOFVectorBase<double>*>& dv, - AbstractFunction<double, std::vector<double> > *f_) - : ZeroOrderTerm(f_->getDegree()), vecs(dv), f(f_) - { - vecsAtQPs.resize(vecs.size()); - } + AbstractFunction<double, std::vector<double> > *f); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -3352,13 +3032,13 @@ namespace AMDiS { /** \brief * Implements ZeroOrderTerm::getC(). */ - void getC(const ElInfo *, int numPoints, double *C) const; + void getC(const ElInfo *, int nPoints, double *C) const; /** \brief * Implements ZeroOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -3384,15 +3064,9 @@ namespace AMDiS { class VecOfGradientsAtQP_ZOT : public ZeroOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. VecOfGradientsAtQP_ZOT(const std::vector<DOFVectorBase<double>*>& dv, - AbstractFunction<double, std::vector<WorldVector<double>*> > *f_) - : ZeroOrderTerm(f_->getDegree()), vecs(dv), f(f_) - { - gradsAtQPs.resize(vecs.size()); - } + AbstractFunction<double, std::vector<WorldVector<double>*> > *af); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -3403,13 +3077,13 @@ namespace AMDiS { /** \brief * Implements ZeroOrderTerm::getC(). */ - void getC(const ElInfo *, int numPoints, double *C) const; + void getC(const ElInfo *, int nPoints, double *C) const; /** \brief * Implements ZeroOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -3436,21 +3110,11 @@ namespace AMDiS { class VecDivergence_ZOT : public ZeroOrderTerm { public: - /** \brief - * Constructor. - */ - VecDivergence_ZOT(int numComponents, + /// Constructor. + VecDivergence_ZOT(int nComponents, DOFVectorBase<double> *vec0, DOFVectorBase<double> *vec1 = NULL, - DOFVectorBase<double> *vec2 = NULL) - : ZeroOrderTerm(0) - { - vecs.resize(numComponents); - gradsAtQPs.resize(numComponents); - vecs[0] = vec0; - vecs[1] = vec1; - vecs[2] = vec2; - } + DOFVectorBase<double> *vec2 = NULL); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -3461,13 +3125,13 @@ namespace AMDiS { /** \brief * Implements ZeroOrderTerm::getC(). */ - void getC(const ElInfo *, int numPoints, double *C) const; + void getC(const ElInfo *, int nPoints, double *C) const; /** \brief * Implements ZeroOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -3490,16 +3154,10 @@ namespace AMDiS { class VecAndVecOfGradientsAtQP_ZOT : public ZeroOrderTerm { public: - /** \brief - * Constructor. - */ - VecAndVecOfGradientsAtQP_ZOT(DOFVector<double> *vec_, + /// Constructor. + VecAndVecOfGradientsAtQP_ZOT(DOFVector<double> *v, const std::vector<DOFVector<double>*>& dv, - BinaryAbstractFunction<double, double, std::vector<WorldVector<double>*> > *f_) - : ZeroOrderTerm(f_->getDegree()), vec(vec_), vecs(dv), f(f_) - { - gradsAtQPs.resize(vecs.size()); - } + BinaryAbstractFunction<double, double, std::vector<WorldVector<double>*> > *af); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -3510,13 +3168,13 @@ namespace AMDiS { /** \brief * Implements ZeroOrderTerm::getC(). */ - void getC(const ElInfo *, int numPoints, double *C) const; + void getC(const ElInfo *, int nPoints, double *C) const; /** \brief * Implements ZeroOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -3549,30 +3207,13 @@ namespace AMDiS { BinaryAbstractFunction<double, double, std::vector<WorldVector<double>*> > *f; }; - - - // ============================================================================ - class General_ZOT : public ZeroOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. General_ZOT(std::vector<DOFVectorBase<double>*> vecs, std::vector<DOFVectorBase<double>*> grads, - TertiaryAbstractFunction<double, - WorldVector<double>, - std::vector<double>, - std::vector<WorldVector<double> > > *f) - : ZeroOrderTerm(f->getDegree()), - vecs_(vecs), - grads_(grads), - f_(f) - { - vecsAtQPs_.resize(vecs_.size()); - gradsAtQPs_.resize(grads_.size()); - } + TertiaryAbstractFunction<double, WorldVector<double>, std::vector<double>, std::vector<WorldVector<double> > > *f); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -3583,13 +3224,13 @@ namespace AMDiS { /** \brief * Implements ZeroOrderTerm::getC(). */ - void getC(const ElInfo *, int numPoints, double *C) const; + void getC(const ElInfo *, int nPoints, double *C) const; /** \brief * Implements ZeroOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -3612,30 +3253,17 @@ namespace AMDiS { std::vector<WorldVector<double>*> gradsAtQPs_; }; - - // ============================================================================ - class GeneralParametric_ZOT : public ZeroOrderTerm { public: - /** \brief - * Constructor. - */ + /// Constructor. GeneralParametric_ZOT(std::vector<DOFVectorBase<double>*> vecs, std::vector<DOFVectorBase<double>*> grads, QuartAbstractFunction<double, WorldVector<double>, WorldVector<double>, std::vector<double>, - std::vector<WorldVector<double> > > *f) - : ZeroOrderTerm(f->getDegree()), - vecs_(vecs), - grads_(grads), - f_(f) - { - vecsAtQPs_.resize(vecs_.size()); - gradsAtQPs_.resize(grads_.size()); - } + std::vector<WorldVector<double> > > *f); /** \brief * Implementation of \ref OperatorTerm::initElement(). @@ -3646,13 +3274,13 @@ namespace AMDiS { /** \brief * Implements ZeroOrderTerm::getC(). */ - void getC(const ElInfo *, int numPoints, double *C) const; + void getC(const ElInfo *, int nPoints, double *C) const; /** \brief * Implements ZeroOrderTerm::eval(). */ - void eval(int numPoints, - const double *uhAtQP, + void eval(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -3679,12 +3307,6 @@ namespace AMDiS { }; - - /*****************************************************************************/ - /****** Operators for the least-square finite element method *******/ - /*****************************************************************************/ - - // ============================================================================ // ===== class Operator ======================================================= // ============================================================================ @@ -3783,22 +3405,29 @@ namespace AMDiS { ElementVector *userVec, double factor = 1.0); + virtual void getElementVector(const ElInfo *mainElInfo, + const ElInfo *auxElInfo, + const ElInfo *smallElInfo, + const ElInfo *largeElInfo, + ElementVector *userVec, + double factor = 1.0); - /** \brief - * Returns \ref rowFESpace - */ + /// Returns \ref rowFESpace. inline const FiniteElemSpace *getRowFESpace() { return rowFESpace; } - /** \brief - * Returns \ref colFESpace - */ + /// Returns \ref colFESpace. inline const FiniteElemSpace *getColFESpace() { return colFESpace; } + /// Returns \ref auxFESpaces. + inline std::vector<const FiniteElemSpace*> getAuxFESpaces() { + return auxFESpaces; + } + /** \brief * Sets \ref uhOld. */ @@ -3811,47 +3440,43 @@ namespace AMDiS { return uhOld; } - /** \brief - * Returns \ref assembler - */ + /// Returns \ref assembler Assembler *getAssembler(int rank); - /** \brief - * Sets \ref assembler - */ + /// Sets \ref assembler void setAssembler(int rank, Assembler *ass); - /** \brief - * Returns whether this is a matrix operator. - */ + /// Returns whether this is a matrix operator. inline const bool isMatrixOperator() { return type.isSet(MATRIX_OPERATOR); } - /** \brief - * Returns whether this is a vector operator - */ + /// Returns whether this is a vector operator inline const bool isVectorOperator() { return type.isSet(VECTOR_OPERATOR); } - /** \brief - * Sets \ref fillFlag, the flag used for this Operator while mesh traversal. - */ + /// Sets \ref fillFlag, the flag used for this Operator while mesh traversal. inline void setFillFlag(Flag f) { fillFlag = f; } - /** \brief - * Returns \ref fillFlag - */ + /// Sets \ref needDualTraverse. + void setNeedDualTraverse(bool b) { + needDualTraverse = b; + } + + /// Returns \ref fillFlag inline Flag getFillFlag() { return fillFlag; } - /** \brief - * Initialization of the needed SubAssemblers using the given quadratures. - */ + /// Returns \ref needDualTraverse + bool getNeedDualTraverse() { + return needDualTraverse; + } + + /// Initialization of the needed SubAssemblers using the given quadratures. void initAssembler(int rank, Quadrature *quad2, Quadrature *quad1GrdPsi, @@ -3859,16 +3484,12 @@ namespace AMDiS { Quadrature *quad0); - /** \brief - * Calculates the needed quadrature degree for the given order. - */ + /// Calculates the needed quadrature degree for the given order. int getQuadratureDegree(int order, FirstOrderType firstOrderType = GRD_PHI); - /** \brief - * Evaluation of all terms in \ref zeroOrder. - */ - void evalZeroOrder(int numPoints, - const double *uhAtQP, + /// Evaluation of all terms in \ref zeroOrder. + void evalZeroOrder(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -3880,7 +3501,7 @@ namespace AMDiS { for (termIt = zeroOrder[myRank].begin(); termIt != zeroOrder[myRank].end(); ++termIt) { - (*termIt)->eval(numPoints, uhAtQP, grdUhAtQP, D2UhAtQP, result, factor); + (*termIt)->eval(nPoints, uhAtQP, grdUhAtQP, D2UhAtQP, result, factor); } } @@ -3888,8 +3509,8 @@ namespace AMDiS { /** \brief * Evaluation of all terms in \ref firstOrderGrdPsi. */ - void evalFirstOrderGrdPsi(int numPoints, - const double *uhAtQP, + void evalFirstOrderGrdPsi(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -3901,15 +3522,15 @@ namespace AMDiS { for (termIt = firstOrderGrdPsi[myRank].begin(); termIt != firstOrderGrdPsi[myRank].end(); ++termIt) { - (*termIt)->eval(numPoints, uhAtQP, grdUhAtQP, D2UhAtQP, result, factor); + (*termIt)->eval(nPoints, uhAtQP, grdUhAtQP, D2UhAtQP, result, factor); } } /** \brief * Evaluation of all terms in \ref firstOrderGrdPhi. */ - void evalFirstOrderGrdPhi(int numPoints, - const double *uhAtQP, + void evalFirstOrderGrdPhi(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -3921,7 +3542,7 @@ namespace AMDiS { for (termIt = firstOrderGrdPhi[myRank].begin(); termIt != firstOrderGrdPhi[myRank].end(); ++termIt) { - (*termIt)->eval(numPoints, uhAtQP, grdUhAtQP, D2UhAtQP, result, factor); + (*termIt)->eval(nPoints, uhAtQP, grdUhAtQP, D2UhAtQP, result, factor); } } @@ -3929,8 +3550,8 @@ namespace AMDiS { /** \brief * Evaluation of all terms in \ref secondOrder. */ - void evalSecondOrder(int numPoints, - const double *uhAtQP, + void evalSecondOrder(int nPoints, + const double *uhAtQP, const WorldVector<double> *grdUhAtQP, const WorldMatrix<double> *D2UhAtQP, double *result, @@ -3942,14 +3563,14 @@ namespace AMDiS { for (termIt = secondOrder[myRank].begin(); termIt != secondOrder[myRank].end(); ++termIt) { - (*termIt)->eval(numPoints, uhAtQP, grdUhAtQP, D2UhAtQP, result, factor); + (*termIt)->eval(nPoints, uhAtQP, grdUhAtQP, D2UhAtQP, result, factor); } } /** \brief * Weak evaluation of all terms in \ref secondOrder. */ - void weakEvalSecondOrder(int numPoints, + void weakEvalSecondOrder(int nPoints, const WorldVector<double> *grdUhAtQP, WorldVector<double> *result) const { @@ -3959,7 +3580,7 @@ namespace AMDiS { for (termIt = secondOrder[myRank].begin(); termIt != secondOrder[myRank].end(); ++termIt) { - static_cast<SecondOrderTerm*>(*termIt)->weakEval(numPoints, grdUhAtQP, result); + static_cast<SecondOrderTerm*>(*termIt)->weakEval(nPoints, grdUhAtQP, result); } } @@ -3967,7 +3588,7 @@ namespace AMDiS { * Calls getLALt() for each term in \ref secondOrder * and adds the results to LALt. */ - void getLALt(const ElInfo *elInfo, int numPoints, DimMat<double> **LALt) const + void getLALt(const ElInfo *elInfo, int nPoints, DimMat<double> **LALt) const { int myRank = omp_get_thread_num(); @@ -3975,7 +3596,7 @@ namespace AMDiS { for (termIt = secondOrder[myRank].begin(); termIt != secondOrder[myRank].end(); ++termIt) { - static_cast<SecondOrderTerm*>(*termIt)->getLALt(elInfo, numPoints, LALt); + static_cast<SecondOrderTerm*>(*termIt)->getLALt(elInfo, nPoints, LALt); } } @@ -3983,7 +3604,7 @@ namespace AMDiS { * Calls getLb() for each term in \ref firstOrderGrdPsi * and adds the results to Lb. */ - void getLbGrdPsi(const ElInfo *elInfo, int numPoints, VectorOfFixVecs<DimVec<double> >& Lb) const + void getLbGrdPsi(const ElInfo *elInfo, int nPoints, VectorOfFixVecs<DimVec<double> >& Lb) const { int myRank = omp_get_thread_num(); @@ -3991,7 +3612,7 @@ namespace AMDiS { for (termIt = firstOrderGrdPsi[myRank].begin(); termIt != firstOrderGrdPsi[myRank].end(); ++termIt) { - static_cast<FirstOrderTerm*>(*termIt)->getLb(elInfo, numPoints, Lb); + static_cast<FirstOrderTerm*>(*termIt)->getLb(elInfo, nPoints, Lb); } } @@ -3999,7 +3620,7 @@ namespace AMDiS { * Calls getLb() for each term in \ref firstOrderGrdPhi * and adds the results to Lb. */ - void getLbGrdPhi(const ElInfo *elInfo, int numPoints, VectorOfFixVecs<DimVec<double> >& Lb) const + void getLbGrdPhi(const ElInfo *elInfo, int nPoints, VectorOfFixVecs<DimVec<double> >& Lb) const { int myRank = omp_get_thread_num(); @@ -4007,7 +3628,7 @@ namespace AMDiS { for (termIt = firstOrderGrdPhi[myRank].begin(); termIt != firstOrderGrdPhi[myRank].end(); ++termIt) { - static_cast<FirstOrderTerm*>(*termIt)->getLb(elInfo, numPoints, Lb); + static_cast<FirstOrderTerm*>(*termIt)->getLb(elInfo, nPoints, Lb); } } @@ -4015,7 +3636,7 @@ namespace AMDiS { * Calls getC() for each term in \ref zeroOrder * and adds the results to c. */ - void getC(const ElInfo *elInfo, int numPoints, double *c) const + void getC(const ElInfo *elInfo, int nPoints, double *c) const { int myRank = omp_get_thread_num(); @@ -4023,13 +3644,11 @@ namespace AMDiS { for (termIt = zeroOrder[myRank].begin(); termIt != zeroOrder[myRank].end(); ++termIt) { - static_cast<ZeroOrderTerm*>(*termIt)->getC(elInfo, numPoints, c); + static_cast<ZeroOrderTerm*>(*termIt)->getC(elInfo, nPoints, c); } } - /** \brief - * Returns true, if there are second order terms. Returns false otherwise. - */ + /// Returns true, if there are second order terms. Returns false otherwise. inline bool secondOrderTerms() { return secondOrder[omp_get_thread_num()].size() != 0; } @@ -4059,47 +3678,37 @@ namespace AMDiS { } public: - /** \brief - * Constant type flag for matrix operators - */ + /// Constant type flag for matrix operators static const Flag MATRIX_OPERATOR; - /** \brief - * Constant type flag for vector operators - */ + /// Constant type flag for vector operators static const Flag VECTOR_OPERATOR; protected: - /** \brief - * FiniteElemSpace for matrix rows and element vector - */ + /// FiniteElemSpace for matrix rows and element vector const FiniteElemSpace *rowFESpace; - /** \brief - * FiniteElemSpace for matrix columns. Can be equal to \rowFESpace. - */ + /// FiniteElemSpace for matrix columns. Can be equal to \rowFESpace. const FiniteElemSpace *colFESpace; - /** \brief - * Number of rows in the element matrix - */ + /// List of aux fe spaces, e.g., if a term is multiplied with a DOF vector + std::vector<const FiniteElemSpace*> auxFESpaces; + + /// Number of rows in the element matrix int nRow; - /** \brief - * Number of columns in the element matrix - */ + /// Number of columns in the element matrix int nCol; - /** \brief - * Type of this Operator. - */ + /// Type of this Operator. Flag type; - /** \brief - * Flag for mesh traversal - */ + /// Flag for mesh traversal Flag fillFlag; + /// If true, the operator needs a dual traverse over two meshes for assembling. + bool needDualTraverse; + /** \brief * Calculates the element matrix and/or the element vector. It is * created especially for this Operator, when \ref getElementMatrix() @@ -4107,24 +3716,16 @@ namespace AMDiS { */ std::vector<Assembler*> assembler; - /** \brief - * List of all second order terms - */ + /// List of all second order terms std::vector< std::vector<OperatorTerm*> > secondOrder; - /** \brief - * List of all first order terms derived to psi - */ + /// List of all first order terms derived to psi std::vector< std::vector<OperatorTerm*> > firstOrderGrdPsi; - /** \brief - * List of all first order terms derived to phi - */ + /// List of all first order terms derived to phi std::vector< std::vector<OperatorTerm*> > firstOrderGrdPhi; - /** \brief - * List of all zero order terms - */ + /// List of all zero order terms std::vector< std::vector<OperatorTerm*> > zeroOrder; /** \brief @@ -4135,9 +3736,7 @@ namespace AMDiS { */ const DOFVectorBase<double> *uhOld; - /** \brief - * Spezifies whether optimized assemblers are used or not. - */ + /// Spezifies whether optimized assemblers are used or not. bool optimized; friend class Assembler; diff --git a/AMDiS/src/Operator.hh b/AMDiS/src/Operator.hh index ee745836f8c78f7a98a761eed79ca661bf04d887..8b14eea21de4fe80d78e4fc093a471a03adc7a22 100644 --- a/AMDiS/src/Operator.hh +++ b/AMDiS/src/Operator.hh @@ -5,6 +5,9 @@ namespace AMDiS { { secondOrder[0].push_back(term); term->operat = this; + auxFESpaces.insert(auxFESpaces.end(), + term->getAuxFESpaces().begin(), + term->getAuxFESpaces().end()); for (int i = 1; i < omp_get_overall_max_threads(); i++) { T *newTerm = NEW T(static_cast<const T>(*term)); @@ -22,6 +25,9 @@ namespace AMDiS { firstOrderGrdPhi[0].push_back(term); } term->operat = this; + auxFESpaces.insert(auxFESpaces.end(), + term->getAuxFESpaces().begin(), + term->getAuxFESpaces().end()); for (int i = 1; i < omp_get_overall_max_threads(); i++) { T *newTerm = NEW T(static_cast<const T>(*term)); @@ -38,6 +44,9 @@ namespace AMDiS { { zeroOrder[0].push_back(term); term->operat = this; + auxFESpaces.insert(auxFESpaces.end(), + term->getAuxFESpaces().begin(), + term->getAuxFESpaces().end()); for (int i = 1; i < omp_get_overall_max_threads(); i++) { T *newTerm = NEW T(static_cast<const T>(*term)); diff --git a/AMDiS/src/Parameters.cc b/AMDiS/src/Parameters.cc index c344c0443eade235f9b644e64dcdebc55c97f35e..359b2527c5e618f98176eafaa8881c5e91d4f830 100644 --- a/AMDiS/src/Parameters.cc +++ b/AMDiS/src/Parameters.cc @@ -48,7 +48,7 @@ namespace AMDiS { if (0 == Parameters::singlett->allParam.size()) { if (0==Parameters::singlett->filename.size()) { - INFO(info,1)("no parameters defined\n"); + INFO(info, 1)("no parameters defined\n"); return(0); } else { Parameters::singlett->read(Parameters::singlett->filename,key); @@ -59,11 +59,11 @@ namespace AMDiS { if (i == Parameters::singlett->allParam.end()) { if (funcName != funcName2) { - INFO(info,1)("initialization of parameter `%s'\n", key.data()); - INFO(info,1)("fails on line %d of file %s\n", param_call_line, + INFO(info, 1)("initialization of parameter `%s'\n", key.data()); + INFO(info, 1)("fails on line %d of file %s\n", param_call_line, param_call_file); } else { - INFO(info,1)("initialization of parameter `%s' fails\n", key.data()); + INFO(info, 1)("initialization of parameter `%s' fails\n", key.data()); } return(0); @@ -72,7 +72,7 @@ namespace AMDiS { va_start(arg, format); count = 0; - INFO(info,2)("parameter `%s' initialized with: ", key.data()); + INFO(info, 2)("parameter `%s' initialized with: ", key.data()); s = (*i).parameters; @@ -82,18 +82,18 @@ namespace AMDiS { word = Parameters::singlett->getNextWord(&s); if (!*word) { - PRINT_INFO(info,2)("\n"); + PRINT_INFO(info, 2)("\n"); if (0<(*i).funcName.size()) { - INFO(info,4)("parameter initialized by %s()\n", + INFO(info, 4)("parameter initialized by %s()\n", (*i).funcName.data()); - INFO(info,4)("on line %d of file \"%s\"\n", (*i).lineNo, + INFO(info, 4)("on line %d of file \"%s\"\n", (*i).lineNo, (*i).filename.data()); } else if (0<(*i).filename.size()) { - INFO(info,4) + INFO(info, 4) ("parameter initialized on line %2d of init file \"%s\"\n", (*i).lineNo, (*i).filename.data()); } else { - INFO(info,4)("location of initialization unknown\n"); + INFO(info, 4)("location of initialization unknown\n"); } va_end(arg); return(count); @@ -104,40 +104,40 @@ namespace AMDiS { case 'S': Sval = va_arg(arg, char *); *Sval = static_cast<char>(atoi(word)); - INFO(info,2)("%d ", *Sval); + INFO(info, 2)("%d ", *Sval); break; case 'U': Uval = va_arg(arg, unsigned char *); *Uval = static_cast<unsigned char>(atoi(word)); - INFO(info,2)("%d ", *Uval); + INFO(info, 2)("%d ", *Uval); break; case 'c': cval = va_arg(arg, char *); *cval = *word; - INFO(info,2)("%c ", *cval); + INFO(info, 2)("%c ", *cval); break; case 's': sval = va_arg(arg, char *); strcpy(sval, word); - INFO(info,2)("%s ", sval); + INFO(info, 2)("%s ", sval); break; case 'd': ival = va_arg(arg, int *); *ival = atoi(word); - INFO(info,2)("%d ", *ival); + INFO(info, 2)("%d ", *ival); break; case 'e': case 'f': case 'g': rval = va_arg(arg, double *); *rval = dval = atof(word); - INFO(info,2)("%g ", dval); + INFO(info, 2)("%g ", dval); break; case '*': break; default: - INFO(info,2)("\n"); - INFO(info,2) + INFO(info, 2)("\n"); + INFO(info, 2) ("unknow format specifier `%%%c', skipping initialization of %s\n", *p, key.data()); } @@ -146,15 +146,15 @@ namespace AMDiS { INFO(info,2)("\n"); if ((*i).funcName.size() > 0) { - INFO(info,4)("parameter initialized by %s()\n", (*i).funcName.data()); - INFO(info,4)("on line %d of file \"%s\"\n", (*i).lineNo, + INFO(info, 4)("parameter initialized by %s()\n", (*i).funcName.data()); + INFO(info, 4)("on line %d of file \"%s\"\n", (*i).lineNo, (*i).filename.data()); } else if ((*i).filename.size() > 0) { - INFO(info,4) + INFO(info, 4) ("parameter initialized on line %2d of init file \"%s\"\n", (*i).lineNo, (*i).filename.data()); } else { - INFO(info,4)("location of initialization unknown\n"); + INFO(info, 4)("location of initialization unknown\n"); } va_end(arg); @@ -191,7 +191,7 @@ namespace AMDiS { return; } - INFO(paramInfo,2)("reading from file %s\n", aFilename.data()); + INFO(paramInfo, 2)("reading from file %s\n", aFilename.data()); actfile = getActFile(aFilename); while (!inputFile.eof()) { diff --git a/AMDiS/src/ProblemInterpolScal.cc b/AMDiS/src/ProblemInterpolScal.cc index f0c8d9b104dc0ba438d20b43d54cb027f740beda..4a60301941e476af54e1fe061643ba056412e4ee 100644 --- a/AMDiS/src/ProblemInterpolScal.cc +++ b/AMDiS/src/ProblemInterpolScal.cc @@ -36,7 +36,7 @@ namespace AMDiS { int errorNorm = 0; int relErr = 0; - GET_PARAMETER(0, name_ + "->rel error", "%d", &relErr); + GET_PARAMETER(0, name + "->rel error", "%d", &relErr); if (grdInterpolFct_) errorNorm = 1; diff --git a/AMDiS/src/ProblemInterpolVec.cc b/AMDiS/src/ProblemInterpolVec.cc index 52225b95a4b93d6630d1e2cfec745011c7fd0106..d56e3548da4b3d4d905b1b88071b9082d1f1f6b7 100644 --- a/AMDiS/src/ProblemInterpolVec.cc +++ b/AMDiS/src/ProblemInterpolVec.cc @@ -6,11 +6,11 @@ namespace AMDiS { - ProblemInterpolVec::ProblemInterpolVec(const char *name_, + ProblemInterpolVec::ProblemInterpolVec(const char *nameStr, ProblemVec *spaceProblem, std::vector<AbstractFunction<double, WorldVector<double> >*> *fct, std::vector<AbstractFunction<WorldVector<double>, WorldVector<double> >*> *grdFct) - : ProblemVec(name_), + : ProblemVec(nameStr), interpolFct_(fct), grdInterpolFct_(grdFct) { @@ -25,44 +25,43 @@ namespace AMDiS { } void ProblemInterpolVec::solve(AdaptInfo *adaptInfo) { - int i, size = static_cast<int>(meshes_.size()); - for(i = 0; i < size; i++) { - meshes_[i]->dofCompress(); + int size = static_cast<int>(meshes.size()); + for (int i = 0; i < size; i++) { + meshes[i]->dofCompress(); } - solution_->interpol(interpolFct_); + solution->interpol(interpolFct_); } void ProblemInterpolVec::estimate(AdaptInfo *adaptInfo, double) { FUNCNAME("ProblemIterpolVec::estimate()"); double errMax = 0.0, errSum = 0.0; int errorNorm = 0; - int i; int size = static_cast<int>(interpolFct_ ? interpolFct_->size() : grdInterpolFct_->size()); int relErr = 0; - GET_PARAMETER(0, name_ + "->rel error", "%d", &relErr); + GET_PARAMETER(0, name + "->rel error", "%d", &relErr); - if(grdInterpolFct_) + if (grdInterpolFct_) errorNorm = 1; else if(interpolFct_) errorNorm = 2; - switch(errorNorm) { + switch (errorNorm) { case 1: - for(i = 0; i < size; i++) { + for (int i = 0; i < size; i++) { errSum = Error<double>::H1Err((*(*grdInterpolFct_)[i]), - *(solution_->getDOFVector(i)), + *(solution->getDOFVector(i)), relErr, &errMax, true, i); adaptInfo->setEstSum(errSum, i); adaptInfo->setEstMax(errMax, i); } break; case 2: - for(i = 0; i < size; i++) { + for (int i = 0; i < size; i++) { errSum = Error<double>::L2Err((*(*interpolFct_)[i]), - *(solution_->getDOFVector(i)), + *(solution->getDOFVector(i)), relErr, &errMax, true, i); adaptInfo->setEstSum(errSum, i); adaptInfo->setEstMax(errMax, i); diff --git a/AMDiS/src/ProblemInterpolVec.h b/AMDiS/src/ProblemInterpolVec.h index a4e6dec83116cb072266c461833be460702200ee..3869c1e65a5787c0f89ec1f3b007f02a3c8a1c8c 100644 --- a/AMDiS/src/ProblemInterpolVec.h +++ b/AMDiS/src/ProblemInterpolVec.h @@ -41,7 +41,7 @@ namespace AMDiS { * grdFct is used, if H1 error should be used for estimation. It points * to the gradient of fct. */ - ProblemInterpolVec(const char *name_, + ProblemInterpolVec(const char *name, ProblemVec *spaceProblem, std::vector<AbstractFunction<double, WorldVector<double> >*> *fct, std::vector<AbstractFunction<WorldVector<double>, WorldVector<double> >*> *grdFct); @@ -49,17 +49,17 @@ namespace AMDiS { /** \brief * no system assemblage. */ - virtual void buildbeforeRefine(AdaptInfo *adaptInfo, Flag) {}; + virtual void buildbeforeRefine(AdaptInfo *adaptInfo, Flag) {} /** \brief * no system assemblage. */ - virtual void buildbeforeCoarsen(AdaptInfo *adaptInfo, Flag) {}; + virtual void buildbeforeCoarsen(AdaptInfo *adaptInfo, Flag) {} /** \brief * no system assemblage. */ - virtual void buildAfterCoarsen(AdaptInfo *adaptInfo, Flag) {}; + virtual void buildAfterCoarsen(AdaptInfo *adaptInfo, Flag) {} /** \brief * no equation system ins solved. Instead fct is interpolated to uh. diff --git a/AMDiS/src/ProblemNonLin.cc b/AMDiS/src/ProblemNonLin.cc index 171abe6857d6ce31dc931b9b89d7da9b8fe77915..e24fca175d84828e8e082d1f83e359439bfa787d 100644 --- a/AMDiS/src/ProblemNonLin.cc +++ b/AMDiS/src/ProblemNonLin.cc @@ -14,57 +14,55 @@ namespace AMDiS { ProblemScal::initialize(initFlag, adoptProblem, adoptFlag); // === create Updater === - if(updater_) { + if (updater_) { WARNING("updater already created\n"); } else { - if(initFlag.isSet(INIT_UPDATER) || - ((!adoptFlag.isSet(INIT_UPDATER))&& - (initFlag.isSet(INIT_NONLIN_SOLVER)))) - { - createUpdater(); - } - if(adoptProblem && - (adoptFlag.isSet(INIT_UPDATER) || - ((!initFlag.isSet(INIT_UPDATER))&& - (adoptFlag.isSet(INIT_NONLIN_SOLVER))))) - { - TEST_EXIT(updater_ == NULL)("updater already created\n"); - updater_ = dynamic_cast<ProblemNonLinScal*>(adoptProblem)->getUpdater(); - } + if (initFlag.isSet(INIT_UPDATER) || + ((!adoptFlag.isSet(INIT_UPDATER))&& + (initFlag.isSet(INIT_NONLIN_SOLVER)))) { + createUpdater(); + } + + if (adoptProblem && + (adoptFlag.isSet(INIT_UPDATER) || + ((!initFlag.isSet(INIT_UPDATER))&& + (adoptFlag.isSet(INIT_NONLIN_SOLVER))))) { + TEST_EXIT(updater_ == NULL)("updater already created\n"); + updater_ = dynamic_cast<ProblemNonLinScal*>(adoptProblem)->getUpdater(); + } } if(updater_==NULL) WARNING("no updater created\n"); // === create nonlinear solver === - if(nonLinSolver_) { + if (nonLinSolver_) { WARNING("nonlinear solver already created\n"); } else { - if(initFlag.isSet(INIT_NONLIN_SOLVER)) - { - createNonLinSolver(); - } - if(adoptProblem && - (adoptFlag.isSet(INIT_NONLIN_SOLVER))) - { - TEST_EXIT(nonLinSolver_==NULL)("nonlinear solver already created\n"); - nonLinSolver_ = dynamic_cast<ProblemNonLinScal*>(adoptProblem)->getNonLinSolver(); - } + if (initFlag.isSet(INIT_NONLIN_SOLVER)) { + createNonLinSolver(); + } + + if (adoptProblem && adoptFlag.isSet(INIT_NONLIN_SOLVER)) { + TEST_EXIT(nonLinSolver_==NULL)("nonlinear solver already created\n"); + nonLinSolver_ = dynamic_cast<ProblemNonLinScal*>(adoptProblem)->getNonLinSolver(); + } } - if(nonLinSolver_==NULL) WARNING("no nonlinear solver created\n"); + if (nonLinSolver_ == NULL) + WARNING("no nonlinear solver created\n"); } void ProblemNonLinScal::createNonLinSolver() { // create non-linear solver - std::string nonLinSolverType("no"); + std::string nonLinSolverType("no"); - GET_PARAMETER(0, name_ + "->nonlin solver", &nonLinSolverType); + GET_PARAMETER(0, name + "->nonlin solver", &nonLinSolverType); NonLinSolverCreator<DOFVector<double> > *nonLinSolverCreator = - dynamic_cast<NonLinSolverCreator<DOFVector<double> >*>( - CreatorMap<NonLinSolver<DOFVector<double> > >::getCreator(nonLinSolverType)); + dynamic_cast<NonLinSolverCreator<DOFVector<double> >*>(CreatorMap<NonLinSolver<DOFVector<double> > >::getCreator(nonLinSolverType)); + nonLinSolverCreator->setLinearSolver(solver); - nonLinSolverCreator->setName(name_ + "->nonlin solver"); + nonLinSolverCreator->setName(name + "->nonlin solver"); nonLinSolverCreator->setNonLinUpdater(updater_); nonLinSolver_ = nonLinSolverCreator->create(); nonLinSolver_->setVectorCreator(NEW DOFVector<double>::Creator(feSpace_)); @@ -72,7 +70,7 @@ namespace AMDiS { void ProblemNonLinScal::solve(AdaptInfo *adaptInfo) { TEST_EXIT(nonLinSolver_)("no non-linear solver!\n"); - int iter = nonLinSolver_->solve(matVec_, solution, rhs, leftPrecon, rightPrecon); + int iter = nonLinSolver_->solve(matVec, solution, rhs, leftPrecon, rightPrecon); adaptInfo->setSolverIterations(iter); } @@ -103,58 +101,54 @@ namespace AMDiS { ProblemVec::initialize(initFlag, adoptProblem, adoptFlag); // === create Updater === - if(updater_) { + if (updater_) { WARNING("updater already created\n"); } else { - if(initFlag.isSet(INIT_UPDATER) || - ((!adoptFlag.isSet(INIT_UPDATER))&& - (initFlag.isSet(INIT_NONLIN_SOLVER)))) - { - createUpdater(); - } - if(adoptProblem && - (adoptFlag.isSet(INIT_UPDATER) || - ((!initFlag.isSet(INIT_UPDATER))&& - (adoptFlag.isSet(INIT_NONLIN_SOLVER))))) - { - TEST_EXIT(updater_==NULL)("updater already created\n"); - updater_ = dynamic_cast<ProblemNonLinVec*>(adoptProblem)->getUpdater(); - } + if (initFlag.isSet(INIT_UPDATER) || + ((!adoptFlag.isSet(INIT_UPDATER)) && initFlag.isSet(INIT_NONLIN_SOLVER))) { + createUpdater(); + } + + if (adoptProblem && + (adoptFlag.isSet(INIT_UPDATER) || + ((!initFlag.isSet(INIT_UPDATER))&& adoptFlag.isSet(INIT_NONLIN_SOLVER)))) { + TEST_EXIT(updater_==NULL)("updater already created\n"); + updater_ = dynamic_cast<ProblemNonLinVec*>(adoptProblem)->getUpdater(); + } } - if(updater_==NULL) WARNING("no updater created\n"); + if (updater_ == NULL) + WARNING("no updater created\n"); // === create nonlinear solver === - if(nonLinSolver_) { + if (nonLinSolver_) { WARNING("nonlinear solver already created\n"); } else { - if(initFlag.isSet(INIT_NONLIN_SOLVER)) - { - createNonLinSolver(); - } - if(adoptProblem && - (adoptFlag.isSet(INIT_NONLIN_SOLVER))) - { - TEST_EXIT(nonLinSolver_==NULL)("nonlinear solver already created\n"); - nonLinSolver_ = dynamic_cast<ProblemNonLinVec*>(adoptProblem)->getNonLinSolver(); - } - } + if (initFlag.isSet(INIT_NONLIN_SOLVER)) { + createNonLinSolver(); + } - if(nonLinSolver_==NULL) WARNING("no nonlinear solver created\n"); + if (adoptProblem && adoptFlag.isSet(INIT_NONLIN_SOLVER)) { + TEST_EXIT(nonLinSolver_ == NULL)("nonlinear solver already created\n"); + nonLinSolver_ = dynamic_cast<ProblemNonLinVec*>(adoptProblem)->getNonLinSolver(); + } + } + if (nonLinSolver_ == NULL) + WARNING("no nonlinear solver created\n"); } void ProblemNonLinVec::createNonLinSolver() { // create non-linear solver std::string nonLinSolverType("no"); - GET_PARAMETER(0, name_ + "->nonlin solver", &nonLinSolverType); + GET_PARAMETER(0, name + "->nonlin solver", &nonLinSolverType); NonLinSolverCreator<SystemVector> *nonLinSolverCreator = - dynamic_cast<NonLinSolverCreator<SystemVector>*>( - CreatorMap<NonLinSolver<SystemVector> >::getCreator(nonLinSolverType)); - nonLinSolverCreator->setLinearSolver(solver_); - nonLinSolverCreator->setName(name_ + "->nonlin solver"); + dynamic_cast<NonLinSolverCreator<SystemVector>*>(CreatorMap<NonLinSolver<SystemVector> >::getCreator(nonLinSolverType)); + + nonLinSolverCreator->setLinearSolver(solver); + nonLinSolverCreator->setName(name + "->nonlin solver"); nonLinSolverCreator->setNonLinUpdater(updater_); nonLinSolver_ = nonLinSolverCreator->create(); nonLinSolver_->setVectorCreator(NEW SystemVector::Creator("temp", @@ -165,16 +159,16 @@ namespace AMDiS { void ProblemNonLinVec::solve(AdaptInfo *adaptInfo) { TEST_EXIT(nonLinSolver_)("no non-linear solver!\n"); - nonLinSolver_->solve(matVec_, solution_, rhs_, leftPrecon_, rightPrecon_); + nonLinSolver_->solve(matVec, solution, rhs, leftPrecon, rightPrecon); } void ProblemNonLinVec::buildAfterCoarsen(AdaptInfo *adaptInfo, Flag) { FUNCNAME("ProblemNonLinVec::buildAfterCoarsen()"); - int nMeshes = static_cast<int>(meshes_.size()); + int nMeshes = static_cast<int>(meshes.size()); for (int i = 0; i < nMeshes; i++) { - meshes_[i]->dofCompress(); + meshes[i]->dofCompress(); } for (int i = 0; i < nComponents; i++) { @@ -195,9 +189,9 @@ namespace AMDiS { Mesh::FILL_DET | Mesh::FILL_GRD_LAMBDA); while (elInfo) { - if (solution_->getDOFVector(i)->getBoundaryManager()) { - solution_->getDOFVector(i)-> - getBoundaryManager()->fillBoundaryConditions(elInfo, solution_->getDOFVector(i)); + if (solution->getDOFVector(i)->getBoundaryManager()) { + solution->getDOFVector(i)-> + getBoundaryManager()->fillBoundaryConditions(elInfo, solution->getDOFVector(i)); } elInfo = stack.traverseNext(elInfo); } diff --git a/AMDiS/src/ProblemNonLin.h b/AMDiS/src/ProblemNonLin.h index 045d6013233ff7125fab8aa85e144d2a9360b578..2c2c8b4918c117021f28b230c1777181021c9f13 100644 --- a/AMDiS/src/ProblemNonLin.h +++ b/AMDiS/src/ProblemNonLin.h @@ -55,12 +55,12 @@ namespace AMDiS { u0_(NULL), nonLinSolver_(NULL), updater_(NULL) - {}; + {} /** \brief * Destructor. */ - virtual ~ProblemNonLinScal() {}; + virtual ~ProblemNonLinScal() {} /** \brief * Initialisation of the problem. @@ -180,13 +180,13 @@ namespace AMDiS { FUNCNAME("ProblemNonLinVec::setU0()"); TEST_EXIT(index < nComponents)("invalid index\n"); u0_[index] = u0Fct; - solution_->getDOFVector(index)->interpol(u0Fct); + solution->getDOFVector(index)->interpol(u0Fct); } /** \brief * Destructor. */ - virtual ~ProblemNonLinVec() {}; + virtual ~ProblemNonLinVec() {} /** \brief * Initialisation of the problem. @@ -199,7 +199,7 @@ namespace AMDiS { * Used in \ref initialize(). */ virtual void createUpdater() { - updater_ = NEW NonLinUpdaterVec(systemMatrix_); + updater_ = NEW NonLinUpdaterVec(systemMatrix); } /** \brief @@ -224,7 +224,7 @@ namespace AMDiS { */ inline NonLinSolver<SystemVector> *getNonLinSolver() { return nonLinSolver_; - }; + } /** \brief * Returns \ref updater. diff --git a/AMDiS/src/ProblemScal.cc b/AMDiS/src/ProblemScal.cc index b1841b8f4d033091fe313f651f4fd00df8766f6c..10bb8438eafc4d0a951784ad05fba0ad237afe11 100644 --- a/AMDiS/src/ProblemScal.cc +++ b/AMDiS/src/ProblemScal.cc @@ -124,7 +124,7 @@ namespace AMDiS { AbstractFunction<double, WorldVector<double> > *n) { NeumannBC *neumann = new NeumannBC(type, n, feSpace_); - if(rhs) + if (rhs) rhs->getBoundaryManager()->addBoundaryCondition(neumann); } @@ -156,14 +156,14 @@ namespace AMDiS { // === create problems mesh === std::string meshName(""); - GET_PARAMETER(0, name_ + "->info", "%d", &info_); - GET_PARAMETER(0, name_ + "->mesh", &meshName); + GET_PARAMETER(0, name + "->info", "%d", &info_); + GET_PARAMETER(0, name + "->mesh", &meshName); TEST_EXIT(meshName != "")("no mesh name specified\n"); // get problem dimension int dim = 0; - GET_PARAMETER(0, name_ + "->dim", "%d", &dim); + GET_PARAMETER(0, name + "->dim", "%d", &dim); TEST_EXIT(dim)("no problem dimension specified!\n"); // create the mesh @@ -236,7 +236,7 @@ namespace AMDiS { #endif clock_t first = clock(); - int iter = solver->solve(matVec_, solution, rhs, leftPrecon, rightPrecon); + int iter = solver->solve(matVec, solution, rhs, leftPrecon, rightPrecon); #ifdef _OPENMP INFO(info_, 8)("solution of discrete system needed %.5f seconds system time / %.5f seconds wallclock time\n", @@ -382,10 +382,10 @@ namespace AMDiS { // If the parameter -rs is set, we do nothing here, because the problem will be // deserialized in the constructor of a following AdaptInstationary initialization. if (!serializationFilename.compare("")) { - GET_PARAMETER(0, name_ + "->input->read serialization", "%d", + GET_PARAMETER(0, name + "->input->read serialization", "%d", &readSerialization); if (readSerialization) { - GET_PARAMETER(0, name_ + "->input->serialization filename", + GET_PARAMETER(0, name + "->input->serialization filename", &serializationFilename); TEST_EXIT(serializationFilename != "")("no serialization file\n"); @@ -424,11 +424,11 @@ namespace AMDiS { { // create finite element space int degree = 1; - GET_PARAMETER(0, name_ + "->polynomial degree" ,"%d", °ree); + GET_PARAMETER(0, name + "->polynomial degree" ,"%d", °ree); feSpace_ = FiniteElemSpace::provideFESpace(NULL, Lagrange::getLagrange(mesh->getDim(), degree), mesh, - name_ + "->feSpace"); + name + "->feSpace"); // create dof admin for vertex dofs if neccessary if (mesh->getNumberOfDOFs(VERTEX) == 0) { @@ -449,31 +449,31 @@ namespace AMDiS { solution->set(0.0); /* initialize u_h ! */ // === create matVec === - matVec_ = NEW StandardMatVec<DOFMatrix, DOFVector<double> >(systemMatrix); + matVec = NEW StandardMatVec<DOFMatrix, DOFVector<double> >(systemMatrix); } void ProblemScal::createSolver() { // === create solver === std::string solverType("no"); - GET_PARAMETER(0, name_ + "->solver", &solverType); + GET_PARAMETER(0, name + "->solver", &solverType); OEMSolverCreator<DOFVector<double> > *solverCreator = dynamic_cast<OEMSolverCreator<DOFVector<double> >*>(CreatorMap<OEMSolver<DOFVector<double> > >::getCreator(solverType)); TEST_EXIT(solverCreator)("no solver type\n"); - solverCreator->setName(name_ + "->solver"); + solverCreator->setName(name + "->solver"); solver = solverCreator->create(); solver->initParameters(); // === create preconditioners === std::string preconType("no"); Preconditioner<DOFVector<double> > *precon; - GET_PARAMETER(0, name_ + "->solver->left precon", &preconType); + GET_PARAMETER(0, name + "->solver->left precon", &preconType); CreatorInterface<PreconditionerScal> *preconCreator = CreatorMap<PreconditionerScal>::getCreator(preconType); if (!preconCreator->isNullCreator()) { dynamic_cast<PreconditionerScalCreator*>(preconCreator)->setSizeAndRow(1, 0); - dynamic_cast<PreconditionerScalCreator*>(preconCreator)->setName(name_ + "->solver->left precon"); + dynamic_cast<PreconditionerScalCreator*>(preconCreator)->setName(name + "->solver->left precon"); } precon = preconCreator->create(); @@ -484,12 +484,12 @@ namespace AMDiS { } preconType.assign("no"); - GET_PARAMETER(0, name_ + "->solver->right precon", &preconType); + GET_PARAMETER(0, name + "->solver->right precon", &preconType); preconCreator = CreatorMap<PreconditionerScal>::getCreator(preconType); if (!preconCreator->isNullCreator()) { dynamic_cast<PreconditionerScalCreator*>(preconCreator)->setSizeAndRow(1, 0); - dynamic_cast<PreconditionerScalCreator*>(preconCreator)->setName(name_ + "->solver->left precon"); + dynamic_cast<PreconditionerScalCreator*>(preconCreator)->setName(name + "->solver->left precon"); } precon = preconCreator->create(); @@ -510,12 +510,12 @@ namespace AMDiS { // === create estimator === std::string estimatorType("no"); - GET_PARAMETER(0, name_ + "->estimator", &estimatorType); + GET_PARAMETER(0, name + "->estimator", &estimatorType); EstimatorCreator *estimatorCreator = dynamic_cast<EstimatorCreator*>( CreatorMap<Estimator>::getCreator(estimatorType)); if (estimatorCreator) { - estimatorCreator->setName(name_ + "->estimator"); + estimatorCreator->setName(name + "->estimator"); if (estimatorType == "recovery") { dynamic_cast<RecoveryEstimator::Creator*>(estimatorCreator)->setSolution(solution); } @@ -528,14 +528,14 @@ namespace AMDiS { void ProblemScal::createMarker() { - marker = dynamic_cast<Marker*>(Marker::createMarker(name_ + "->marker", -1)); + marker = dynamic_cast<Marker*>(Marker::createMarker(name + "->marker", -1)); } void ProblemScal::createFileWriter() { - fileWriters.push_back(NEW FileWriter(name_ + "->output", mesh, solution)); + fileWriters.push_back(NEW FileWriter(name + "->output", mesh, solution)); int writeSerialization = 0; - GET_PARAMETER(0, name_ + "->output->write serialization", "%d", + GET_PARAMETER(0, name + "->output->write serialization", "%d", &writeSerialization); if (writeSerialization) { fileWriters.push_back(NEW Serializer<ProblemScal>(this)); @@ -661,26 +661,19 @@ namespace AMDiS { void ProblemScal::writeResidualMesh(AdaptInfo *adaptInfo, const std::string name) { - FUNCNAME("ProblemVec::writeResidualMesh()"); + FUNCNAME("ProblemScal::writeResidualMesh()"); - Mesh *mesh = this->getMesh(); - FiniteElemSpace *fe = this->getFESpace(); std::map<int, double> vec; TraverseStack stack; - ElInfo *elInfo = stack.traverseFirst(mesh, - -1, - Mesh::CALL_LEAF_EL | - Mesh::FILL_COORDS); + ElInfo *elInfo = stack.traverseFirst(this->getMesh(), -1, + Mesh::CALL_LEAF_EL | Mesh::FILL_COORDS); while (elInfo) { - Element *el = elInfo->getElement(); - double lError = el->getEstimation(0); - - vec[elInfo->getElement()->getIndex()] = lError; + vec[elInfo->getElement()->getIndex()] = elInfo->getElement()->getEstimation(0); elInfo = stack.traverseNext(elInfo); } - ElementFileWriter fw(name, mesh, fe, vec); + ElementFileWriter fw(name, this->getFESpace(), vec); fw.writeFiles(adaptInfo, true); } diff --git a/AMDiS/src/ProblemScal.h b/AMDiS/src/ProblemScal.h index 510d8e4f54f05fa6e43c704c3a5c01b30c2a3334..55ea24b9cd8c5e597e9aee5b95f84d74fe0dd16a 100644 --- a/AMDiS/src/ProblemScal.h +++ b/AMDiS/src/ProblemScal.h @@ -55,10 +55,10 @@ namespace AMDiS { public: MEMORY_MANAGED(ProblemScal); - ProblemScal(const char *name, + ProblemScal(const std::string &nameStr, ProblemIterationInterface *problemIteration = NULL) : StandardProblemIteration(this), - name_(name), + name(nameStr), feSpace_(NULL), mesh(NULL), marker(NULL), @@ -67,7 +67,7 @@ namespace AMDiS { solution(NULL), rhs(NULL), systemMatrix(NULL), - matVec_(NULL), + matVec(NULL), leftPrecon(NULL), rightPrecon(NULL), useGetBound_(true), @@ -325,10 +325,10 @@ namespace AMDiS { } /** \brief - * Returns \ref name_. + * Returns \ref name. */ virtual inline const std::string& getName() { - return name_; + return name; } /** \brief @@ -436,10 +436,8 @@ namespace AMDiS { static int buildAfterCoarsenFct(ElInfo *elInfo); protected: - /** \brief - * Name of this problem. - */ - std::string name_; + /// Name of this problem. + std::string name; /** \brief * FiniteElemSpace of this problem. @@ -484,7 +482,7 @@ namespace AMDiS { /** \brief * Matrix-vector multiplication */ - MatVecMultiplier<DOFVector<double> > *matVec_; + MatVecMultiplier<DOFVector<double> > *matVec; /** \brief * Left preconditioner. Used in \ref solver. diff --git a/AMDiS/src/ProblemVec.cc b/AMDiS/src/ProblemVec.cc index 3d8817d387aa0cc59dc05bf1998ec546b2c2d2e4..0a532940db8f14a047352279fd7962f265461430 100644 --- a/AMDiS/src/ProblemVec.cc +++ b/AMDiS/src/ProblemVec.cc @@ -1,3 +1,5 @@ +#include <sstream> + #include "ProblemVec.h" #include "RecoveryEstimator.h" #include "Serializer.h" @@ -26,8 +28,6 @@ namespace AMDiS { - ProblemVec *ProblemVec::traversePtr_ = NULL; - void ProblemVec::initialize(Flag initFlag, ProblemVec *adoptProblem, Flag adoptFlag) @@ -35,7 +35,7 @@ namespace AMDiS { FUNCNAME("ProblemVec::initialize()"); // === create meshes === - if (meshes_.size() != 0) { + if (meshes.size() != 0) { WARNING("meshes already created\n"); } else { if (initFlag.isSet(CREATE_MESH) || @@ -47,15 +47,15 @@ namespace AMDiS { (adoptFlag.isSet(INIT_MESH) || adoptFlag.isSet(INIT_SYSTEM) || adoptFlag.isSet(INIT_FE_SPACE))) { - meshes_ = adoptProblem->getMeshes(); + meshes = adoptProblem->getMeshes(); componentMeshes = adoptProblem->componentMeshes; - refinementManager_ = adoptProblem->refinementManager_; - coarseningManager_ = adoptProblem->coarseningManager_; + refinementManager = adoptProblem->refinementManager; + coarseningManager = adoptProblem->coarseningManager; // If the adopt problem has fewer components than this problem, but only one // mesh for all component, than scal up the componentMeshes array. if (adoptProblem->getNumComponents() < nComponents) { - TEST_EXIT(meshes_.size() == 1)("Daran muss ich noch arbeiten!\n"); + TEST_EXIT(meshes.size() == 1)("Daran muss ich noch arbeiten!\n"); componentMeshes.resize(nComponents); for (int i = adoptProblem->getNumComponents(); i < nComponents; i++) { @@ -66,7 +66,7 @@ namespace AMDiS { } } - if (meshes_.size() == 0) + if (meshes.size() == 0) WARNING("no mesh created\n"); // === create fespace === @@ -81,6 +81,7 @@ namespace AMDiS { (adoptFlag.isSet(INIT_FE_SPACE) || adoptFlag.isSet(INIT_SYSTEM))) { feSpaces = adoptProblem->getFESpaces(); componentSpaces = adoptProblem->componentSpaces; + traverseInfo = adoptProblem->traverseInfo; // If the adopt problem has fewer components than this problem, but only one // fe space for all component, than scal up the componentSpaces array. @@ -104,25 +105,25 @@ namespace AMDiS { createMatricesAndVectors(); } if (adoptProblem && adoptFlag.isSet(INIT_SYSTEM)) { - solution_ = adoptProblem->getSolution(); - rhs_ = adoptProblem->getRHS(); - systemMatrix_ = adoptProblem->getSystemMatrix(); + solution = adoptProblem->getSolution(); + rhs = adoptProblem->getRHS(); + systemMatrix = adoptProblem->getSystemMatrix(); } // === create solver === - if (solver_) { + if (solver) { WARNING("solver already created\n"); } else { if (initFlag.isSet(INIT_SOLVER)) { createSolver(); } if (adoptProblem && adoptFlag.isSet(INIT_SOLVER)) { - TEST_EXIT(!solver_)("solver already created\n"); - solver_ = adoptProblem->getSolver(); + TEST_EXIT(!solver)("solver already created\n"); + solver = adoptProblem->getSolver(); } } - if (!solver_) + if (!solver) WARNING("no solver created\n"); // === create estimator === @@ -130,7 +131,7 @@ namespace AMDiS { createEstimator(); } if (adoptProblem && adoptFlag.isSet(INIT_ESTIMATOR)) { - estimator_ = adoptProblem->getEstimator(); + estimator = adoptProblem->getEstimator(); } // === create marker === @@ -165,9 +166,9 @@ namespace AMDiS { if (!serializationFilename.compare("")) { int readSerializationWithAdaptInfo = 0; - GET_PARAMETER(0, name_ + "->input->read serialization", "%d", + GET_PARAMETER(0, name + "->input->read serialization", "%d", &readSerialization); - GET_PARAMETER(0, name_ + "->input->serialization with adaptinfo", "%d", + GET_PARAMETER(0, name + "->input->serialization with adaptinfo", "%d", &readSerializationWithAdaptInfo); // The serialization file is only read, if the adaptInfo part should not be used. @@ -175,7 +176,7 @@ namespace AMDiS { // in the constructor of the AdaptInstationary problem, because we do not have here // the adaptInfo object. if (readSerialization && !readSerializationWithAdaptInfo) { - GET_PARAMETER(0, name_ + "->input->serialization filename", + GET_PARAMETER(0, name + "->input->serialization filename", &serializationFilename); TEST_EXIT(serializationFilename != "")("no serialization file\n"); @@ -185,16 +186,16 @@ namespace AMDiS { in.close(); } else { int globalRefinements = 0; - GET_PARAMETER(0, meshes_[0]->getName() + "->global refinements", "%d", + GET_PARAMETER(0, meshes[0]->getName() + "->global refinements", "%d", &globalRefinements); // Initialize the meshes if there is no serialization file. - for (int i = 0; i < static_cast<int>(meshes_.size()); i++) { + for (int i = 0; i < static_cast<int>(meshes.size()); i++) { if (initFlag.isSet(INIT_MESH) && - meshes_[i] && - !(meshes_[i]->isInitialized())) { - meshes_[i]->initialize(); - refinementManager_->globalRefine(meshes_[i], globalRefinements); + meshes[i] && + !(meshes[i]->isInitialized())) { + meshes[i]->initialize(); + refinementManager->globalRefine(meshes[i], globalRefinements); } } } @@ -212,38 +213,39 @@ namespace AMDiS { char number[3]; std::string meshName(""); - GET_PARAMETER(0, name_ + "->mesh", &meshName); + GET_PARAMETER(0, name + "->mesh", &meshName); TEST_EXIT(meshName != "")("no mesh name specified\n"); int dim = 0; - GET_PARAMETER(0, name_ + "->dim", "%d", &dim); + GET_PARAMETER(0, name + "->dim", "%d", &dim); TEST_EXIT(dim)("no problem dimension specified!\n"); for (int i = 0; i < nComponents; i++) { sprintf(number, "%d", i); int refSet = -1; - GET_PARAMETER(0, name_ + "->refinement set[" + number + "]", "%d", &refSet); + GET_PARAMETER(0, name + "->refinement set[" + number + "]", "%d", &refSet); if (refSet < 0) { refSet = 0; } if (meshForRefinementSet[refSet] == NULL) { Mesh *newMesh = NEW Mesh(meshName, dim); meshForRefinementSet[refSet] = newMesh; - meshes_.push_back(newMesh); + meshes.push_back(newMesh); + nMeshes++; } componentMeshes[i] = meshForRefinementSet[refSet]; } switch(dim) { case 1: - coarseningManager_ = NEW CoarseningManager1d(); - refinementManager_ = NEW RefinementManager1d(); + coarseningManager = NEW CoarseningManager1d(); + refinementManager = NEW RefinementManager1d(); break; case 2: - coarseningManager_ = NEW CoarseningManager2d(); - refinementManager_ = NEW RefinementManager2d(); + coarseningManager = NEW CoarseningManager2d(); + refinementManager = NEW RefinementManager2d(); break; case 3: - coarseningManager_ = NEW CoarseningManager3d(); - refinementManager_ = NEW RefinementManager3d(); + coarseningManager = NEW CoarseningManager3d(); + refinementManager = NEW RefinementManager3d(); break; default: ERROR_EXIT("invalid dim!\n"); @@ -254,41 +256,48 @@ namespace AMDiS { { FUNCNAME("ProblemVec::createFESpace()"); - int degree = 1; - char number[3]; - std::map< std::pair<Mesh*, int>, FiniteElemSpace*> feSpaceMap; int dim = -1; - GET_PARAMETER(0, name_ + "->dim", "%d", &dim); + GET_PARAMETER(0, name + "->dim", "%d", &dim); TEST_EXIT(dim != -1)("no problem dimension specified!\n"); componentSpaces.resize(nComponents, NULL); + traverseInfo.resize(nComponents); for (int i = 0; i < nComponents; i++) { + char number[3]; sprintf(number, "%d", i); - GET_PARAMETER(0, name_ + "->polynomial degree[" + number + "]","%d", °ree); + int degree = 1; + GET_PARAMETER(0, name + "->polynomial degree[" + number + "]","%d", °ree); TEST_EXIT(componentSpaces[i] == NULL)("feSpace already created\n"); if (feSpaceMap[std::pair<Mesh*, int>(componentMeshes[i], degree)] == NULL) { + stringstream s; + s << name << "->feSpace[" << i << "]"; + FiniteElemSpace *newFESpace = - FiniteElemSpace::provideFESpace(NULL, - Lagrange::getLagrange(dim, degree), - componentMeshes[i], - name_ + "->feSpace"); + FiniteElemSpace::provideFESpace(NULL, Lagrange::getLagrange(dim, degree), + componentMeshes[i], s.str()); feSpaceMap[std::pair<Mesh*, int>(componentMeshes[i], degree)] = newFESpace; feSpaces.push_back(newFESpace); } - componentSpaces[i] = - feSpaceMap[std::pair<Mesh*, int>(componentMeshes[i], degree)]; + componentSpaces[i] = feSpaceMap[std::pair<Mesh*, int>(componentMeshes[i], degree)]; + } + + for (int i = 0; i < nComponents; i++) { + for (int j = 0; j < nComponents; j++) { + traverseInfo.getMatrix(i, j).setFESpace(componentSpaces[i], componentSpaces[j]); + } + traverseInfo.getVector(i).setFESpace(componentSpaces[i]); } // create dof admin for vertex dofs if neccessary - for (int i = 0; i < static_cast<int>(meshes_.size()); i++) { - if (meshes_[i]->getNumberOfDOFs(VERTEX) == 0) { - DimVec<int> ln_dof(meshes_[i]->getDim(), DEFAULT_VALUE, 0); + for (int i = 0; i < static_cast<int>(meshes.size()); i++) { + if (meshes[i]->getNumberOfDOFs(VERTEX) == 0) { + DimVec<int> ln_dof(meshes[i]->getDim(), DEFAULT_VALUE, 0); ln_dof[VERTEX]= 1; - meshes_[i]->createDOFAdmin("vertex dofs", ln_dof); + meshes[i]->createDOFAdmin("vertex dofs", ln_dof); } } } @@ -299,29 +308,29 @@ namespace AMDiS { // === create vectors and system matrix === - systemMatrix_ = NEW Matrix<DOFMatrix*>(nComponents, nComponents); - systemMatrix_->set(NULL); - rhs_ = NEW SystemVector("rhs", componentSpaces, nComponents); - solution_ = NEW SystemVector("solution", componentSpaces, nComponents); + systemMatrix = NEW Matrix<DOFMatrix*>(nComponents, nComponents); + systemMatrix->set(NULL); + rhs = NEW SystemVector("rhs", componentSpaces, nComponents); + solution = NEW SystemVector("solution", componentSpaces, nComponents); char number[10]; std::string numberedName; for (int i = 0; i < nComponents; i++) { - (*systemMatrix_)[i][i] = NEW DOFMatrix(componentSpaces[i], + (*systemMatrix)[i][i] = NEW DOFMatrix(componentSpaces[i], componentSpaces[i], "A_ii"); - (*systemMatrix_)[i][i]->setCoupleMatrix(false); + (*systemMatrix)[i][i]->setCoupleMatrix(false); sprintf(number, "[%d]", i); numberedName = "rhs" + std::string(number); - rhs_->setDOFVector(i, NEW DOFVector<double>(componentSpaces[i], numberedName)); - numberedName = name_ + std::string(number); - solution_->setDOFVector(i, NEW DOFVector<double>(componentSpaces[i], + rhs->setDOFVector(i, NEW DOFVector<double>(componentSpaces[i], numberedName)); + numberedName = name + std::string(number); + solution->setDOFVector(i, NEW DOFVector<double>(componentSpaces[i], numberedName)); - solution_->getDOFVector(i)->setCoarsenOperation(COARSE_INTERPOL); - solution_->getDOFVector(i)->set(0.0); + solution->getDOFVector(i)->setCoarsenOperation(COARSE_INTERPOL); + solution->getDOFVector(i)->set(0.0); } // === create matVec === - matVec_ = NEW StandardMatVec<Matrix<DOFMatrix*>, SystemVector>(systemMatrix_); + matVec = NEW StandardMatVec<Matrix<DOFMatrix*>, SystemVector>(systemMatrix); } void ProblemVec::createSolver() @@ -330,16 +339,16 @@ namespace AMDiS { // === create solver === std::string solverType("no"); - GET_PARAMETER(0, name_ + "->solver", &solverType); + GET_PARAMETER(0, name + "->solver", &solverType); OEMSolverCreator<SystemVector> *solverCreator = dynamic_cast<OEMSolverCreator<SystemVector>*>( CreatorMap<OEMSolver<SystemVector> > ::getCreator(solverType) ); TEST_EXIT(solverCreator)("no solver type\n"); - solverCreator->setName(name_ + "->solver"); - solver_ = solverCreator->create(); - solver_->initParameters(); + solverCreator->setName(name + "->solver"); + solver = solverCreator->create(); + solver->initParameters(); // === create preconditioners === std::string preconType("no"); @@ -347,57 +356,55 @@ namespace AMDiS { PreconditionerScal *scalPrecon; PreconditionerVec *vecPrecon = NEW PreconditionerVec(nComponents); - GET_PARAMETER(0, name_ + "->solver->left precon", &preconType); + GET_PARAMETER(0, name + "->solver->left precon", &preconType); CreatorInterface<PreconditionerScal> *preconCreator = CreatorMap<PreconditionerScal>::getCreator(preconType); - int i, j; - if (!preconCreator->isNullCreator()) { dynamic_cast<PreconditionerScalCreator*>(preconCreator)-> - setName(name_ + "->solver->left precon"); + setName(name + "->solver->left precon"); - for(i = 0; i < nComponents; i++) { + for (int i = 0; i < nComponents; i++) { dynamic_cast<PreconditionerScalCreator*>(preconCreator)-> setSizeAndRow(nComponents, i); scalPrecon = preconCreator->create(); - for(j = 0; j < nComponents; j++) { - scalPrecon->setMatrix(&(*systemMatrix_)[i][j], j); + for (int j = 0; j < nComponents; j++) { + scalPrecon->setMatrix(&(*systemMatrix)[i][j], j); } vecPrecon->setScalarPrecon(i, scalPrecon); } - leftPrecon_ = vecPrecon; + leftPrecon = vecPrecon; } vecPrecon = NEW PreconditionerVec(nComponents); - GET_PARAMETER(0, name_ + "->solver->right precon", &preconType); + GET_PARAMETER(0, name + "->solver->right precon", &preconType); preconCreator = CreatorMap<PreconditionerScal>::getCreator(preconType); - if(!preconCreator->isNullCreator()) { + if (!preconCreator->isNullCreator()) { dynamic_cast<PreconditionerScalCreator*>(preconCreator)-> - setName(name_ + "->solver->left precon"); + setName(name + "->solver->left precon"); - for(i = 0; i < nComponents; i++) { + for (int i = 0; i < nComponents; i++) { dynamic_cast<PreconditionerScalCreator*>(preconCreator)-> setSizeAndRow(nComponents, i); scalPrecon = preconCreator->create(); - for(j = 0; j < nComponents; j++) { - scalPrecon->setMatrix(&(*systemMatrix_)[i][j], j); + for (int j = 0; j < nComponents; j++) { + scalPrecon->setMatrix(&(*systemMatrix)[i][j], j); } vecPrecon->setScalarPrecon(i, scalPrecon); } - rightPrecon_ = vecPrecon; + rightPrecon = vecPrecon; } // === create vector creator === - solver_->setVectorCreator(NEW SystemVector::Creator("temp", + solver->setVectorCreator(NEW SystemVector::Creator("temp", componentSpaces, nComponents)); } @@ -406,21 +413,19 @@ namespace AMDiS { { FUNCNAME("ProblemVec::createEstimator()"); - int i, j; - // create and set leaf data prototype - for(i = 0; i < static_cast<int>(meshes_.size()); i++) { - meshes_[i]->setElementDataPrototype + for (int i = 0; i < static_cast<int>(meshes.size()); i++) { + meshes[i]->setElementDataPrototype (NEW LeafDataEstimatableVec(NEW LeafDataCoarsenableVec)); } char number[3]; std::string estName; - for(i = 0; i < nComponents; i++) { - TEST_EXIT(estimator_[i] == NULL)("estimator already created\n"); + for (int i = 0; i < nComponents; i++) { + TEST_EXIT(estimator[i] == NULL)("estimator already created\n"); sprintf(number, "%d", i); - estName = name_ + "->estimator[" + std::string(number) + "]"; + estName = name + "->estimator[" + std::string(number) + "]"; // === create estimator === std::string estimatorType("no"); @@ -428,22 +433,22 @@ namespace AMDiS { EstimatorCreator *estimatorCreator = dynamic_cast<EstimatorCreator*>( CreatorMap<Estimator>::getCreator(estimatorType)); - if(estimatorCreator) { + if (estimatorCreator) { estimatorCreator->setName(estName); estimatorCreator->setRow(i); - if(estimatorType == "recovery") { + if (estimatorType == "recovery") { dynamic_cast<RecoveryEstimator::Creator*>(estimatorCreator)-> - setSolution(solution_->getDOFVector(i)); + setSolution(solution->getDOFVector(i)); } - estimator_[i] = estimatorCreator->create(); + estimator[i] = estimatorCreator->create(); } - if(estimator_[i]) { - for(j=0; j < nComponents; j++) { - estimator_[i]->addSystem((*systemMatrix_)[i][j], - solution_->getDOFVector(j), - rhs_->getDOFVector(j)); + if (estimator[i]) { + for (int j = 0; j < nComponents; j++) { + estimator[i]->addSystem((*systemMatrix)[i][j], + solution->getDOFVector(j), + rhs->getDOFVector(j)); } } } @@ -455,16 +460,19 @@ namespace AMDiS { std::string numberedName; char number[10]; - int numMarkersCreated = 0; + int nMarkersCreated = 0; for (int i = 0; i < nComponents; i++) { sprintf(number, "[%d]", i); - numberedName = name_ + "->marker" + std::string(number); + numberedName = name + "->marker" + std::string(number); marker[i] = Marker::createMarker(numberedName, i); if (marker[i]) { - numMarkersCreated++; - if (numMarkersCreated > 1) - marker[i]->setMaximumMarking(true); + nMarkersCreated++; + + // If there is more than one marker, and all components are defined + // on the same mesh, the maximum marking has to be enabled. + if ((nMarkersCreated > 1) && (nMeshes == 1)) + marker[i]->setMaximumMarking(true); } } } @@ -475,7 +483,7 @@ namespace AMDiS { // Create one filewriter for all components of the problem - std::string numberedName = name_ + "->output"; + std::string numberedName = name + "->output"; std::string filename = ""; GET_PARAMETER(0, numberedName + "->filename", &filename); @@ -486,10 +494,10 @@ namespace AMDiS { TEST_EXIT(componentMeshes[0] == componentMeshes[i]) ("All Meshes have to be equal to write a vector file.\n"); - solutionList[i] = solution_->getDOFVector(i); + solutionList[i] = solution->getDOFVector(i); } - fileWriters_.push_back(NEW FileWriter(numberedName, + fileWriters.push_back(NEW FileWriter(numberedName, componentMeshes[0], solutionList)); } @@ -499,30 +507,30 @@ namespace AMDiS { char number[10]; for (int i = 0; i < nComponents; i++) { sprintf(number, "[%d]", i); - numberedName = name_ + "->output" + std::string(number); + numberedName = name + "->output" + std::string(number); filename = ""; GET_PARAMETER(0, numberedName + "->filename", &filename); if (filename != "") { - fileWriters_.push_back(NEW FileWriter(numberedName, + fileWriters.push_back(NEW FileWriter(numberedName, componentMeshes[i], - solution_->getDOFVector(i))); + solution->getDOFVector(i))); } } // Check for serializer int writeSerialization = 0; - GET_PARAMETER(0, name_ + "->write serialization", "%d", &writeSerialization); + GET_PARAMETER(0, name + "->write serialization", "%d", &writeSerialization); if (writeSerialization) { - MSG("Use are using the obsolete parameter: %s->write serialization\n", name_.c_str()); - MSG("Please use instead the following parameter: %s->output->write serialization\n", name_.c_str()); + MSG("Use are using the obsolete parameter: %s->write serialization\n", name.c_str()); + MSG("Please use instead the following parameter: %s->output->write serialization\n", name.c_str()); ERROR_EXIT("Usage of an obsolete parameter (see message above)!\n"); } - GET_PARAMETER(0, name_ + "->output->write serialization", "%d", &writeSerialization); + GET_PARAMETER(0, name + "->output->write serialization", "%d", &writeSerialization); if (writeSerialization) { - fileWriters_.push_back(NEW Serializer<ProblemVec>(this)); + fileWriters.push_back(NEW Serializer<ProblemVec>(this)); } } @@ -534,7 +542,7 @@ namespace AMDiS { { FUNCNAME("Problem::solve()"); - if (!solver_) { + if (!solver) { WARNING("no solver\n"); return; } @@ -544,23 +552,21 @@ namespace AMDiS { #endif clock_t first = clock(); - int iter = solver_->solve(matVec_, solution_, rhs_, - leftPrecon_, rightPrecon_, fixedMatrix); + int iter = solver->solve(matVec, solution, rhs, leftPrecon, rightPrecon, fixedMatrix); #ifdef _OPENMP - INFO(info_, 8)("solution of discrete system needed %.5f seconds system time / %.5f seconds wallclock time\n", - TIME_USED(first, clock()), - omp_get_wtime() - wtime); + INFO(info, 8)("solution of discrete system needed %.5f seconds system time / %.5f seconds wallclock time\n", + TIME_USED(first, clock()), omp_get_wtime() - wtime); #else - INFO(info_, 8)("solution of discrete system needed %.5f seconds\n", - TIME_USED(first, clock())); + INFO(info, 8)("solution of discrete system needed %.5f seconds\n", + TIME_USED(first, clock())); #endif adaptInfo->setSolverIterations(iter); - adaptInfo->setMaxSolverIterations(solver_->getMaxIterations()); - adaptInfo->setSolverTolerance(solver_->getTolerance()); - adaptInfo->setSolverResidual(solver_->getResidual()); + adaptInfo->setMaxSolverIterations(solver->getMaxIterations()); + adaptInfo->setSolverTolerance(solver->getTolerance()); + adaptInfo->setSolverResidual(solver->getResidual()); } void ProblemVec::estimate(AdaptInfo *adaptInfo) @@ -577,7 +583,7 @@ namespace AMDiS { computeError(adaptInfo); } else { for (int i = 0; i < nComponents; i++) { - Estimator *scalEstimator = estimator_[i]; + Estimator *scalEstimator = estimator[i]; if (scalEstimator) { scalEstimator->estimate(adaptInfo->getTimestep()); @@ -592,12 +598,11 @@ namespace AMDiS { } #ifdef _OPENMP - INFO(info_, 8)("estimation of the error needed %.5f seconds system time / %.5f seconds wallclock time\n", - TIME_USED(first, clock()), - omp_get_wtime() - wtime); + INFO(info, 8)("estimation of the error needed %.5f seconds system time / %.5f seconds wallclock time\n", + TIME_USED(first, clock()), omp_get_wtime() - wtime); #else - INFO(info_, 8)("estimation of the error needed %.5f seconds\n", - TIME_USED(first, clock())); + INFO(info, 8)("estimation of the error needed %.5f seconds\n", + TIME_USED(first, clock())); #endif @@ -627,10 +632,10 @@ namespace AMDiS { { FUNCNAME("ProblemVec::refineMesh()"); - int nMeshes = static_cast<int>(meshes_.size()); + int nMeshes = static_cast<int>(meshes.size()); Flag refineFlag = 0; for (int i = 0; i < nMeshes; i++) { - refineFlag |= refinementManager_->refineMesh(meshes_[i]); + refineFlag |= refinementManager->refineMesh(meshes[i]); } return refineFlag; } @@ -639,11 +644,11 @@ namespace AMDiS { { FUNCNAME("ProblemVec::coarsenMesh()"); - int nMeshes = static_cast<int>(meshes_.size()); + int nMeshes = static_cast<int>(meshes.size()); Flag coarsenFlag = 0; for (int i = 0; i < nMeshes; i++) { if (adaptInfo->isCoarseningAllowed(i)) { - coarsenFlag |= coarseningManager_->coarsenMesh(meshes_[i]); + coarsenFlag |= coarseningManager->coarsenMesh(meshes[i]); WARNING("coarsening for component %d no allowed\n", i); } @@ -655,11 +660,11 @@ namespace AMDiS { { FUNCNAME("ProblemVec::oneIteration()"); - if (allowFirstRef_) { + if (allowFirstRef) { for (int i = 0; i < nComponents; i++) { adaptInfo->allowRefinement(true, i); } - allowFirstRef_ = false; + allowFirstRef = false; } else { for (int i = 0; i < nComponents; i++) { if (adaptInfo->spaceToleranceReached(i)) { @@ -684,21 +689,21 @@ namespace AMDiS { double wtime = omp_get_wtime(); #endif - for (int i = 0; i < static_cast<int>(meshes_.size()); i++) { - meshes_[i]->dofCompress(); + for (int i = 0; i < static_cast<int>(meshes.size()); i++) { + meshes[i]->dofCompress(); } Flag assembleFlag = flag | - (*systemMatrix_)[0][0]->getAssembleFlag() | - rhs_->getDOFVector(0)->getAssembleFlag() | + (*systemMatrix)[0][0]->getAssembleFlag() | + rhs->getDOFVector(0)->getAssembleFlag() | Mesh::CALL_LEAF_EL | Mesh::FILL_COORDS | Mesh::FILL_DET | Mesh::FILL_GRD_LAMBDA | Mesh::FILL_NEIGH; - if (useGetBound_) { + if (useGetBound) { assembleFlag |= Mesh::FILL_BOUND; } @@ -708,32 +713,36 @@ namespace AMDiS { componentSpaces[i]->getAdmin()->getUsedSize(), componentSpaces[i]->getName().c_str()); - rhs_->getDOFVector(i)->set(0.0); + rhs->getDOFVector(i)->set(0.0); for (int j = 0; j < nComponents; j++) { - if ((*systemMatrix_)[i][j]) { + if ((*systemMatrix)[i][j]) { // The matrix should not be deleted, if it was assembled before // and it is marked to be assembled only once. - if (!(assembleMatrixOnlyOnce_[i][j] && assembledMatrix_[i][j]) && asmMatrix) { - (*systemMatrix_)[i][j]->clear(); + if (!(assembleMatrixOnlyOnce[i][j] && assembledMatrix[i][j]) && asmMatrix) { + (*systemMatrix)[i][j]->clear(); } } } } + traverseInfo.updateStatus(); + for (int i = 0; i < nComponents; i++) { for (int j = 0; j < nComponents; j++) { + // Only if this variable is true, the current matrix will be assembled. bool assembleMatrix = true; // The DOFMatrix which should be assembled (or not, if assembleMatrix // will be set to false). - DOFMatrix *matrix = (*systemMatrix_)[i][j]; + DOFMatrix *matrix = (*systemMatrix)[i][j]; // If the matrix was assembled before and it is marked to be assembled // only once, it will not be assembled. - if (assembleMatrixOnlyOnce_[i][j] && assembledMatrix_[i][j]) { + if (assembleMatrixOnlyOnce[i][j] && assembledMatrix[i][j]) { assembleMatrix = false; } - // If there is no DOFMatrix (e.g. if it is completly 0), do not assemble. + + // If there is no DOFMatrix, e.g., if it is completly 0, do not assemble. if (!matrix) { assembleMatrix = false; } @@ -752,42 +761,91 @@ namespace AMDiS { if (assembleMatrix && matrix->getBoundaryManager()) matrix->getBoundaryManager()->initMatrix(matrix); - if (componentSpaces[i] == componentSpaces[j]) { + if (traverseInfo.getStatus(i, j) == SingleComponentInfo::EQ_SPACES_NO_AUX || + traverseInfo.getStatus(i, j) == SingleComponentInfo::EQ_SPACES_WITH_AUX) { + + // Row fe space and col fe space are both equal + + if (traverseInfo.getStatus(i) == SingleComponentInfo::EQ_SPACES_NO_AUX || + traverseInfo.getStatus(i) == SingleComponentInfo::EQ_SPACES_WITH_AUX) { + + // The simplest case: either the right hand side has no operaters, no aux + // fe spaces, or all aux fe spaces are equal to the row and col fe space. + + assembleOnOneMesh(componentSpaces[i], + assembleFlag, + assembleMatrix ? matrix : NULL, + ((i == j) && asmVector) ? rhs->getDOFVector(i) : NULL); + + } else if (traverseInfo.getStatus(i) == SingleComponentInfo::EQ_SPACES_WITH_DIF_AUX) { + + // Row fe space and col fe space are both equal, but right hand side has at + // least one another aux fe space. In this case, do not assemble the rhs, + // this will be done afterwards. + + assembleOnOneMesh(componentSpaces[i], + assembleFlag, + assembleMatrix ? matrix : NULL, + ((i == j) && asmVector) ? rhs->getDOFVector(i) : NULL); + + assembleOnDifMeshes2(componentSpaces[1], componentSpaces[0], + assembleFlag, + NULL, + rhs->getDOFVector(1)); + + } else { + ERROR_EXIT("Possible? If yes, not yet implemented!\n"); + } + + } else if (traverseInfo.getStatus(i, j) == SingleComponentInfo::EQ_SPACES_WITH_DIF_AUX) { + assembleOnOneMesh(componentSpaces[i], assembleFlag, assembleMatrix ? matrix : NULL, - ((i == j) && asmVector) ? rhs_->getDOFVector(i) : NULL); - } else { + ((i == j) && asmVector) ? rhs->getDOFVector(i) : NULL); + + assembleOnDifMeshes2(componentSpaces[i], + traverseInfo.getAuxFESpace(i, j), + assembleFlag, + assembleMatrix ? matrix : NULL, + NULL); + + } else if (traverseInfo.getStatus(i, j) == SingleComponentInfo::DIF_SPACES_NO_AUX || + traverseInfo.getStatus(i, j) == SingleComponentInfo::DIF_SPACES_WITH_AUX) { + assembleOnDifMeshes(componentSpaces[i], componentSpaces[j], assembleFlag, assembleMatrix ? matrix : NULL, - ((i == j) && asmVector) ? rhs_->getDOFVector(i) : NULL); - TEST_EXIT(matrix->getUsedSize() == componentSpaces[i]->getAdmin()->getUsedSize()) - ("Assembled matrix has wrong dimension!\n"); - TEST_EXIT(matrix->getNumCols() == componentSpaces[j]->getAdmin()->getUsedSize()) + ((i == j) && asmVector) ? rhs->getDOFVector(i) : NULL); + + TEST_EXIT_DBG(matrix->getUsedSize() == componentSpaces[i]->getAdmin()->getUsedSize()) ("Assembled matrix has wrong dimension!\n"); + TEST_EXIT_DBG(matrix->getNumCols() == componentSpaces[j]->getAdmin()->getUsedSize()) + ("Assembled matrix has wrong dimension!\n"); + + } else { + ERROR_EXIT("Not yet implemented!\n"); } if (assembleMatrix && matrix->getBoundaryManager()) matrix->getBoundaryManager()->exitMatrix(matrix); - assembledMatrix_[i][j] = true; + assembledMatrix[i][j] = true; } // And now assemble boundary conditions on the vectors - assembleBoundaryConditions(rhs_->getDOFVector(i), - solution_->getDOFVector(i), + assembleBoundaryConditions(rhs->getDOFVector(i), + solution->getDOFVector(i), componentMeshes[i], assembleFlag); } #ifdef _OPENMP - INFO(info_, 8)("buildAfterCoarsen needed %.5f seconds system time / %.5f seconds wallclock time\n", - TIME_USED(first, clock()), - omp_get_wtime() - wtime); + INFO(info, 8)("buildAfterCoarsen needed %.5f seconds system time / %.5f seconds wallclock time\n", + TIME_USED(first, clock()), omp_get_wtime() - wtime); #else - INFO(info_, 8)("buildAfterCoarsen needed %.5f seconds\n", - TIME_USED(first, clock())); + INFO(info, 8)("buildAfterCoarsen needed %.5f seconds\n", + TIME_USED(first, clock())); #endif } @@ -802,21 +860,21 @@ namespace AMDiS { #endif int i; - int size = static_cast<int>(fileWriters_.size()); + int size = static_cast<int>(fileWriters.size()); #ifdef _OPENMP #pragma omp parallel for schedule(static, 1) #endif for (i = 0; i < size; i++) { - fileWriters_[i]->writeFiles(adaptInfo, force); + fileWriters[i]->writeFiles(adaptInfo, force); } #ifdef _OPENMP - INFO(info_, 8)("writeFiles needed %.5f seconds system time / %.5f seconds wallclock time\n", - TIME_USED(first, clock()), - omp_get_wtime() - wtime); + INFO(info, 8)("writeFiles needed %.5f seconds system time / %.5f seconds wallclock time\n", + TIME_USED(first, clock()), + omp_get_wtime() - wtime); #else - INFO(info_, 8)("writeFiles needed %.5f seconds\n", - TIME_USED(first, clock())); + INFO(info, 8)("writeFiles needed %.5f seconds\n", + TIME_USED(first, clock())); #endif } @@ -824,7 +882,7 @@ namespace AMDiS { { FUNCNAME("ProblemVec::interpolInitialSolution()"); - solution_->interpol(fct); + solution->interpol(fct); } void ProblemVec::addMatrixOperator(Operator *op, @@ -834,18 +892,25 @@ namespace AMDiS { { FUNCNAME("ProblemVec::addMatrixOperator()"); - if (!(*systemMatrix_)[i][j]) { + if (!(*systemMatrix)[i][j]) { TEST_EXIT(i != j)("should have been created already\n"); - (*systemMatrix_)[i][j] = NEW DOFMatrix(componentSpaces[i], - componentSpaces[j], - ""); - (*systemMatrix_)[i][j]->setCoupleMatrix(true); - - (*systemMatrix_)[i][j]->getBoundaryManager()-> - setBoundaryConditionMap((*systemMatrix_)[i][i]->getBoundaryManager()-> + (*systemMatrix)[i][j] = NEW DOFMatrix(componentSpaces[i], componentSpaces[j], ""); + (*systemMatrix)[i][j]->setCoupleMatrix(true); + (*systemMatrix)[i][j]->getBoundaryManager()-> + setBoundaryConditionMap((*systemMatrix)[i][i]->getBoundaryManager()-> getBoundaryConditionMap()); } - (*systemMatrix_)[i][j]->addOperator(op, factor, estFactor); + (*systemMatrix)[i][j]->addOperator(op, factor, estFactor); + + traverseInfo.getMatrix(i, j).setAuxFESpaces(op->getAuxFESpaces()); + + for (int k = 0; k < static_cast<int>(op->getAuxFESpaces().size()); k++) { + if ((op->getAuxFESpaces())[k] != componentSpaces[i] || + (op->getAuxFESpaces())[k] != componentSpaces[j]) { + op->setNeedDualTraverse(true); + break; + } + } } void ProblemVec::addVectorOperator(Operator *op, int i, @@ -854,7 +919,15 @@ namespace AMDiS { { FUNCNAME("ProblemVec::addVectorOperator()"); - rhs_->getDOFVector(i)->addOperator(op, factor, estFactor); + rhs->getDOFVector(i)->addOperator(op, factor, estFactor); + traverseInfo.getVector(i).setAuxFESpaces(op->getAuxFESpaces()); + + for (int j = 0; j < static_cast<int>(op->getAuxFESpaces().size()); j++) { + if ((op->getAuxFESpaces())[j] != componentSpaces[i]) { + op->setNeedDualTraverse(true); + break; + } + } } void ProblemVec::addDirichletBC(BoundaryType type, int system, @@ -866,16 +939,16 @@ namespace AMDiS { b, componentSpaces[system]); for (int i = 0; i < nComponents; i++) { - if (systemMatrix_ && (*systemMatrix_)[system][i]) { - (*systemMatrix_)[system][i]->getBoundaryManager()->addBoundaryCondition(dirichlet); + if (systemMatrix && (*systemMatrix)[system][i]) { + (*systemMatrix)[system][i]->getBoundaryManager()->addBoundaryCondition(dirichlet); } } - if (rhs_) - rhs_->getDOFVector(system)->getBoundaryManager()->addBoundaryCondition(dirichlet); + if (rhs) + rhs->getDOFVector(system)->getBoundaryManager()->addBoundaryCondition(dirichlet); - if (solution_) - solution_->getDOFVector(system)->getBoundaryManager()->addBoundaryCondition(dirichlet); + if (solution) + solution->getDOFVector(system)->getBoundaryManager()->addBoundaryCondition(dirichlet); } void ProblemVec::addNeumannBC(BoundaryType type, int row, int col, @@ -887,8 +960,8 @@ namespace AMDiS { new NeumannBC(type, n, componentSpaces[row], componentSpaces[col]); - if (rhs_) - rhs_->getDOFVector(row)->getBoundaryManager()->addBoundaryCondition(neumann); + if (rhs) + rhs->getDOFVector(row)->getBoundaryManager()->addBoundaryCondition(neumann); } void ProblemVec::addRobinBC(BoundaryType type, int row, int col, @@ -901,11 +974,11 @@ namespace AMDiS { new RobinBC(type, n, r, componentSpaces[row], componentSpaces[col]); - if (rhs_) - rhs_->getDOFVector(row)->getBoundaryManager()->addBoundaryCondition(robin); + if (rhs) + rhs->getDOFVector(row)->getBoundaryManager()->addBoundaryCondition(robin); - if (systemMatrix_ && (*systemMatrix_)[row][col]) { - (*systemMatrix_)[row][col]->getBoundaryManager()->addBoundaryCondition(robin); + if (systemMatrix && (*systemMatrix)[row][col]) { + (*systemMatrix)[row][col]->getBoundaryManager()->addBoundaryCondition(robin); } } @@ -917,15 +990,16 @@ namespace AMDiS { PeriodicBC *periodic = new PeriodicBC(type, feSpace); - if (systemMatrix_ && (*systemMatrix_)[row][col]) - (*systemMatrix_)[row][col]->getBoundaryManager()->addBoundaryCondition(periodic); + if (systemMatrix && (*systemMatrix)[row][col]) + (*systemMatrix)[row][col]->getBoundaryManager()->addBoundaryCondition(periodic); - if (rhs_) - rhs_->getDOFVector(row)->getBoundaryManager()-> + if (rhs) + rhs->getDOFVector(row)->getBoundaryManager()-> addBoundaryCondition(periodic); } - void ProblemVec::assembleOnOneMesh(FiniteElemSpace *feSpace, Flag assembleFlag, + void ProblemVec::assembleOnOneMesh(FiniteElemSpace *feSpace, + Flag assembleFlag, DOFMatrix *matrix, DOFVector<double> *vector) { Mesh *mesh = feSpace->getMesh(); @@ -941,7 +1015,7 @@ namespace AMDiS { #pragma omp parallel #endif { - BoundaryType *bound = useGetBound_ ? GET_MEMORY(BoundaryType, basisFcts->getNumber()) : NULL; + BoundaryType *bound = useGetBound ? GET_MEMORY(BoundaryType, basisFcts->getNumber()) : NULL; // Create for every thread its private matrix and vector, on that // the thread will assemble its part of the mesh. @@ -949,9 +1023,7 @@ namespace AMDiS { DOFVector<double> *tmpVector = NULL; if (matrix) { - tmpMatrix = NEW DOFMatrix(matrix->getRowFESpace(), - matrix->getColFESpace(), - "tmp"); + tmpMatrix = NEW DOFMatrix(matrix->getRowFESpace(), matrix->getColFESpace(), "tmp"); // Copy the global matrix to the private matrix, because we need the // operators defined on the global matrix in the private one. Only the @@ -982,7 +1054,7 @@ namespace AMDiS { #pragma omp barrier #endif while (elInfo) { - if (useGetBound_) { + if (useGetBound) { basisFcts->getBound(elInfo, bound); } @@ -992,13 +1064,12 @@ namespace AMDiS { // Take the matrix boundary manager from the public matrix, // but assemble the boundary conditions on the thread private matrix. if (matrix->getBoundaryManager()) { - matrix->getBoundaryManager()-> - fillBoundaryConditions(elInfo, tmpMatrix); + matrix->getBoundaryManager()->fillBoundaryConditions(elInfo, tmpMatrix); } } if (vector) { - tmpVector->assemble(1.0, elInfo, bound); + tmpVector->assemble(1.0, elInfo, bound, NULL); } elInfo = stack.traverseNext(elInfo); @@ -1032,24 +1103,25 @@ namespace AMDiS { DELETE tmpVector; } - if (useGetBound_) { + if (useGetBound) { FREE_MEMORY(bound, BoundaryType, basisFcts->getNumber()); } } // pragma omp parallel - } - void ProblemVec::assembleOnDifMeshes(FiniteElemSpace *rowFeSpace, FiniteElemSpace *colFeSpace, + void ProblemVec::assembleOnDifMeshes(FiniteElemSpace *rowFeSpace, + FiniteElemSpace *colFeSpace, Flag assembleFlag, - DOFMatrix *matrix, DOFVector<double> *vector) + DOFMatrix *matrix, + DOFVector<double> *vector) { Mesh *rowMesh = rowFeSpace->getMesh(); Mesh *colMesh = colFeSpace->getMesh(); const BasisFunction *basisFcts = rowFeSpace->getBasisFcts(); BoundaryType *bound = NULL; - if (useGetBound_) { + if (useGetBound) { bound = GET_MEMORY(BoundaryType, basisFcts->getNumber()); } @@ -1065,8 +1137,8 @@ namespace AMDiS { while (cont) { Element *rowElem = rowElInfo->getElement(); Element *colElem = colElInfo->getElement(); - - if (useGetBound_) { + + if (useGetBound) { basisFcts->getBound(rowElInfo, bound); } @@ -1087,11 +1159,62 @@ namespace AMDiS { &smallElInfo, &largeElInfo); } - if (useGetBound_) { + if (useGetBound) { FREE_MEMORY(bound, BoundaryType, basisFcts->getNumber()); } } + + void ProblemVec::assembleOnDifMeshes2(const FiniteElemSpace *mainFeSpace, + const FiniteElemSpace *auxFeSpace, + Flag assembleFlag, + DOFMatrix *matrix, + DOFVector<double> *vector) + { + Mesh *mainMesh = mainFeSpace->getMesh(); + Mesh *auxMesh = auxFeSpace->getMesh(); + + const BasisFunction *basisFcts = mainFeSpace->getBasisFcts(); + BoundaryType *bound = NULL; + if (useGetBound) { + bound = GET_MEMORY(BoundaryType, basisFcts->getNumber()); + } + + DualTraverse dualTraverse; + ElInfo *mainElInfo, *auxElInfo; + ElInfo *largeElInfo, *smallElInfo; + + dualTraverse.setFillSubElemMat(true); + bool cont = dualTraverse.traverseFirst(mainMesh, auxMesh, -1, -1, + assembleFlag, assembleFlag, + &mainElInfo, &auxElInfo, + &smallElInfo, &largeElInfo); + while (cont) { + Element *mainElem = mainElInfo->getElement(); + Element *auxElem = auxElInfo->getElement(); + + if (useGetBound) { + basisFcts->getBound(mainElInfo, bound); + } + + if (matrix) { + matrix->assemble2(1.0, mainElInfo, auxElInfo, smallElInfo, largeElInfo, bound); + } + + if (vector) { + vector->assemble2(1.0, mainElInfo, auxElInfo, smallElInfo, largeElInfo, bound); + } + + cont = dualTraverse.traverseNext(&mainElInfo, &auxElInfo, + &smallElInfo, &largeElInfo); + } + + if (useGetBound) { + FREE_MEMORY(bound, BoundaryType, basisFcts->getNumber()); + } + + } + void ProblemVec::assembleBoundaryConditions(DOFVector<double> *rhs, DOFVector<double> *solution, Mesh *mesh, @@ -1172,30 +1295,21 @@ namespace AMDiS { } - void ProblemVec::writeResidualMesh(AdaptInfo *adaptInfo, const std::string name) + void ProblemVec::writeResidualMesh(int comp, AdaptInfo *adaptInfo, const std::string name) { FUNCNAME("ProblemVec::writeResidualMesh()"); - Mesh *mesh = this->getMesh(0); - FiniteElemSpace *fe = this->getFESpace(0); - - std::map<int, double> vec; - + std::map<int, double> vec; TraverseStack stack; - ElInfo *elInfo = stack.traverseFirst(mesh, - -1, - Mesh::CALL_LEAF_EL | - Mesh::FILL_COORDS); + ElInfo *elInfo = stack.traverseFirst(this->getMesh(comp), -1, + Mesh::CALL_LEAF_EL | Mesh::FILL_COORDS); while (elInfo) { - Element *el = elInfo->getElement(); - double lError = el->getEstimation(0); - - vec[elInfo->getElement()->getIndex()] = lError; + vec[elInfo->getElement()->getIndex()] = elInfo->getElement()->getEstimation(comp); elInfo = stack.traverseNext(elInfo); } - - ElementFileWriter fw(name, mesh, fe, vec); + + ElementFileWriter fw(name, this->getFESpace(comp), vec); fw.writeFiles(adaptInfo, true); } @@ -1203,26 +1317,26 @@ namespace AMDiS { { FUNCNAME("ProblemVec::serialize()"); - SerializerUtil::serializeBool(out, &allowFirstRef_); + SerializerUtil::serializeBool(out, &allowFirstRef); - for (int i = 0; i < static_cast<int>(meshes_.size()); i++) { - meshes_[i]->serialize(out); + for (int i = 0; i < static_cast<int>(meshes.size()); i++) { + meshes[i]->serialize(out); } - solution_->serialize(out); + solution->serialize(out); } void ProblemVec::deserialize(std::istream &in) { FUNCNAME("ProblemVec::deserialize()"); - SerializerUtil::deserializeBool(in, &allowFirstRef_); + SerializerUtil::deserializeBool(in, &allowFirstRef); - for (int i = 0; i < static_cast<int>(meshes_.size()); i++) { - meshes_[i]->deserialize(in); + for (int i = 0; i < static_cast<int>(meshes.size()); i++) { + meshes[i]->deserialize(in); } - solution_->deserialize(in); + solution->deserialize(in); } void ProblemVec::computeError(AdaptInfo *adaptInfo) @@ -1236,7 +1350,7 @@ namespace AMDiS { DOFVector<double> *tmp = NEW DOFVector<double>(componentSpaces[i], "tmp"); tmp->interpol(exactSolutionFcts[i]); double solMax = tmp->absMax(); - *tmp -= *(solution_->getDOFVector(i)); + *tmp -= *(solution->getDOFVector(i)); MSG("L2 error = %.8e\n", tmp->L2Norm()); MSG("L-inf error = %.8e\n", tmp->absMax() / solMax); diff --git a/AMDiS/src/ProblemVec.h b/AMDiS/src/ProblemVec.h index e840b33dae3458869526b59970d480c01c6dbf35..2d09bab7ca7c0f1cca340cac3ba5e51e94b30c0f 100644 --- a/AMDiS/src/ProblemVec.h +++ b/AMDiS/src/ProblemVec.h @@ -22,14 +22,16 @@ #ifndef AMDIS_PROBLEMVEC_H #define AMDIS_PROBLEMVEC_H +#include <vector> +#include <list> + #include "ProblemStatBase.h" #include "Parameters.h" #include "Boundary.h" #include "MatrixVector.h" #include "StandardProblemIteration.h" #include "ElementFileWriter.h" -#include <vector> -#include <list> +#include "ComponentTraverseInfo.h" namespace AMDiS { @@ -57,94 +59,76 @@ namespace AMDiS { /** \brief * constructor */ - ProblemVec(const char* name, + ProblemVec(const std::string &nameStr, ProblemIterationInterface *problemIteration = NULL) : StandardProblemIteration(this), - name_(name), + name(nameStr), nComponents(-1), - solver_(NULL), - solution_(NULL), - rhs_(NULL), - systemMatrix_(NULL), - matVec_(NULL), - leftPrecon_(NULL), - rightPrecon_(NULL), - useGetBound_(true), - info_(10), - allowFirstRef_(false), + nMeshes(0), + traverseInfo(0), + solver(NULL), + solution(NULL), + rhs(NULL), + systemMatrix(NULL), + matVec(NULL), + leftPrecon(NULL), + rightPrecon(NULL), + useGetBound(true), + info(10), + allowFirstRef(false), computeExactError(false) { - GET_PARAMETER(0, name_ + "->components", "%d", &nComponents); + GET_PARAMETER(0, name + "->components", "%d", &nComponents); TEST_EXIT(nComponents > 0)("components not set!\n"); - estimator_.resize(nComponents, NULL); + estimator.resize(nComponents, NULL); marker.resize(nComponents, NULL); - assembleMatrixOnlyOnce_.resize(nComponents); - assembledMatrix_.resize(nComponents); + assembleMatrixOnlyOnce.resize(nComponents); + assembledMatrix.resize(nComponents); for (int i = 0; i < nComponents; i++) { - assembleMatrixOnlyOnce_[i].resize(nComponents); - assembledMatrix_[i].resize(nComponents); + assembleMatrixOnlyOnce[i].resize(nComponents); + assembledMatrix[i].resize(nComponents); for (int j = 0; j < nComponents; j++) { - assembleMatrixOnlyOnce_[i][j] = false; - assembledMatrix_[i][j] = false; + assembleMatrixOnlyOnce[i][j] = false; + assembledMatrix[i][j] = false; } } exactSolutionFcts.resize(nComponents); - }; + } - /** \brief - * destructor - */ - virtual ~ProblemVec() {}; + /// Destructor + virtual ~ProblemVec() {} - /** \brief - * Initialisation of the problem. - */ + /// Initialisation of the problem. virtual void initialize(Flag initFlag, ProblemVec *adoptProblem = NULL, Flag adoptFlag = INIT_NOTHING); - /** \brief - * Used in \ref initialize(). - */ + /// Used in \ref initialize(). virtual void createMesh(); - /** \brief - * Used in \ref initialize(). - */ + /// Used in \ref initialize(). virtual void createFESpace(); - /** \brief - * Used in \ref initialize(). - */ + /// Used in \ref initialize(). virtual void createMatricesAndVectors(); - /** \brief - * Used in \ref initialize(). - */ + /// Used in \ref initialize(). virtual void createSolver(); - /** \brief - * Used in \ref initialize(). - */ + /// Used in \ref initialize(). virtual void createEstimator(); - /** \brief - * Used in \ref initialize(). - */ + /// Used in \ref initialize(). virtual void createMarker(); - /** \brief - * Used in \ref initialize(). - */ + /// Used in \ref initialize(). virtual void createFileWriter(); - /** \brief - * Used in \ref initialize(). - */ + /// Used in \ref initialize(). virtual void doOtherStuff(); /** \brief @@ -181,13 +165,13 @@ namespace AMDiS { * Implementation of ProblemStatBase::buildBeforeRefine(). * Does nothing here. */ - virtual void buildBeforeRefine(AdaptInfo *adaptInfo, Flag) {}; + virtual void buildBeforeRefine(AdaptInfo *adaptInfo, Flag) {} /** \brief * Implementation of ProblemStatBase::buildBeforeCoarsen(). * Does nothing here. */ - virtual void buildBeforeCoarsen(AdaptInfo *adaptInfo, Flag) {}; + virtual void buildBeforeCoarsen(AdaptInfo *adaptInfo, Flag) {} /** \brief * Implementation of ProblemStatBase::buildAfterCoarsen(). @@ -205,19 +189,15 @@ namespace AMDiS { */ virtual Flag oneIteration(AdaptInfo *adaptInfo, Flag toDo = FULL_ITERATION); - /** \brief - * Returns number of managed problems - */ + /// Returns number of managed problems virtual int getNumProblems() { return 1; - }; + } - /** \brief - * Implementation of ProblemStatBase::getNumComponents() - */ + /// Implementation of ProblemStatBase::getNumComponents() virtual int getNumComponents() { return nComponents; - }; + } /** \brief * Returns the problem with the given number. If only one problem @@ -225,75 +205,68 @@ namespace AMDiS { */ virtual ProblemStatBase *getProblem(int number = 0) { return this; - }; + } - /** \brief - * Writes output files. - */ + /// Writes output files. void writeFiles(AdaptInfo *adaptInfo, bool force); - /** \brief - * Interpolates fct to \ref solution. - */ + /// Interpolates fct to \ref solution. void interpolInitialSolution(std::vector<AbstractFunction<double, WorldVector<double> >*> *fct); - /** \brief - * Adds an Operator to \ref A. - */ + /// Adds an Operator to \ref A. void addMatrixOperator(Operator *op, int i, int j, double *factor = NULL, double *estFactor = NULL); - /** \brief - * Adds an Operator to \ref rhs. - */ + /// Adds an Operator to \ref rhs. void addVectorOperator(Operator *op, int i, double *factor = NULL, double *estFactor = NULL); - /** \brief - * Adds dirichlet boundary conditions. - */ + /// Adds dirichlet boundary conditions. virtual void addDirichletBC(BoundaryType type, int system, AbstractFunction<double, WorldVector<double> > *b); - /** \brief - * Adds neumann boundary conditions. - */ + /// Adds neumann boundary conditions. virtual void addNeumannBC(BoundaryType type, int row, int col, AbstractFunction<double, WorldVector<double> > *n); - /** \brief - * Adds robin boundary conditions. - */ + /// Adds robin boundary conditions. virtual void addRobinBC(BoundaryType type, int row, int col, AbstractFunction<double, WorldVector<double> > *n, AbstractFunction<double, WorldVector<double> > *r); - /** \brief - * Adds periodic boundary conditions. - */ + /// Adds periodic boundary conditions. virtual void addPeriodicBC(BoundaryType type, int row, int col); - - /** \brief - * Implementation of ProblemStatBase::allowFirstRefinement(). - */ + /// Implementation of ProblemStatBase::allowFirstRefinement(). inline void allowFirstRefinement() { - allowFirstRef_ = true; - }; + allowFirstRef = true; + } /** \brief * This function assembles a DOFMatrix and a DOFVector for the case, * the meshes from row and col FE-space are equal. */ - void assembleOnOneMesh(FiniteElemSpace *feSpace, Flag assembleFlag, + void assembleOnOneMesh(FiniteElemSpace *feSpace, + Flag assembleFlag, DOFMatrix *matrix, DOFVector<double> *vector); - void assembleOnDifMeshes(FiniteElemSpace *rowFeSpace, FiniteElemSpace *colFeSpace, + /// + void assembleOnDifMeshes(FiniteElemSpace *rowFeSpace, + FiniteElemSpace *colFeSpace, Flag assembleFlag, - DOFMatrix *matrix, DOFVector<double> *vector); + DOFMatrix *matrix, + DOFVector<double> *vector); + /// + void assembleOnDifMeshes2(const FiniteElemSpace *mainFeSpace, + const FiniteElemSpace *auxFeSpace, + Flag assembleFlag, + DOFMatrix *matrix, + DOFVector<double> *vector); + + /// void assembleBoundaryConditions(DOFVector<double> *rhs, DOFVector<double> *solution, Mesh *mesh, @@ -305,144 +278,111 @@ namespace AMDiS { * \{ */ - /** \brief - * Returns \ref solution_. - */ + /// Returns \ref solution. inline SystemVector* getSolution() { - return solution_; - }; + return solution; + } - /** \brief - * Returns \ref rhs_. - */ + /// Returns \ref rhs. inline SystemVector* getRHS() { - return rhs_; - }; + return rhs; + } - /** \brief - * Returns \ref systemMatrix_. - */ + /// Returns \ref systemMatrix. inline Matrix<DOFMatrix*> *getSystemMatrix() { - return systemMatrix_; - }; + return systemMatrix; + } - /** \brief - * Returns mesh of given component - */ + /// Returns a pointer to the corresponding DOFMatrix. + inline DOFMatrix* getSystemMatrix(int row, int col) { + return (*systemMatrix)[row][col]; + } + + /// Returns mesh of given component inline Mesh* getMesh(int comp) { FUNCNAME("ProblemVec::getMesh()"); TEST_EXIT(comp < static_cast<int>(componentMeshes.size()) && comp >= 0) ("invalid component number\n"); return componentMeshes[comp]; - }; + } - /** \brief - * Returns \ref meshes_ - */ + /// Returns \ref meshes inline std::vector<Mesh*> getMeshes() { - return meshes_; - }; + return meshes; + } - /** \brief - * Returns \ref feSpace_. - */ + /// Returns \ref feSpace_. inline FiniteElemSpace* getFESpace(int comp) { FUNCNAME("ProblemVec::getFESpace()"); TEST_EXIT(comp < static_cast<int>(componentSpaces.size()) && comp >= 0) ("invalid component number\n"); return componentSpaces[comp]; - }; + } - /** \brief - * Returns \ref feSpaces. - */ + /// Returns \ref feSpaces. inline std::vector<FiniteElemSpace*> getFESpaces() { return feSpaces; - }; + } - /** \brief - * Returns \ref componentSpaces; - */ + /// Returns \ref componentSpaces; inline std::vector<FiniteElemSpace*> getComponentFESpaces() { return componentSpaces; } - /** \brief - * Returns \ref estimator_. - */ + /// Returns \ref estimator. inline std::vector<Estimator*> getEstimator() { - return estimator_; - }; + return estimator; + } - /** \brief - * Returns \ref estimator_. - */ + /// Returns \ref estimator. inline Estimator* getEstimator(int comp) { - return estimator_[comp]; - }; + return estimator[comp]; + } - /** \brief - * Returns \ref refinementManager_. - */ + /// Returns \ref refinementManager. inline RefinementManager* getRefinementManager(int comp) { - return refinementManager_; - }; + return refinementManager; + } - /** \brief - * Returns \ref refinementManager_. - */ + /// Returns \ref refinementManager. inline CoarseningManager* getCoarseningManager(int comp) { - return coarseningManager_; - }; + return coarseningManager; + } - /** \brief - * Returns \ref solver_. - */ + /// Returns \ref solver. inline OEMSolver<SystemVector>* getSolver() { - return solver_; - }; + return solver; + } - /** \brief - * Returns \ref marker. - */ + /// Returns \ref marker. inline Marker *getMarker(int comp) { return marker[comp]; - }; + } - /** \brief - * Returns \ref marker. - */ + /// Returns \ref marker. inline std::vector<Marker*> getMarker() { return marker; - }; + } - /** \brief - * Returns \ref name_. - */ + /// Returns the name of the problem inline virtual const std::string& getName() { - return name_; - }; + return name; + } - /** \brief - * Returns \ref useGetBound_. - */ + /// Returns \ref useGetBound. inline bool getBoundUsed() { - return useGetBound_; - }; + return useGetBound; + } - /** \brief - * Returns \ref leftPrecon_. - */ + /// Returns \ref leftPrecon. inline Preconditioner<SystemVector> *getLeftPrecon() { - return leftPrecon_; - }; + return leftPrecon; + } - /** \brief - * Returns \ref rightPrecon_. - */ + /// Returns \ref rightPrecon. inline Preconditioner<SystemVector> *getRightPrecon() { - return rightPrecon_; - }; + return rightPrecon; + } /** \} */ @@ -452,85 +392,83 @@ namespace AMDiS { * \{ */ - /** \brief - * Sets \ref estimator_. - */ + /// Sets \ref estimator. inline void setEstimator(std::vector<Estimator*> est) { - estimator_ = est; - }; + estimator = est; + } + /// Sets the FE space for the given component. inline void setFESpace(FiniteElemSpace *feSpace, int comp) { feSpaces[comp] = feSpace; - }; + } - /** \brief - * Sets \ref estimator_. - */ + /// Sets \ref estimator. inline void setEstimator(Estimator* est, int comp) { - estimator_[comp] = est; - }; + estimator[comp] = est; + } + /// Sets \ref marker. inline void setMarker(Marker* mark, int comp) { marker[comp] = mark; - }; + } - /** \brief - * Sets \ref solver_. - */ + /// Sets \ref solver. inline void setSolver(OEMSolver<SystemVector>* sol) { - solver_ = sol; - }; + solver = sol; + } - /** \brief - * Sets \ref leftPrecon_. - */ + /// Sets \ref leftPrecon. inline void setLeftPrecon(Preconditioner<SystemVector> *p) { - leftPrecon_ = p; - }; + leftPrecon = p; + } - /** \brief - * Sets \ref rightPrecon_. - */ + /// Sets \ref rightPrecon. inline void setRightPrecon(Preconditioner<SystemVector> *p) { - rightPrecon_ = p; - }; + rightPrecon = p; + } + /// inline void setAssembleMatrixOnlyOnce(int i, int j, bool value = true) { - assembleMatrixOnlyOnce_[i][j] = value; + assembleMatrixOnlyOnce[i][j] = value; } + /// void setExactSolutionFct(AbstractFunction<double, WorldVector<double> > *fct, int component) { exactSolutionFcts[component] = fct; } + /// AbstractFunction<double, WorldVector<double> > *getExactSolutionFct(int component) { return exactSolutionFcts[component]; } + /// void setComputeExactError(bool v) { computeExactError = v; } /** \} */ - void writeResidualMesh(AdaptInfo *adaptInfo, const std::string name); + /** \brief + * Outputs the mesh of the given component, but the values are taken from the + * residual error estimator. + */ + void writeResidualMesh(int comp, AdaptInfo *adaptInfo, const std::string name); // ===== Serializable implementation ===== - /** \brief - * serialization - */ + /// Function that implements the serialization procedure. virtual void serialize(std::ostream &out); - /** \brief - * deserialization - */ + /// Function that implements the deserialization procedure. virtual void deserialize(std::istream &in); + + /// Returns \ref fileWriters. std::vector<FileWriterInterface*> getFileWriterList() { - return fileWriters_; - }; + return fileWriters; + } protected: /** \brief @@ -540,65 +478,56 @@ namespace AMDiS { void computeError(AdaptInfo *adaptInfo); protected: - /** \brief - * Name of this problem. - */ - std::string name_; + + /// Name of this problem. + std::string name; - /** \brief - * number of problem components - */ + /// Number of problem components int nComponents; /** \brief - * fe spaces of this problem. + * 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 + * within the problem. */ + int nMeshes; + + /// FE spaces of this problem. std::vector<FiniteElemSpace*> feSpaces; - /** \brief - * meshes of this problem. - */ - std::vector<Mesh*> meshes_; + /// Meshes of this problem. + std::vector<Mesh*> meshes; - /** \brief - * Pointer to the fe spaces for the different problem components - */ + /// Pointer to the fe spaces for the different problem components std::vector<FiniteElemSpace*> componentSpaces; - /** \brief - * Pointer to the meshes for the different problem components - */ + /// Pointer to the meshes for the different problem components std::vector<Mesh*> componentMeshes; /** \brief - * Responsible for element marking. + * Stores information about which meshes must be traversed to assemble the + * specific components. I.e., it was implemented to make use of different + * meshes for different components. */ + ComponentTraverseInfo traverseInfo; + + /// Responsible for element marking. std::vector<Marker*> marker; - /** \brief - * Estimator of this problem. Used in \ref estimate(). - */ - std::vector<Estimator*> estimator_; + /// Estimator of this problem. Used in \ref estimate(). + std::vector<Estimator*> estimator; - /** \brief - * Linear solver of this problem. Used in \ref solve(). - */ - OEMSolver<SystemVector> *solver_; + /// Linear solver of this problem. Used in \ref solve(). + OEMSolver<SystemVector> *solver; - /** \brief - * system vector storing the calculated solution of the problem. - */ - SystemVector *solution_; + /// System vector storing the calculated solution of the problem. + SystemVector *solution; - /** \brief - * system vector for the right hand side - */ - SystemVector *rhs_; + /// System vector for the right hand side + SystemVector *rhs; - /** \brief - * System matrix - */ - Matrix<DOFMatrix*> *systemMatrix_; + /// System matrix + Matrix<DOFMatrix*> *systemMatrix; /** \brief * Some DOFMatrices of the systemMatrix may be assembled only once (for @@ -607,71 +536,50 @@ namespace AMDiS { * be assembled only once. All other matrices will be assembled at every * time step. */ - std::vector< std::vector< bool > > assembleMatrixOnlyOnce_; + std::vector< std::vector< bool > > assembleMatrixOnlyOnce; /** \brief * If [i][j] of this field is set to true, the corresponding DOFMatrix of - * the systemMatrix_ has been assembled at least once. This field is used + * the systemMatrix has been assembled at least once. This field is used * to determine, if assembling of a matrix can be ommitted, if it is set * to be assembled only once. */ - std::vector< std::vector< bool > > assembledMatrix_; + std::vector< std::vector< bool > > assembledMatrix; - /** \brief - * Matrix-vector multiplication - */ - MatVecMultiplier<SystemVector> *matVec_; + /// Matrix-vector multiplication + MatVecMultiplier<SystemVector> *matVec; - /** \brief - * Left preconditioner. Used in \ref solver. - */ - Preconditioner<SystemVector> *leftPrecon_; + /// Left preconditioner. Used in \ref solver. + Preconditioner<SystemVector> *leftPrecon; - /** \brief - * Right preconditioner. Used in \ref solver. - */ - Preconditioner<SystemVector> *rightPrecon_; + /// Right preconditioner. Used in \ref solver. + Preconditioner<SystemVector> *rightPrecon; - /** \brief - * Determines whether domain boundaries should be considered at assembling. - */ - bool useGetBound_; + /// Determines whether domain boundaries should be considered at assembling. + bool useGetBound; - /** \brief - * Writes the meshes and solution after the adaption loop. - */ - std::vector<FileWriterInterface*> fileWriters_; + /// Writes the meshes and solution after the adaption loop. + std::vector<FileWriterInterface*> fileWriters; /** \brief * All actions of mesh refinement are performed by refinementManager. * If new refinement algorithms should be realized, one has to override * RefinementManager and give one instance of it to AdaptStationary. */ - RefinementManager *refinementManager_; + RefinementManager *refinementManager; /** \brief * All actions of mesh coarsening are performed by coarseningManager. * If new coarsening algorithms should be realized, one has to override * CoarseningManager and give one instance of it to AdaptStationary. */ - CoarseningManager *coarseningManager_; + CoarseningManager *coarseningManager; - /** \brief - * Info level. - */ - int info_; + /// Info level. + int info; - /** \brief - * Allows one refinement although the adapt tolerance is reached already. - */ - bool allowFirstRef_; - - ProblemIterationInterface *problemIteration_; - - /** \brief - * Used for mesh traversal. - */ - static ProblemVec *traversePtr_; + /// Allows one refinement although the adapt tolerance is reached already. + bool allowFirstRef; /** \brief * This vectors stores pointers to functions defining the exact solution of diff --git a/AMDiS/src/ResidualEstimator.cc b/AMDiS/src/ResidualEstimator.cc index 423f4a844c547ef8f1ee5435c29d4343802ac433..fb6e44d1c3a0efee19a01c0f1ccaa624ca6baf68 100644 --- a/AMDiS/src/ResidualEstimator.cc +++ b/AMDiS/src/ResidualEstimator.cc @@ -29,20 +29,20 @@ namespace AMDiS { void ResidualEstimator::init(double ts) { FUNCNAME("ResidualEstimator::init()"); - + timestep = ts; mesh = uh[row == -1 ? 0 : row]->getFESpace()->getMesh(); - numSystems = static_cast<int>(uh.size()); - TEST_EXIT_DBG(numSystems > 0)("no system set\n"); + nSystems = static_cast<int>(uh.size()); + TEST_EXIT_DBG(nSystems > 0)("no system set\n"); dim = mesh->getDim(); - basFcts = GET_MEMORY(const BasisFunction*, numSystems); - quadFast = GET_MEMORY(FastQuadrature*, numSystems); + basFcts = GET_MEMORY(const BasisFunction*, nSystems); + quadFast = GET_MEMORY(FastQuadrature*, nSystems); degree = 0; - for (int system = 0; system < numSystems; system++) { + for (int system = 0; system < nSystems; system++) { basFcts[system] = uh[system]->getFESpace()->getBasisFcts(); degree = std::max(degree, basFcts[system]->getDegree()); } @@ -50,34 +50,34 @@ namespace AMDiS { degree *= 2; quad = Quadrature::provideQuadrature(dim, degree); - numPoints = quad->getNumPoints(); + nPoints = quad->getNumPoints(); Flag flag = INIT_PHI | INIT_GRD_PHI; if (degree > 2) { flag |= INIT_D2_PHI; } - for (int system = 0; system < numSystems; system++) { + for (int system = 0; system < nSystems; system++) { quadFast[system] = FastQuadrature::provideFastQuadrature(basFcts[system], *quad, flag); } - uhEl = GET_MEMORY(double*, numSystems); - uhNeigh = GET_MEMORY(double*, numSystems); - uhOldEl = timestep ? GET_MEMORY(double*, numSystems) : NULL; + uhEl = GET_MEMORY(double*, nSystems); + uhNeigh = GET_MEMORY(double*, nSystems); + uhOldEl = timestep ? GET_MEMORY(double*, nSystems) : NULL; - for (int system = 0; system < numSystems; system++) { + for (int system = 0; system < nSystems; system++) { uhEl[system] = GET_MEMORY(double, basFcts[system]->getNumber()); uhNeigh[system] = GET_MEMORY(double, basFcts[system]->getNumber()); if (timestep) uhOldEl[system] = GET_MEMORY(double, basFcts[system]->getNumber()); } - uhQP = timestep ? GET_MEMORY(double, numPoints) : NULL; - uhOldQP = timestep ? GET_MEMORY(double, numPoints) : NULL; + uhQP = timestep ? GET_MEMORY(double, nPoints) : NULL; + uhOldQP = timestep ? GET_MEMORY(double, nPoints) : NULL; - riq = GET_MEMORY(double, numPoints); + riq = GET_MEMORY(double, nPoints); grdUh_qp = NULL; D2uhqp = NULL; @@ -130,23 +130,23 @@ namespace AMDiS { est_sum = sqrt(est_sum); est_t_sum = sqrt(est_t_sum); - for (int system = 0; system < numSystems; system++) { + for (int system = 0; system < nSystems; system++) { FREE_MEMORY(uhEl[system], double, basFcts[system]->getNumber()); FREE_MEMORY(uhNeigh[system], double, basFcts[system]->getNumber()); if (timestep) FREE_MEMORY(uhOldEl[system], double, basFcts[system]->getNumber()); } - FREE_MEMORY(uhEl, double*, numSystems); - FREE_MEMORY(uhNeigh, double*, numSystems); + FREE_MEMORY(uhEl, double*, nSystems); + FREE_MEMORY(uhNeigh, double*, nSystems); if (timestep) { - FREE_MEMORY(uhOldEl, double*, numSystems); - FREE_MEMORY(uhQP, double, numPoints); - FREE_MEMORY(uhOldQP, double, numPoints); + FREE_MEMORY(uhOldEl, double*, nSystems); + FREE_MEMORY(uhQP, double, nPoints); + FREE_MEMORY(uhOldQP, double, nPoints); } else { if (uhQP != NULL) { - FREE_MEMORY(uhQP, double, numPoints); + FREE_MEMORY(uhQP, double, nPoints); } } @@ -157,15 +157,15 @@ namespace AMDiS { } } - FREE_MEMORY(riq, double, numPoints); - FREE_MEMORY(basFcts, const BasisFunction*, numSystems); - FREE_MEMORY(quadFast, FastQuadrature*, numSystems); + FREE_MEMORY(riq, double, nPoints); + FREE_MEMORY(basFcts, const BasisFunction*, nSystems); + FREE_MEMORY(quadFast, FastQuadrature*, nSystems); if (grdUh_qp != NULL) { - FREE_MEMORY(grdUh_qp, WorldVector<double>, numPoints); + FREE_MEMORY(grdUh_qp, WorldVector<double>, nPoints); } if (D2uhqp != NULL) { - FREE_MEMORY(D2uhqp, WorldMatrix<double>, numPoints); + FREE_MEMORY(D2uhqp, WorldMatrix<double>, nPoints); } if (C1 && (dim > 1)) { @@ -176,49 +176,43 @@ namespace AMDiS { DELETE neighInfo; } +#if 1 void ResidualEstimator::estimateElement(ElInfo *elInfo) { FUNCNAME("ResidualEstimator::estimateElement()"); - double est_el = 0.0; - double val = 0.0; - Element *el, *neigh; - - TEST_EXIT_DBG(numSystems > 0)("no system set\n"); + TEST_EXIT_DBG(nSystems > 0)("no system set\n"); + double val = 0.0; std::vector<Operator*>::iterator it; - - el = elInfo->getElement(); - + Element *el = elInfo->getElement(); double det = elInfo->getDet(); const DimVec<WorldVector<double> > &grdLambda = elInfo->getGrdLambda(); - - est_el = el->getEstimation(row); - + double est_el = el->getEstimation(row); double h2 = h2_from_det(det, dim); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { riq[iq] = 0.0; } - for (int system = 0; system < numSystems; system++) { + for (int system = 0; system < nSystems; system++) { if (matrix[system] == NULL) continue; // init assemblers - std::vector<Operator*>::iterator it; - for (it = const_cast<DOFMatrix*>(matrix[system])->getOperatorsBegin(); it != const_cast<DOFMatrix*>(matrix[system])->getOperatorsEnd(); ++it) { - (*it)->getAssembler(omp_get_thread_num())->initElement(elInfo, quad); + (*it)->getAssembler(omp_get_thread_num())->initElement(elInfo, NULL, quad); } - for (it = const_cast<DOFVector<double>*>(fh[system])->getOperatorsBegin(); - it != const_cast<DOFVector<double>*>(fh[system])->getOperatorsEnd(); - ++it) { - (*it)->getAssembler(omp_get_thread_num())->initElement(elInfo, quad); + if (C0) { + for (it = const_cast<DOFVector<double>*>(fh[system])->getOperatorsBegin(); + it != const_cast<DOFVector<double>*>(fh[system])->getOperatorsEnd(); + ++it) { + (*it)->getAssembler(omp_get_thread_num())->initElement(elInfo, NULL, quad); + } } if (timestep) { @@ -232,7 +226,7 @@ namespace AMDiS { if (C3 && uhOldQP && system == std::max(row, 0)) { val = 0.0; - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { double tiq = (uhQP[iq] - uhOldQP[iq]); val += quad->getWeight(iq) * tiq * tiq; } @@ -248,21 +242,21 @@ namespace AMDiS { it != const_cast<DOFMatrix*>(matrix[system])->getOperatorsEnd(); ++it) { if ((uhQP == NULL) && (*it)->zeroOrderTerms()) { - uhQP = GET_MEMORY(double, numPoints); + uhQP = GET_MEMORY(double, nPoints); uh[system]->getVecAtQPs(elInfo, NULL, quadFast[system], uhQP); } if ((grdUh_qp == NULL) && ((*it)->firstOrderTermsGrdPsi() || (*it)->firstOrderTermsGrdPhi())) { - grdUh_qp = new WorldVector<double>[numPoints]; + grdUh_qp = new WorldVector<double>[nPoints]; uh[system]->getGrdAtQPs(elInfo, NULL, quadFast[system], grdUh_qp); } if ((D2uhqp == NULL) && (degree > 2) && (*it)->secondOrderTerms()) { - D2uhqp = new WorldMatrix<double>[numPoints]; + D2uhqp = new WorldMatrix<double>[nPoints]; uh[system]->getD2AtQPs(elInfo, NULL, quadFast[system], D2uhqp); } } r(elInfo, - numPoints, + nPoints, uhQP, grdUh_qp, D2uhqp, @@ -278,7 +272,7 @@ namespace AMDiS { // add integral over r square val = 0.0; - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { val += quad->getWeight(iq) * riq[iq] * riq[iq]; } @@ -295,7 +289,7 @@ namespace AMDiS { int dow = Global::getGeo(WORLD); for (int face = 0; face < neighbours_; face++) { - neigh = const_cast<Element*>(elInfo->getNeighbour(face)); + Element *neigh = const_cast<Element*>(elInfo->getNeighbour(face)); if (neigh && neigh->getMark()) { int oppV = elInfo->getOppVertex(face); @@ -305,8 +299,6 @@ namespace AMDiS { neighInfo->setElement(const_cast<Element*>(neigh)); neighInfo->setFillFlag(Mesh::FILL_COORDS); - int j, i1, i2; - for (int i = 0; i < dow; i++) neighInfo->getCoord(oppV)[i] = elInfo->getOppCoord(face)[i]; @@ -323,10 +315,11 @@ namespace AMDiS { for (it = infoList.begin(); it != infoList.end(); ++it) { if (it->elementSide == face) { for (int i = 0; i < dim; i++) { - i1 = faceIndEl_[i]; - i2 = faceIndNeigh_[i]; + int i1 = faceIndEl_[i]; + int i2 = faceIndNeigh_[i]; - for (j = 0; j < dim; j++) { + int j = 0; + for (; j < dim; j++) { if (i1 == el->getVertexOfPosition(INDEX_OF_DIM(dim - 1, dim), face, @@ -347,9 +340,9 @@ namespace AMDiS { if (!periodicCoords) { for (int i = 0; i < dim; i++) { - i1 = faceIndEl_[i]; - i2 = faceIndNeigh_[i]; - for (j = 0; j < dow; j++) + int i1 = faceIndEl_[i]; + int i2 = faceIndNeigh_[i]; + for (int j = 0; j < dow; j++) neighInfo->getCoord(i2)[j] = elInfo->getCoord(i1)[j]; } } @@ -366,7 +359,7 @@ namespace AMDiS { } - for (int system = 0; system < numSystems; system++) { + for (int system = 0; system < nSystems; system++) { if (matrix[system] == NULL) continue; @@ -464,8 +457,197 @@ namespace AMDiS { elInfo->getElement()->setMark(0); } + + + +#endif + + +#if 0 + + + void ResidualEstimator::estimateElement(ElInfo *elInfo) + { + FUNCNAME("ResidualEstimator::estimateElement()"); + + TEST_EXIT(!C0 && !C2 && !C3)("NOT YET!\n"); + + Element *neigh; + std::vector<Operator*>::iterator it; + Element *el = elInfo->getElement(); + double det = elInfo->getDet(); + const DimVec<WorldVector<double> > &grdLambda = elInfo->getGrdLambda(); + double est_el = el->getEstimation(row); + + for (int system = 0; system < nSystems; system++) { + + if (matrix[system] == NULL) + continue; + + // init assemblers + std::vector<Operator*>::iterator it; + + for (it = const_cast<DOFMatrix*>(matrix[system])->getOperatorsBegin(); + it != const_cast<DOFMatrix*>(matrix[system])->getOperatorsEnd(); + ++it) { + (*it)->getAssembler(omp_get_thread_num())->initElement(elInfo, NULL, quad); + } + + if (timestep) { + uhOld[system]->getLocalVector(el, uhOldEl[system]); + } + } + + double val = 0.0; + double h2 = h2_from_det(det, dim); + if (timestep != 0.0 || norm == NO_NORM || norm == L2_NORM) { + val = C0 * h2 * h2 * det * val; + } else { + val = C0 * h2 * det * val; + } + + est_el += val; + + // ===== jump residuals + if (C1 && (dim > 1)) { + int dow = Global::getGeo(WORLD); + + for (int face = 0; face < neighbours_; face++) { + neigh = const_cast<Element*>(elInfo->getNeighbour(face)); + if (neigh && neigh->getMark()) { + int oppV = elInfo->getOppVertex(face); + + el->sortFaceIndices(face, &faceIndEl_); + neigh->sortFaceIndices(oppV, &faceIndNeigh_); + + neighInfo->setElement(const_cast<Element*>(neigh)); + neighInfo->setFillFlag(Mesh::FILL_COORDS); + + for (int i = 0; i < dow; i++) + neighInfo->getCoord(oppV)[i] = elInfo->getOppCoord(face)[i]; + + bool periodicCoords = false; + if (!periodicCoords) { + for (int i = 0; i < dim; i++) { + int i1 = faceIndEl_[i]; + int i2 = faceIndNeigh_[i]; + for (int j = 0; j < dow; j++) + neighInfo->getCoord(i2)[j] = elInfo->getCoord(i1)[j]; + } + } + + double detNeigh = abs(neighInfo->calcGrdLambda(*lambdaNeigh_)); + + for (int iq = 0; iq < nPointsSurface_; iq++) { + jump_[iq].set(0.0); + } + + for (int system = 0; system < nSystems; system++) { + if (matrix[system] == NULL) + continue; + + uh[system]->getLocalVector(el, uhEl[system]); + uh[system]->getLocalVector(neigh, uhNeigh[system]); + + for (int iq = 0; iq < nPointsSurface_; iq++) { + (*lambda_)[face] = 0.0; + for (int i = 0; i < dim; i++) { + (*lambda_)[faceIndEl_[i]] = surfaceQuad_->getLambda(iq, i); + } + + basFcts[system]->evalGrdUh(*lambda_, + grdLambda, + uhEl[system], + &grdUhEl_[iq]); + + (*lambda_)[oppV] = 0.0; + for (int i = 0; i < dim; i++) { + (*lambda_)[faceIndNeigh_[i]] = surfaceQuad_->getLambda(iq, i); + } + + basFcts[system]->evalGrdUh(*lambda_, + *lambdaNeigh_, + uhNeigh[system], + &grdUhNeigh_[iq]); + + grdUhEl_[iq] -= grdUhNeigh_[iq]; + } + + std::vector<double*>::iterator fac; + + for (it = const_cast<DOFMatrix*>(matrix[system])->getOperatorsBegin(), + fac = const_cast<DOFMatrix*>(matrix[system])->getOperatorEstFactorBegin(); + it != const_cast<DOFMatrix*>(matrix[system])->getOperatorsEnd(); + ++it, ++fac) { + for (int iq = 0; iq < nPointsSurface_; iq++) { + localJump_[iq].set(0.0); + } + + (*it)->weakEvalSecondOrder(nPointsSurface_, + grdUhEl_.getValArray(), + localJump_.getValArray()); + double factor = *fac ? **fac : 1.0; + if (factor != 1.0) { + for (int i = 0; i < nPointsSurface_; i++) { + localJump_[i] *= factor; + } + } + + for (int i = 0; i < nPointsSurface_; i++) { + jump_[i] += localJump_[i]; + } + } + } + + val = 0.0; + for (int iq = 0; iq < nPointsSurface_; iq++) { + val += surfaceQuad_->getWeight(iq) * (jump_[iq] * jump_[iq]); + } + + double d = 0.5 * (det + detNeigh); + + if (norm == NO_NORM || norm == L2_NORM) + val *= C1 * h2_from_det(d, dim) * d; + else + val *= C1 * d; + + neigh->setEstimation(neigh->getEstimation(row) + val, row); + est_el += val; + } + } + + val = fh[std::max(row, 0)]-> + getBoundaryManager()-> + boundResidual(elInfo, matrix[std::max(row, 0)], uh[std::max(row, 0)]); + if (norm == NO_NORM || norm == L2_NORM) + val *= C1 * h2; + else + val *= C1; + + est_el += val; + } + + + el->setEstimation(est_el, row); + + est_sum += est_el; + est_max = max(est_max, est_el); + + elInfo->getElement()->setMark(0); + } + +#endif + + + + + + + + + void r(const ElInfo *elInfo, - int numPoints, + int nPoints, const double *uhIq, const WorldVector<double> *grdUhIq, const WorldMatrix<double> *D2UhIq, @@ -490,16 +672,16 @@ namespace AMDiS { if (factor) { if (D2UhIq) { - (*it)->evalSecondOrder(numPoints, uhIq, grdUhIq, D2UhIq, result, -factor); + (*it)->evalSecondOrder(nPoints, uhIq, grdUhIq, D2UhIq, result, -factor); } if (grdUhIq) { - (*it)->evalFirstOrderGrdPsi(numPoints, uhIq, grdUhIq, D2UhIq, result, factor); - (*it)->evalFirstOrderGrdPhi(numPoints, uhIq, grdUhIq, D2UhIq, result, factor); + (*it)->evalFirstOrderGrdPsi(nPoints, uhIq, grdUhIq, D2UhIq, result, factor); + (*it)->evalFirstOrderGrdPhi(nPoints, uhIq, grdUhIq, D2UhIq, result, factor); } if (uhIq) { - (*it)->evalZeroOrder(numPoints, uhIq, grdUhIq, D2UhIq, result, factor); + (*it)->evalZeroOrder(nPoints, uhIq, grdUhIq, D2UhIq, result, factor); } } } @@ -515,34 +697,34 @@ namespace AMDiS { if (factor) { if ((*it)->getUhOld()) { if (D2UhOldIq) { - (*it)->evalSecondOrder(numPoints, + (*it)->evalSecondOrder(nPoints, uhOldIq, grdUhOldIq, D2UhOldIq, result, factor); } if (grdUhOldIq) { - (*it)->evalFirstOrderGrdPsi(numPoints, + (*it)->evalFirstOrderGrdPsi(nPoints, uhOldIq, grdUhOldIq, D2UhOldIq, result, -factor); - (*it)->evalFirstOrderGrdPhi(numPoints, + (*it)->evalFirstOrderGrdPhi(nPoints, uhOldIq, grdUhOldIq, D2UhOldIq, result, -factor); } if (uhOldIq) { - (*it)->evalZeroOrder(numPoints, + (*it)->evalZeroOrder(nPoints, uhOldIq, grdUhOldIq, D2UhOldIq, result, -factor); } } else { - double *fx = GET_MEMORY(double, numPoints); - for (int iq = 0; iq < numPoints; iq++) { + double *fx = GET_MEMORY(double, nPoints); + for (int iq = 0; iq < nPoints; iq++) { fx[iq] = 0.0; } - (*it)->getC(elInfo, numPoints, fx); + (*it)->getC(elInfo, nPoints, fx); - for (int iq = 0; iq < numPoints; iq++) { + for (int iq = 0; iq < nPoints; iq++) { result[iq] -= factor * fx[iq]; } - FREE_MEMORY(fx, double, numPoints); + FREE_MEMORY(fx, double, nPoints); } } } diff --git a/AMDiS/src/ResidualEstimator.h b/AMDiS/src/ResidualEstimator.h index dd160eea9765626114cb957aafffb2912efec212..7e21cc5a9d6c0cda9c0fcc0eee944d6604ef7b41 100644 --- a/AMDiS/src/ResidualEstimator.h +++ b/AMDiS/src/ResidualEstimator.h @@ -35,12 +35,12 @@ namespace AMDiS { * Returns residual square at quadrature point. Not Member of * Estimator to avoid multiple instantiation. */ - void r(const ElInfo *elInfo, - int numPoints, - const double *uhIq, + void r(const ElInfo *elInfo, + int nPoints, + const double *uhIq, const WorldVector<double> *grdUhIq, const WorldMatrix<double> *D2UhIq, - const double *uhOldIq, + const double *uhOldIq, const WorldVector<double> *grdUhOldIq, const WorldMatrix<double> *D2UhOldIq, DOFMatrix *A, @@ -54,7 +54,7 @@ namespace AMDiS { */ inline double h2_from_det(double det, int dim) { return pow(det, 2.0 / dim); - }; + } // ============================================================================ // ===== class ResidualEstimator ============================================== @@ -79,16 +79,16 @@ namespace AMDiS { public: MEMORY_MANAGED(Creator); - Creator() : EstimatorCreator() {}; + Creator() : EstimatorCreator() {} - virtual ~Creator() {}; + virtual ~Creator() {} /** \brief * Returns a new ODirSolver object. */ Estimator* create() { return NEW ResidualEstimator(name, row); - }; + } }; @@ -124,10 +124,11 @@ namespace AMDiS { */ double C3; + /// Number of systems, e.g., number of variables in the equation. + int nSystems; - int numSystems; - - int numPoints; + /// Number of quadrature points. + int nPoints; int dim; diff --git a/AMDiS/src/SecondOrderAssembler.cc b/AMDiS/src/SecondOrderAssembler.cc index 90e0329b2c41dd1398de42848187088fc4cb9076..c1385c876a502505611ed1d9a46c0c0d55f251f5 100644 --- a/AMDiS/src/SecondOrderAssembler.cc +++ b/AMDiS/src/SecondOrderAssembler.cc @@ -68,15 +68,15 @@ namespace AMDiS { } // create new assembler - if (!optimized) { + // if (!optimized) { newAssembler = NEW Stand2(op, assembler, quad); - } else { - if (pwConst) { - newAssembler = NEW Pre2(op, assembler, quad); - } else { - newAssembler = NEW Quad2(op, assembler, quad); - } - } +// } else { +// if (pwConst) { +// newAssembler = NEW Pre2(op, assembler, quad); +// } else { +// newAssembler = NEW Quad2(op, assembler, quad); +// } +// } subAssemblers->push_back(newAssembler); return newAssembler; @@ -212,7 +212,7 @@ namespace AMDiS { if (symmetric) { for (int iq = 0; iq < nPoints; iq++) { (*LALt[iq]) *= elInfo->getDet(); - + grdPsi = psiFast->getGradient(iq); grdPhi = phiFast->getGradient(iq); @@ -285,7 +285,8 @@ namespace AMDiS { (grdPsi * ((*LALt[iq]) * grdPhi[i])); for (int j = i + 1; j < nCol; j++) { - double val = quadrature->getWeight(iq) * (grdPsi * ((*LALt[iq]) * grdPhi[j])); + double val = quadrature->getWeight(iq) * + (grdPsi * ((*LALt[iq]) * grdPhi[j])); (*mat)[i][j] += val; (*mat)[j][i] += val; } @@ -315,4 +316,122 @@ namespace AMDiS { DELETE [] LALt; } + void Stand2::calculateElementMatrix(const ElInfo *rowElInfo, + const ElInfo *colElInfo, + const ElInfo *smallElInfo, + const ElInfo *largeElInfo, + ElementMatrix *mat) + { + FUNCNAME("Stand2::calculateElementMatrix()"); + + TEST_EXIT((nRow <= 3) && (nCol <= 3))("not yet!\n"); + + bool p = false; + /* + if (smallElInfo->getLevel() == largeElInfo->getLevel() + 1) { + p = true; + std::cout << "--------------------------------------" << std::endl; + std::cout << "i-th child = " << smallElInfo->getIChild() << std::endl; + std::cout << "Mesh row = " << owner->getRowFESpace()->getMesh() << std::endl; + std::cout << "Mesh col = " << owner->getColFESpace()->getMesh() << std::endl; + std::cout << "Mesh main = " << rowElInfo->getMesh() << std::endl; + std::cout << "Mesh aux = " << colElInfo->getMesh() << std::endl; + } + */ + + DimVec<double> grdPsi(dim, NO_INIT); + VectorOfFixVecs<DimVec<double> > grdPhi(dim, nCol, NO_INIT); + + const BasisFunction *psi = owner->getRowFESpace()->getBasisFcts(); + const BasisFunction *phi = owner->getColFESpace()->getBasisFcts(); + DimMat<double> *m = smallElInfo->getSubElemCoordsMat(); + + TEST_EXIT(m)("No subElemCoordsMat!\n"); + + int nPoints = quadrature->getNumPoints(); + + DimMat<double> **LALt = NEW DimMat<double>*[nPoints]; + for (int iq = 0; iq < nPoints; iq++) { + LALt[iq] = NEW DimMat<double>(dim, NO_INIT); + LALt[iq]->set(0.0); + } + + int myRank = omp_get_thread_num(); + + if (p) { + std::cout << "Terms = " << terms[myRank].size() << std::endl; + } + + for (int i = 0; i < static_cast<int>(terms[myRank].size()); i++) { + (static_cast<SecondOrderTerm*>(terms[myRank][i])) + ->getLALt(smallElInfo, nPoints, LALt); + } + + if (p) { + for (int i = 0; i < nPoints; i++) { + std::cout << "LALt for iq = " << i << std::endl; + LALt[i]->print(); + } + } + + DimVec<double> val1(dim, DEFAULT_VALUE, 0.0); + + if (p) + std::cout << "Multiply LALt with det = " << smallElInfo->getDet() << std::endl; + + for (int iq = 0; iq < nPoints; iq++) { + (*LALt[iq]) *= smallElInfo->getDet(); + } + + /* + for (int i = 0; i < nRow; i++) { + for (int j = 0; j < nCol; j++) { + for (int iq = 0; iq < nPoints; iq++) { + + val1.set(0.0); + + for (int k = 0; k < nCol; k++) { + (*(phi->getGrdPhi(k)))(quadrature->getLambda(iq), grdPsi); + grdPsi *= (*m)[j][k]; + val1 += grdPsi; + } + + (*(psi->getGrdPhi(i)))(quadrature->getLambda(iq), grdPsi); + + (*mat)[i][j] += quadrature->getWeight(iq) * + (grdPsi * ((*LALt[iq]) * val1)); + } + } + }*/ + + for (int iq = 0; iq < nPoints; iq++) { + for (int i = 0; i < nCol; i++) { + (*(phi->getGrdPhi(i)))(quadrature->getLambda(iq), grdPhi[i]); + if (p) { + std::cout << "grdPhi[" << i << "]" << std::endl; + grdPhi[i].print(); + } + } + + for (int i = 0; i < nRow; i++) { + (*(psi->getGrdPhi(i)))(quadrature->getLambda(iq), grdPsi); + for (int j = 0; j < nCol; j++) { + (*mat)[i][j] += quadrature->getWeight(iq) * + (grdPsi * ((*LALt[iq]) * grdPhi[j])); + } + } + } + + if (p) { + mat->print(); + WAIT_REALLY; + } + + + for (int iq = 0; iq < nPoints; iq++) + DELETE LALt[iq]; + + DELETE [] LALt; + } + } diff --git a/AMDiS/src/SecondOrderAssembler.h b/AMDiS/src/SecondOrderAssembler.h index e31e2d161eaedb20fda5372325d9353ece931fda..e82cc09fa1d5ac657657db9e5598988cc4f70e10 100644 --- a/AMDiS/src/SecondOrderAssembler.h +++ b/AMDiS/src/SecondOrderAssembler.h @@ -30,35 +30,24 @@ namespace AMDiS { Quadrature *quadrat, bool optimized); - /** \brief - * Destructor. - */ - virtual ~SecondOrderAssembler() {}; + /// Destructor. + virtual ~SecondOrderAssembler() {} protected: - /** \brief - * Constructor. - */ + /// Constructor. SecondOrderAssembler(Operator *op, Assembler *assembler, Quadrature *quadrat, bool optimized); protected: - /** \brief - * List of all yet created optimized second order assemblers. - */ + /// List of all yet created optimized second order assemblers. static std::vector<SubAssembler*> optimizedSubAssemblers; - /** \brief - * List of all yet created standard second order assemblers. - */ + /// List of all yet created standard second order assemblers. static std::vector<SubAssembler*> standardSubAssemblers; }; - // ============================================================================ - // ===== class Stand2 ========================================================= - // ============================================================================ /** * \ingroup Assembler @@ -71,38 +60,29 @@ namespace AMDiS { public: MEMORY_MANAGED(Stand2); - /** \brief - * Constructor. - */ + /// Constructor. Stand2(Operator *op, Assembler *assembler, Quadrature *quad); - /** \brief - * Implements SubAssembler::calculateElementMatrix(). - */ + /// Implements SubAssembler::calculateElementMatrix(). void calculateElementMatrix(const ElInfo *elInfo, ElementMatrix *mat); + /// void calculateElementMatrix(const ElInfo *rowElInfo, const ElInfo *colElInfo, const ElInfo *smallElInfo, const ElInfo *largeElInfo, - ElementMatrix *mat) - { - ERROR_EXIT("CEM not yet\n"); - } + ElementMatrix *mat); - /** \brief - * Implements SubAssembler::calculateElementVector(). - */ - void calculateElementVector(const ElInfo *, ElementVector */*vec*/) { + /// Implements SubAssembler::calculateElementVector(). + void calculateElementVector(const ElInfo *, ElementVector *) { ERROR_EXIT("should not be called\n"); - }; + } }; - // ============================================================================ - // ===== class Quad2 ========================================================== - // ============================================================================ - - /** \brief + /** + * \ingroup Assembler + * + * \brief * Second order assembler using fast quadratures. */ class Quad2 : public SecondOrderAssembler @@ -110,18 +90,15 @@ namespace AMDiS { public: MEMORY_MANAGED(Quad2); - /** \brief - * Constructor. - */ + /// Constructor. Quad2(Operator *op, Assembler *assembler, Quadrature *quad); ~Quad2(); - /** \brief - * Implements SubAssembler::calculateElementMatrix(). - */ + /// Implements SubAssembler::calculateElementMatrix(). void calculateElementMatrix(const ElInfo *elInfo, ElementMatrix *mat); + /// void calculateElementMatrix(const ElInfo *rowElInfo, const ElInfo *colElInfo, const ElInfo *smallElInfo, @@ -131,25 +108,23 @@ namespace AMDiS { ERROR_EXIT("CEM not yet\n"); } - /** \brief - * Implements SubAssembler::calculateElementVector(). - */ + /// Implements SubAssembler::calculateElementVector(). void calculateElementVector(const ElInfo *, ElementVector */*vec*/) { ERROR_EXIT("should not be called\n"); - }; + } protected: /** \brief - * Thread safe temporary vector of DimMats for calculation in calculateElementMatrix(). + * Thread safe temporary vector of DimMats for calculation in + * function calculateElementMatrix(). */ std::vector< DimMat<double>** > tmpLALt; }; - // ============================================================================ - // ===== class Pre2 =========================================================== - // ============================================================================ - - /** \brief + /** + * \ingroup Assembler + * + * \brief * Second order assembler using predefined integrals. */ class Pre2 : public SecondOrderAssembler @@ -157,36 +132,29 @@ namespace AMDiS { public: MEMORY_MANAGED(Pre2); - /** \brief - * Constructor. - */ + /// Constructor. Pre2(Operator *op, Assembler *assembler, Quadrature *quad); - /** \brief - * Destructor. - */ + /// Destructor. ~Pre2(); - /** \brief - * Implements SubAssembler::calculateElementMatrix(). - */ + /// Implements SubAssembler::calculateElementMatrix(). void calculateElementMatrix(const ElInfo *elInfo, ElementMatrix *mat); + /// void calculateElementMatrix(const ElInfo *rowElInfo, const ElInfo *colElInfo, const ElInfo *smallElInfo, const ElInfo *largeElInfo, ElementMatrix *mat) { - ERROR_EXIT("CEM not yet\n"); + ERROR_EXIT("Not yet implemented!\n"); } - /** \brief - * Implements SubAssembler::calculateElementVector(). - */ + /// Implements SubAssembler::calculateElementVector(). void calculateElementVector(const ElInfo *, ElementVector *) { ERROR_EXIT("should not be called\n"); - }; + } protected: /** \brief @@ -196,7 +164,8 @@ namespace AMDiS { const Q11PsiPhi *q11; /** \brief - * Thread safe temporary vector of DimMats for calculation in calculateElementMatrix(). + * Thread safe temporary vector of DimMats for calculation in + * function calculateElementMatrix(). */ std::vector< DimMat<double>** > tmpLALt; diff --git a/AMDiS/src/SubAssembler.cc b/AMDiS/src/SubAssembler.cc index cc9048e34e9726bffeeb103117ae67b615b5ae5c..d710c970c0d984be92f02867a02154df6a1d2480 100644 --- a/AMDiS/src/SubAssembler.cc +++ b/AMDiS/src/SubAssembler.cc @@ -69,9 +69,7 @@ namespace AMDiS { Flag updateFlag) { if (!quadFast) { - quadFast = FastQuadrature::provideFastQuadrature(psi, - *quadrature, - updateFlag); + quadFast = FastQuadrature::provideFastQuadrature(psi, *quadrature, updateFlag); } else { if (!quadFast->initialized(updateFlag)) quadFast->init(updateFlag); @@ -80,7 +78,8 @@ namespace AMDiS { return quadFast; } - void SubAssembler::initElement(const ElInfo* elInfo, + void SubAssembler::initElement(const ElInfo* smallElInfo, + const ElInfo *largeElInfo, Quadrature *quad) { // set corrdsAtQPs invalid @@ -102,7 +101,11 @@ namespace AMDiS { // calls initElement of each term std::vector<OperatorTerm*>::iterator it; for (it = terms[myRank].begin(); it != terms[myRank].end(); ++it) { - (*it)->initElement(elInfo, this, quad); + if (largeElInfo == NULL) { + (*it)->initElement(smallElInfo, this, quad); + } else { + (*it)->initElement(smallElInfo, largeElInfo, this, quad); + } } } @@ -151,6 +154,8 @@ namespace AMDiS { TEST_EXIT_DBG(vec)("no dof vector!\n"); + TEST_EXIT(elInfo->getMesh() == vec->getFESpace()->getMesh())("Vector and fe space do not fit together!\n"); + if (valuesAtQPs[vec] && valuesAtQPs[vec]->valid) return valuesAtQPs[vec]->values.getValArray(); @@ -167,6 +172,7 @@ namespace AMDiS { (vec->getFESpace() == owner->rowFESpace) || (vec->getFESpace() == owner->colFESpace); + if (opt && !quad && sameFESpaces) { const BasisFunction *psi = owner->rowFESpace->getBasisFcts(); const BasisFunction *phi = owner->colFESpace->getBasisFcts(); @@ -197,6 +203,36 @@ namespace AMDiS { return values; } + double* SubAssembler::getVectorAtQPs(DOFVectorBase<double>* dv, + const ElInfo* smallElInfo, + const ElInfo* largeElInfo, + Quadrature *quad) + { + FUNCNAME("SubAssembler::getVectorAtQPs()"); + + const DOFVectorBase<double>* vec = dv ? dv : owner->operat->getUhOld(); + + TEST_EXIT_DBG(vec)("no dof vector!\n"); + + // if (valuesAtQPs[vec] && valuesAtQPs[vec]->valid) + // return valuesAtQPs[vec]->values.getValArray(); + + Quadrature *localQuad = quad ? quad : quadrature; + + if (!valuesAtQPs[vec]) { + valuesAtQPs[vec] = new ValuesAtQPs; + } + valuesAtQPs[vec]->values.resize(localQuad->getNumPoints()); + + double *values = valuesAtQPs[vec]->values.getValArray(); + + valuesAtQPs[vec]->valid = true; + + vec->getVecAtQPs(smallElInfo, largeElInfo, localQuad, NULL, values); + + return values; + } + WorldVector<double>* SubAssembler::getGradientsAtQPs(DOFVectorBase<double>* dv, const ElInfo* elInfo, Quadrature *quad) @@ -252,4 +288,34 @@ namespace AMDiS { return values; } + WorldVector<double>* SubAssembler::getGradientsAtQPs(DOFVectorBase<double>* dv, + const ElInfo* smallElInfo, + const ElInfo* largeElInfo, + Quadrature *quad) + { + FUNCNAME("SubAssembler::getGradientsAtQPs()"); + + const DOFVectorBase<double>* vec = dv ? dv : owner->operat->getUhOld(); + + TEST_EXIT_DBG(vec)("no dof vector!\n"); + + if (gradientsAtQPs[vec] && gradientsAtQPs[vec]->valid) + return gradientsAtQPs[vec]->values.getValArray(); + + Quadrature *localQuad = quad ? quad : quadrature; + + if (!gradientsAtQPs[vec]) { + gradientsAtQPs[vec] = new GradientsAtQPs; + } + gradientsAtQPs[vec]->values.resize(localQuad->getNumPoints()); + + WorldVector<double> *values = gradientsAtQPs[vec]->values.getValArray(); + + gradientsAtQPs[vec]->valid = true; + + vec->getGrdAtQPs(smallElInfo, largeElInfo, localQuad, NULL, values); + + return values; + } + } diff --git a/AMDiS/src/SubAssembler.h b/AMDiS/src/SubAssembler.h index 0870472ddfc03b8b87e314f884793915b6478e17..3c316034c6d8f87a6dd455b4de5823919bc06e53 100644 --- a/AMDiS/src/SubAssembler.h +++ b/AMDiS/src/SubAssembler.h @@ -57,7 +57,7 @@ namespace AMDiS { /** \brief * Destructor */ - virtual ~SubAssembler() {}; + virtual ~SubAssembler() {} /** \brief * Calculates the element matrix for elInfo and adds it to mat. Memory @@ -84,21 +84,21 @@ namespace AMDiS { */ inline std::vector<OperatorTerm*> *getTerms() { return &terms[omp_get_thread_num()]; - }; + } /** \brief * Returns \ref quadrature. */ inline Quadrature *getQuadrature() { return quadrature; - }; + } /** \brief * Sets \ref quadrature to q. */ inline void setQuadrature(Quadrature* q) { quadrature = q; - }; + } /** \brief * Returns a vector with the world coordinates of the quadrature points @@ -112,7 +112,16 @@ namespace AMDiS { * DOFVector dv evaluated at quadrature points. * Used by \ref OperatorTerm::initElement(). */ - double* getVectorAtQPs(DOFVectorBase<double>* dv, const ElInfo* elInfo, + double* getVectorAtQPs(DOFVectorBase<double>* dv, + const ElInfo* elInfo, + Quadrature *quad = NULL); + + /** \brief + * + */ + double* getVectorAtQPs(DOFVectorBase<double>* dv, + const ElInfo* smallElInfo, + const ElInfo* largeElInfo, Quadrature *quad = NULL); /** \brief @@ -123,12 +132,21 @@ namespace AMDiS { const ElInfo* elInfo, Quadrature *quad = NULL); + /** \brief + * + */ + WorldVector<double>* getGradientsAtQPs(DOFVectorBase<double>* dv, + const ElInfo* smallElInfo, + const ElInfo* largeElInfo, + Quadrature *quad = NULL); + /** \brief * Called once for each ElInfo when \ref calculateElementMatrix() or * \ref calculateElementVector() is called for the first time for this * Element. */ - virtual void initElement(const ElInfo *elInfo, + virtual void initElement(const ElInfo *smallElInfo, + const ElInfo *largeElInfo = NULL, Quadrature *quad = NULL); /** \brief @@ -136,14 +154,14 @@ namespace AMDiS { */ const FastQuadrature *getPsiFast() const { return psiFast; - }; + } /** \brief * Returns \ref phiFast. */ const FastQuadrature *getPhiFast() const { return phiFast; - }; + } protected: /** \brief diff --git a/AMDiS/src/Traverse.cc b/AMDiS/src/Traverse.cc index 6f8383ae0d222048055d5fc344cf39147588d52b..667b640e67f53261f05e69435e29f6811c55472e 100644 --- a/AMDiS/src/Traverse.cc +++ b/AMDiS/src/Traverse.cc @@ -895,7 +895,7 @@ namespace AMDiS { static int coarse_nb[3][3] = {{-2,-2,-2}, {2,-1,1}, {-1,2,0}}; /* father.neigh[coarse_nb[i][j]] == child[i-1].neigh[j] */ - int sav_index, sav_neighbour = neighbour; + int sav_index, sav_neighbour = neighbour; TEST_EXIT_DBG(stack_used > 0)("no current element"); TEST_EXIT_DBG(traverse_fill_flag.isSet(Mesh::CALL_LEAF_EL))("invalid traverse_fill_flag"); @@ -924,10 +924,10 @@ namespace AMDiS { /* save information about current element and its position in the tree */ save_traverse_mel = traverse_mel; - save_stack_used = stack_used; - for (i=0; i<=stack_used; i++) + save_stack_used = stack_used; + for (i = 0; i<=stack_used; i++) save_info_stack[i] = info_stack[i]; - for (i=0; i<=stack_used; i++) + for (i = 0; i<=stack_used; i++) (*(save_elinfo_stack[i])) = (*(elinfo_stack[i])); old_elinfo = save_elinfo_stack[stack_used]; opp_vertex = old_elinfo->getOppVertex(neighbour); diff --git a/AMDiS/src/VtkWriter.cc b/AMDiS/src/VtkWriter.cc index 74bcb31c65def9405ae0a042bcf6dc24719b6274..0363534093d90115c0f085a3c591c2b9a6044aa6 100644 --- a/AMDiS/src/VtkWriter.cc +++ b/AMDiS/src/VtkWriter.cc @@ -11,7 +11,7 @@ namespace AMDiS { - int VtkWriter::writeFile(const char *name) + int VtkWriter::writeFile(const std::string &name) { #ifdef HAVE_BOOST @@ -34,8 +34,8 @@ namespace AMDiS { #else std::ofstream file; - file.open(name); - TEST_EXIT(file.is_open())("Cannot open file %s for writing\n", name); + file.open(name.c_str()); + TEST_EXIT(file.is_open())("Cannot open file %s for writing\n", name.c_str()); writeFile(file); file.close(); @@ -46,13 +46,13 @@ namespace AMDiS { int VtkWriter::updateAnimationFile(std::string valueFilename, std::vector< std::string > *paraViewAnimationFrames, - const char *animationFilename) + const std::string &animationFilename) { size_t found = valueFilename.find_last_of("/\\"); paraViewAnimationFrames->push_back(valueFilename.substr(found + 1)); std::ofstream file; - file.open(animationFilename); + file.open(animationFilename.c_str()); file << "<?xml version=\"1.0\"?>\n"; file << "<VTKFile type=\"Collection\" version=\"0.1\" >" << "\n"; @@ -76,7 +76,7 @@ namespace AMDiS { } void VtkWriter::writeFile(DOFVector<double> *values, - const char *filename) + const std::string &filename) { DataCollector *dc = NEW DataCollector(values->getFESpace(), values); diff --git a/AMDiS/src/VtkWriter.h b/AMDiS/src/VtkWriter.h index bb6fce4ca504b85f1ce94d56b226f06df3fd0872..fa8bbbfafb74459b0996bdbf43583ac36922c4c0 100644 --- a/AMDiS/src/VtkWriter.h +++ b/AMDiS/src/VtkWriter.h @@ -51,13 +51,13 @@ namespace AMDiS { /** \brief * Writes a ParaView-VTK file. */ - int writeFile(const char *name); + int writeFile(const std::string &name); /** \brief * May be used to simply write ParaView files. */ static void writeFile(DOFVector<double> *values, - const char *filename); + const std::string &filename); /** \brief * Set a compressing method for file output. @@ -71,7 +71,7 @@ namespace AMDiS { */ int updateAnimationFile(std::string valueFilename, std::vector< std::string > *paraViewAnimationFrames, - const char *animationFilename); + const std::string &animationFilename); protected: /** \brief * Writes the VTU file to an arbitrary stream. diff --git a/AMDiS/src/ZeroOrderAssembler.cc b/AMDiS/src/ZeroOrderAssembler.cc index 2d72f50dff69dec6fee7913a1cd0b52121ee38f2..4b92dfe0e4f2be3a6a6ef0d53f6dbab1fe53c081 100644 --- a/AMDiS/src/ZeroOrderAssembler.cc +++ b/AMDiS/src/ZeroOrderAssembler.cc @@ -66,15 +66,15 @@ namespace AMDiS { } // create new assembler - if (!optimized) { + // if (!optimized) { newAssembler = NEW StandardZOA(op, assembler, quad); - } else { - if (pwConst) { - newAssembler = NEW PrecalcZOA(op, assembler, quad); - } else { - newAssembler = NEW FastQuadZOA(op, assembler, quad); - } - } +// } else { +// if (pwConst) { +// newAssembler = NEW PrecalcZOA(op, assembler, quad); +// } else { +// newAssembler = NEW FastQuadZOA(op, assembler, quad); +// } +// } subAssemblers->push_back(newAssembler); return newAssembler; @@ -82,8 +82,7 @@ namespace AMDiS { StandardZOA::StandardZOA(Operator *op, Assembler *assembler, Quadrature *quad) : ZeroOrderAssembler(op, assembler, quad, false) - { - } + {} void StandardZOA::calculateElementMatrix(const ElInfo *elInfo, ElementMatrix *mat) { @@ -158,22 +157,8 @@ namespace AMDiS { const BasisFunction *psi = owner->getRowFESpace()->getBasisFcts(); const BasisFunction *phi = owner->getColFESpace()->getBasisFcts(); DimMat<double> *m = smallElInfo->getSubElemCoordsMat(); - // m->print(); - // WAIT_REALLY; - - // The basis function on the larger element is defined as a linear - // combination of basis functions of the smaller element. At the moment, - // this is supported only for linear lagrange basis functions. - // - // If b0 and b1 are the basis functions of the larger element restricted to - // the small element, and s0 and s1 are the two basis function of the small - // element, b0 and b1 are expressed as follows: - // - // b0 = c00 * s0 + c01 * s1; - // b1 = c10 * s0 + c11 * s1; - // - // The constants are defined by the subElement Matrix. + TEST_EXIT(m)("No subElemCoordsMat!\n"); int myRank = omp_get_thread_num(); int nPoints = quadrature->getNumPoints(); @@ -184,27 +169,30 @@ namespace AMDiS { std::vector<OperatorTerm*>::iterator termIt; for (termIt = terms[myRank].begin(); termIt != terms[myRank].end(); ++termIt) { - (static_cast<ZeroOrderTerm*>((*termIt)))->getC(rowElInfo, nPoints, c); + (static_cast<ZeroOrderTerm*>((*termIt)))->getC(smallElInfo, nPoints, c); } - - for (int iq = 0; iq < nPoints; iq++) { - c[iq] *= smallElInfo->getDet(); - for (int i = 0; i < nCol; i++) { - for (int j = 0; j < nRow; j++) { - double val = quadrature->getWeight(iq) * c[iq] * (*(phi->getPhi(i)))(quadrature->getLambda(iq)); + for (int i = 0; i < nRow; i++) { + for (int j = 0; j < nCol; j++) { - double tmpval = 0.0; + for (int iq = 0; iq < nPoints; iq++) { + double val0 = c[iq] * smallElInfo->getDet() * quadrature->getWeight(iq) * + (*(phi->getPhi(i)))(quadrature->getLambda(iq)); + + double val1 = 0.0; for (int k = 0; k < nCol; k++) { - tmpval += (*m)[j][k] * (*(phi->getPhi(k)))(quadrature->getLambda(iq)); + val1 += (*m)[j][k] * (*(psi->getPhi(k)))(quadrature->getLambda(iq)); } - val *= tmpval; - (*mat)[j][i] += val; + val0 *= val1; + + (*mat)[i][j] += val0; } + } } + FREE_MEMORY(c, double, nPoints); } @@ -315,6 +303,10 @@ namespace AMDiS { const ElInfo *largeElInfo, ElementMatrix *mat) { + FUNCNAME("FastQuadZOA::calculateElementMatrix()"); + + ERROR_EXIT("CHECK FIRST, IF IT WILL REALLY WORK!\n"); + int nPoints = quadrature->getNumPoints(); int myRank = omp_get_thread_num(); DimMat<double> *m = smallElInfo->getSubElemCoordsMat(); @@ -349,12 +341,6 @@ namespace AMDiS { const double *psi = psiFast->getPhi(iq); const double *phi = phiFast->getPhi(iq); - // for (int i = 0; i < nRow; i++) { - // for (int j = 0; j < nCol; j++) { - // (*mat)[i][j] += quadrature->getWeight(iq) * c[iq] * psi[i] * phi[j]; - // } - // } - for (int i = 0; i < nCol; i++) { for (int j = 0; j < nRow; j++) { double val = quadrature->getWeight(iq) * c[iq] * psi[i]; @@ -453,8 +439,9 @@ namespace AMDiS { } } else { for (int i = 0; i < nRow; i++) - for (int j = 0; j < nCol; j++) + for (int j = 0; j < nCol; j++) { (*mat)[i][j] += c * q00->getValue(i, j); + } } } diff --git a/AMDiS/src/ZeroOrderAssembler.h b/AMDiS/src/ZeroOrderAssembler.h index 4c40f300738c8e4700169e54633a671ad2f2f923..4c9f0350b4e478a15f77b75844aa4cfa48943691 100644 --- a/AMDiS/src/ZeroOrderAssembler.h +++ b/AMDiS/src/ZeroOrderAssembler.h @@ -33,29 +33,21 @@ namespace AMDiS { bool optimized); - /** \brief - * Destructor. - */ - virtual ~ZeroOrderAssembler() {}; + /// Destructor. + virtual ~ZeroOrderAssembler() {} protected: - /** \brief - * Constructor. - */ + /// Constructor. ZeroOrderAssembler(Operator *op, Assembler *assembler, Quadrature *quadrat, bool optimized); protected: - /** \brief - * List of all yet created optimized SubAssembler objects. - */ + /// List of all yet created optimized SubAssembler objects. static std::vector<SubAssembler*> optimizedSubAssemblers; - /** \brief - * List of all yet created standard SubAssembler objects. - */ + /// List of all yet created standard SubAssembler objects. static std::vector<SubAssembler*> standardSubAssemblers; }; @@ -71,14 +63,10 @@ namespace AMDiS { public: MEMORY_MANAGED(StandardZOA); - /** \brief - * Constructor. - */ + /// Constructor. StandardZOA(Operator *op, Assembler *assembler, Quadrature *quad); - /** \brief - * Implements SubAssembler::calculateElementMatrix(). - */ + /// Implements SubAssembler::calculateElementMatrix(). void calculateElementMatrix(const ElInfo *elInfo, ElementMatrix *mat); void calculateElementMatrix(const ElInfo *rowElInfo, @@ -87,9 +75,7 @@ namespace AMDiS { const ElInfo *largeElInfo, ElementMatrix *mat); - /** \brief - * Implements SubAssembler::calculateElementVector(). - */ + /// Implements SubAssembler::calculateElementVector(). void calculateElementVector(const ElInfo *elInfo, ElementVector *vec); }; @@ -105,16 +91,12 @@ namespace AMDiS { public: MEMORY_MANAGED(FastQuadZOA); - /** \brief - * Constructor. - */ + /// Constructor. FastQuadZOA(Operator *op, Assembler *assembler, Quadrature *quad); ~FastQuadZOA(); - /** \brief - * Implements SubAssembler::calculateElementMatrix(). - */ + /// Implements SubAssembler::calculateElementMatrix(). void calculateElementMatrix(const ElInfo *elInfo, ElementMatrix *mat); void calculateElementMatrix(const ElInfo *rowElInfo, @@ -123,9 +105,7 @@ namespace AMDiS { const ElInfo *largeElInfo, ElementMatrix *mat); - /** \brief - * Implements SubAssembler::calculateElementVector(). - */ + /// Implements SubAssembler::calculateElementVector(). void calculateElementVector(const ElInfo *elInfo, ElementVector *vec); protected: @@ -144,14 +124,10 @@ namespace AMDiS { public: MEMORY_MANAGED(PrecalcZOA); - /** \brief - * Constructor. - */ + /// Constructor. PrecalcZOA(Operator *op, Assembler *assembler, Quadrature *quad); - /** \brief - * Implements SubAssembler::calculateElementMatrix(). - */ + /// Implements SubAssembler::calculateElementMatrix(). void calculateElementMatrix(const ElInfo *elInfo, ElementMatrix *mat); void calculateElementMatrix(const ElInfo *rowElInfo, @@ -160,23 +136,19 @@ namespace AMDiS { const ElInfo *largeElInfo, ElementMatrix *mat) { + FUNCNAME("PrecalcZOA::calculateElementMatrix()"); + ERROR_EXIT("CEM not yet\n"); } - /** \brief - * Implements SubAssembler::calculateElementVector(). - */ + /// Implements SubAssembler::calculateElementVector(). void calculateElementVector(const ElInfo *elInfo, ElementVector *vec); protected: - /** \brief - * Integral of the product of psi and phi. - */ + /// Integral of the product of psi and phi. const Q00PsiPhi *q00; - /** \brief - * Integral of psi. - */ + /// Integral of psi. const Q0Psi *q0; friend class ZeroOrderAssembler;