From 24469e7d72ebb76675aa12c17b5ae989daadad0d Mon Sep 17 00:00:00 2001 From: Thomas Witkowski <thomas.witkowski@gmx.de> Date: Tue, 28 Apr 2009 15:54:48 +0000 Subject: [PATCH] Cleanup of last big merge! --- AMDiS/bin/Makefile.am | 21 +- AMDiS/bin/Makefile.in | 122 +- AMDiS/src/AMDiS.h | 3 - AMDiS/src/AMDiS_fwd.h | 4 - AMDiS/src/BoxSmoother.h | 230 ---- AMDiS/src/CreatorMap.cc | 12 - AMDiS/src/DOFMatrix.cc | 12 +- AMDiS/src/DOFMatrix.h | 160 +-- AMDiS/src/DOFVector.h | 204 +-- AMDiS/src/DOFVector.hh | 131 +- AMDiS/src/DuneSolver.cc | 156 --- AMDiS/src/DuneSolver.h | 192 --- AMDiS/src/DuneSolver.hh | 148 --- AMDiS/src/GSSmoother.cc | 155 --- AMDiS/src/GSSmoother.h | 66 - AMDiS/src/InterpolRestrictMatrix.cc | 566 --------- AMDiS/src/InterpolRestrictMatrix.h | 82 -- AMDiS/src/JacobiSmoother.cc | 125 -- AMDiS/src/JacobiSmoother.h | 66 - AMDiS/src/LagrangeInterpolRestrict.h | 1283 ------------------- AMDiS/src/MatVecMultiplier.cc | 181 --- AMDiS/src/MatVecMultiplier.h | 188 --- AMDiS/src/MultiGridPreconWrapper.cc | 49 - AMDiS/src/MultiGridPreconWrapper.h | 99 -- AMDiS/src/MultiGridSolver.cc | 1731 -------------------------- AMDiS/src/MultiGridSolver.h | 631 ---------- AMDiS/src/MultiGridSolverBase.h | 157 --- AMDiS/src/MultiGridSolverBase.hh | 142 --- AMDiS/src/MultiGridWrapper.h | 151 --- AMDiS/src/ProblemScal.cc | 4 - AMDiS/src/ProblemScal.h | 4 - AMDiS/src/ProblemVec.cc | 11 +- AMDiS/src/ProblemVec.h | 8 +- AMDiS/src/ResidualEstimator.cc | 190 --- AMDiS/src/SmootherBase.h | 67 - AMDiS/src/SparseVector.cc | 103 -- AMDiS/src/SparseVector.h | 174 --- AMDiS/src/SparseVector.hh | 126 -- 38 files changed, 91 insertions(+), 7663 deletions(-) delete mode 100644 AMDiS/src/BoxSmoother.h delete mode 100644 AMDiS/src/DuneSolver.cc delete mode 100644 AMDiS/src/DuneSolver.h delete mode 100644 AMDiS/src/DuneSolver.hh delete mode 100755 AMDiS/src/GSSmoother.cc delete mode 100755 AMDiS/src/GSSmoother.h delete mode 100644 AMDiS/src/InterpolRestrictMatrix.cc delete mode 100644 AMDiS/src/InterpolRestrictMatrix.h delete mode 100755 AMDiS/src/JacobiSmoother.cc delete mode 100755 AMDiS/src/JacobiSmoother.h delete mode 100644 AMDiS/src/LagrangeInterpolRestrict.h delete mode 100644 AMDiS/src/MatVecMultiplier.cc delete mode 100644 AMDiS/src/MatVecMultiplier.h delete mode 100644 AMDiS/src/MultiGridPreconWrapper.cc delete mode 100644 AMDiS/src/MultiGridPreconWrapper.h delete mode 100644 AMDiS/src/MultiGridSolver.cc delete mode 100644 AMDiS/src/MultiGridSolver.h delete mode 100755 AMDiS/src/MultiGridSolverBase.h delete mode 100644 AMDiS/src/MultiGridSolverBase.hh delete mode 100644 AMDiS/src/MultiGridWrapper.h delete mode 100644 AMDiS/src/SmootherBase.h delete mode 100644 AMDiS/src/SparseVector.cc delete mode 100644 AMDiS/src/SparseVector.h delete mode 100644 AMDiS/src/SparseVector.hh diff --git a/AMDiS/bin/Makefile.am b/AMDiS/bin/Makefile.am index 1c5c8c23..8fd87705 100644 --- a/AMDiS/bin/Makefile.am +++ b/AMDiS/bin/Makefile.am @@ -65,25 +65,17 @@ endif libamdis_la_SOURCES = \ $(PARALLEL_AMDIS_SOURCES) \ -$(SOURCE_DIR)/MultiGridPreconWrapper.h $(SOURCE_DIR)/MultiGridPreconWrapper.cc \ -$(SOURCE_DIR)/LagrangeInterpolRestrict.h \ -$(SOURCE_DIR)/InterpolRestrictMatrix.h $(SOURCE_DIR)/InterpolRestrictMatrix.cc \ $(SOURCE_DIR)/DOFIndexed.h $(SOURCE_DIR)/DOFIndexed.cc \ $(SOURCE_DIR)/GNUPlotWriter.h $(SOURCE_DIR)/GNUPlotWriter.cc \ -$(SOURCE_DIR)/SmootherBase.h \ -$(SOURCE_DIR)/GSSMoother.h $(SOURCE_DIR)/GSSmoother.cc \ -$(SOURCE_DIR)/JacobiSMoother.h $(SOURCE_DIR)/JacobiSmoother.cc \ -$(SOURCE_DIR)/SparseVector.h $(SOURCE_DIR)/SparseVector.hh $(SOURCE_DIR)/SparseVector.cc \ $(SOURCE_DIR)/VertexVector.h $(SOURCE_DIR)/VertexVector.cc \ $(SOURCE_DIR)/PeriodicBC.h $(SOURCE_DIR)/PeriodicBC.cc \ -$(SOURCE_DIR)/MultiGridSolverBase.h $(SOURCE_DIR)/MultiGridSolverBase.hh \ -$(SOURCE_DIR)/MultiGridSolver.h $(SOURCE_DIR)/MultiGridSolver.cc \ $(SOURCE_DIR)/Recovery.h $(SOURCE_DIR)/Recovery.cc \ $(SOURCE_DIR)/RecoveryEstimator.h $(SOURCE_DIR)/RecoveryEstimator.cc \ $(SOURCE_DIR)/ResidualEstimator.h $(SOURCE_DIR)/ResidualEstimator.cc \ $(SOURCE_DIR)/Cholesky.h $(SOURCE_DIR)/Cholesky.cc \ $(SOURCE_DIR)/AdaptBase.h $(SOURCE_DIR)/AdaptBase.cc \ -$(SOURCE_DIR)/ProblemIterationInterface.h $(SOURCE_DIR)/StandardProblemIteration.h $(SOURCE_DIR)/StandardProblemIteration.cc \ +$(SOURCE_DIR)/ProblemIterationInterface.h \ +$(SOURCE_DIR)/StandardProblemIteration.h $(SOURCE_DIR)/StandardProblemIteration.cc \ $(SOURCE_DIR)/ProblemScal.h $(SOURCE_DIR)/ProblemScal.cc \ $(SOURCE_DIR)/ProblemVec.h $(SOURCE_DIR)/ProblemVec.cc \ $(SOURCE_DIR)/DualTraverse.h $(SOURCE_DIR)/DualTraverse.cc \ @@ -95,7 +87,9 @@ $(SOURCE_DIR)/CreatorInterface.h \ $(SOURCE_DIR)/ElementFunction.h \ $(SOURCE_DIR)/ProblemInterpolScal.h $(SOURCE_DIR)/ProblemInterpolScal.cc \ $(SOURCE_DIR)/ProblemInterpolVec.h $(SOURCE_DIR)/ProblemInterpolVec.cc \ -$(SOURCE_DIR)/Serializable.h $(SOURCE_DIR)/BallProject.h $(SOURCE_DIR)/CylinderProject.h \ +$(SOURCE_DIR)/Serializable.h \ +$(SOURCE_DIR)/BallProject.h \ +$(SOURCE_DIR)/CylinderProject.h \ $(SOURCE_DIR)/MacroReader.h $(SOURCE_DIR)/MacroReader.cc \ $(SOURCE_DIR)/ValueReader.h $(SOURCE_DIR)/ValueReader.cc \ $(SOURCE_DIR)/Projection.h $(SOURCE_DIR)/Projection.cc \ @@ -110,18 +104,17 @@ $(SOURCE_DIR)/SystemVector.h \ $(SOURCE_DIR)/MatrixVector.h $(SOURCE_DIR)/MatrixVector.cc \ $(SOURCE_DIR)/SurfaceQuadrature.h $(SOURCE_DIR)/SurfaceQuadrature.cc \ $(SOURCE_DIR)/LeafData.h $(SOURCE_DIR)/LeafData.cc \ -$(SOURCE_DIR)/BoundaryManager.h $(SOURCE_DIR)/BoundaryManager.cc $(SOURCE_DIR)/BoundaryCondition.h \ +$(SOURCE_DIR)/BoundaryManager.h $(SOURCE_DIR)/BoundaryManager.cc \ +$(SOURCE_DIR)/BoundaryCondition.h \ $(SOURCE_DIR)/DirichletBC.h $(SOURCE_DIR)/DirichletBC.cc \ $(SOURCE_DIR)/RobinBC.h $(SOURCE_DIR)/RobinBC.cc \ $(SOURCE_DIR)/AbstractFunction.h \ $(SOURCE_DIR)/ProblemStatBase.h \ -$(SOURCE_DIR)/MatVecMultiplier.cc \ $(SOURCE_DIR)/DOFContainer.h \ $(SOURCE_DIR)/FileWriter.h $(SOURCE_DIR)/FileWriter.hh $(SOURCE_DIR)/FileWriter.cc \ $(SOURCE_DIR)/ElementFileWriter.h $(SOURCE_DIR)/ElementFileWriter.cc \ $(SOURCE_DIR)/ElInfo.cc \ $(SOURCE_DIR)/ElInfoStack.h $(SOURCE_DIR)/ElInfoStack.cc \ -$(SOURCE_DIR)/MatVecMultiplier.h \ $(SOURCE_DIR)/Operator.h $(SOURCE_DIR)/Operator.cc \ $(SOURCE_DIR)/Mesh.cc \ $(SOURCE_DIR)/AMDiS.h \ diff --git a/AMDiS/bin/Makefile.in b/AMDiS/bin/Makefile.in index 8fd3a3d0..03caee31 100644 --- a/AMDiS/bin/Makefile.in +++ b/AMDiS/bin/Makefile.in @@ -81,24 +81,12 @@ am__libamdis_la_SOURCES_DIST = $(PARALLEL_DIR)/ConditionalEstimator.h \ $(PARALLEL_DIR)/ParMetisPartitioner.h \ $(PARALLEL_DIR)/ParMetisPartitioner.cc \ $(PARALLEL_DIR)/PartitionElementData.h \ - $(SOURCE_DIR)/MultiGridPreconWrapper.h \ - $(SOURCE_DIR)/MultiGridPreconWrapper.cc \ - $(SOURCE_DIR)/LagrangeInterpolRestrict.h \ - $(SOURCE_DIR)/InterpolRestrictMatrix.h \ - $(SOURCE_DIR)/InterpolRestrictMatrix.cc \ $(SOURCE_DIR)/DOFIndexed.h $(SOURCE_DIR)/DOFIndexed.cc \ $(SOURCE_DIR)/GNUPlotWriter.h $(SOURCE_DIR)/GNUPlotWriter.cc \ - $(SOURCE_DIR)/SmootherBase.h $(SOURCE_DIR)/GSSMoother.h \ - $(SOURCE_DIR)/GSSmoother.cc $(SOURCE_DIR)/JacobiSMoother.h \ - $(SOURCE_DIR)/JacobiSmoother.cc $(SOURCE_DIR)/SparseVector.h \ - $(SOURCE_DIR)/SparseVector.hh $(SOURCE_DIR)/SparseVector.cc \ $(SOURCE_DIR)/VertexVector.h $(SOURCE_DIR)/VertexVector.cc \ $(SOURCE_DIR)/PeriodicBC.h $(SOURCE_DIR)/PeriodicBC.cc \ - $(SOURCE_DIR)/MultiGridSolverBase.h \ - $(SOURCE_DIR)/MultiGridSolverBase.hh \ - $(SOURCE_DIR)/MultiGridSolver.h \ - $(SOURCE_DIR)/MultiGridSolver.cc $(SOURCE_DIR)/Recovery.h \ - $(SOURCE_DIR)/Recovery.cc $(SOURCE_DIR)/RecoveryEstimator.h \ + $(SOURCE_DIR)/Recovery.h $(SOURCE_DIR)/Recovery.cc \ + $(SOURCE_DIR)/RecoveryEstimator.h \ $(SOURCE_DIR)/RecoveryEstimator.cc \ $(SOURCE_DIR)/ResidualEstimator.h \ $(SOURCE_DIR)/ResidualEstimator.cc $(SOURCE_DIR)/Cholesky.h \ @@ -146,15 +134,14 @@ am__libamdis_la_SOURCES_DIST = $(PARALLEL_DIR)/ConditionalEstimator.h \ $(SOURCE_DIR)/BoundaryCondition.h $(SOURCE_DIR)/DirichletBC.h \ $(SOURCE_DIR)/DirichletBC.cc $(SOURCE_DIR)/RobinBC.h \ $(SOURCE_DIR)/RobinBC.cc $(SOURCE_DIR)/AbstractFunction.h \ - $(SOURCE_DIR)/ProblemStatBase.h \ - $(SOURCE_DIR)/MatVecMultiplier.cc $(SOURCE_DIR)/DOFContainer.h \ + $(SOURCE_DIR)/ProblemStatBase.h $(SOURCE_DIR)/DOFContainer.h \ $(SOURCE_DIR)/FileWriter.h $(SOURCE_DIR)/FileWriter.hh \ $(SOURCE_DIR)/FileWriter.cc $(SOURCE_DIR)/ElementFileWriter.h \ $(SOURCE_DIR)/ElementFileWriter.cc $(SOURCE_DIR)/ElInfo.cc \ $(SOURCE_DIR)/ElInfoStack.h $(SOURCE_DIR)/ElInfoStack.cc \ - $(SOURCE_DIR)/MatVecMultiplier.h $(SOURCE_DIR)/Operator.h \ - $(SOURCE_DIR)/Operator.cc $(SOURCE_DIR)/Mesh.cc \ - $(SOURCE_DIR)/AMDiS.h $(SOURCE_DIR)/AdaptStationary.h \ + $(SOURCE_DIR)/Operator.h $(SOURCE_DIR)/Operator.cc \ + $(SOURCE_DIR)/Mesh.cc $(SOURCE_DIR)/AMDiS.h \ + $(SOURCE_DIR)/AdaptStationary.h \ $(SOURCE_DIR)/AdaptStationary.cc \ $(SOURCE_DIR)/AdaptInstationary.h \ $(SOURCE_DIR)/AdaptInstationary.cc $(SOURCE_DIR)/QPsiPhi.h \ @@ -240,14 +227,10 @@ am__libamdis_la_SOURCES_DIST = $(PARALLEL_DIR)/ConditionalEstimator.h \ @USE_PARALLEL_AMDIS_TRUE@ libamdis_la-ParallelProblem.lo \ @USE_PARALLEL_AMDIS_TRUE@ libamdis_la-ParallelDomainProblem.lo \ @USE_PARALLEL_AMDIS_TRUE@ libamdis_la-ParMetisPartitioner.lo -am_libamdis_la_OBJECTS = $(am__objects_1) \ - libamdis_la-MultiGridPreconWrapper.lo \ - libamdis_la-InterpolRestrictMatrix.lo \ - libamdis_la-DOFIndexed.lo libamdis_la-GNUPlotWriter.lo \ - libamdis_la-GSSmoother.lo libamdis_la-JacobiSmoother.lo \ - libamdis_la-SparseVector.lo libamdis_la-VertexVector.lo \ - libamdis_la-PeriodicBC.lo libamdis_la-MultiGridSolver.lo \ - libamdis_la-Recovery.lo libamdis_la-RecoveryEstimator.lo \ +am_libamdis_la_OBJECTS = $(am__objects_1) libamdis_la-DOFIndexed.lo \ + libamdis_la-GNUPlotWriter.lo libamdis_la-VertexVector.lo \ + libamdis_la-PeriodicBC.lo libamdis_la-Recovery.lo \ + libamdis_la-RecoveryEstimator.lo \ libamdis_la-ResidualEstimator.lo libamdis_la-Cholesky.lo \ libamdis_la-AdaptBase.lo \ libamdis_la-StandardProblemIteration.lo \ @@ -264,10 +247,10 @@ am_libamdis_la_OBJECTS = $(am__objects_1) \ libamdis_la-MatrixVector.lo libamdis_la-SurfaceQuadrature.lo \ libamdis_la-LeafData.lo libamdis_la-BoundaryManager.lo \ libamdis_la-DirichletBC.lo libamdis_la-RobinBC.lo \ - libamdis_la-MatVecMultiplier.lo libamdis_la-FileWriter.lo \ - libamdis_la-ElementFileWriter.lo libamdis_la-ElInfo.lo \ - libamdis_la-ElInfoStack.lo libamdis_la-Operator.lo \ - libamdis_la-Mesh.lo libamdis_la-AdaptStationary.lo \ + libamdis_la-FileWriter.lo libamdis_la-ElementFileWriter.lo \ + libamdis_la-ElInfo.lo libamdis_la-ElInfoStack.lo \ + libamdis_la-Operator.lo libamdis_la-Mesh.lo \ + libamdis_la-AdaptStationary.lo \ libamdis_la-AdaptInstationary.lo libamdis_la-DOFVector.lo \ libamdis_la-Estimator.lo libamdis_la-ProblemInstat.lo \ libamdis_la-ProblemNonLin.lo libamdis_la-NonLinUpdater.lo \ @@ -481,25 +464,17 @@ TEMPLATE_INCLUDES = -I../lib/mtl4 -I../lib/boost_1_34_1 INCLUDES = $(AMDIS_INCLUDES) $(PARALLEL_INCLUDES) $(TEMPLATE_INCLUDES) libamdis_la_SOURCES = \ $(PARALLEL_AMDIS_SOURCES) \ -$(SOURCE_DIR)/MultiGridPreconWrapper.h $(SOURCE_DIR)/MultiGridPreconWrapper.cc \ -$(SOURCE_DIR)/LagrangeInterpolRestrict.h \ -$(SOURCE_DIR)/InterpolRestrictMatrix.h $(SOURCE_DIR)/InterpolRestrictMatrix.cc \ $(SOURCE_DIR)/DOFIndexed.h $(SOURCE_DIR)/DOFIndexed.cc \ $(SOURCE_DIR)/GNUPlotWriter.h $(SOURCE_DIR)/GNUPlotWriter.cc \ -$(SOURCE_DIR)/SmootherBase.h \ -$(SOURCE_DIR)/GSSMoother.h $(SOURCE_DIR)/GSSmoother.cc \ -$(SOURCE_DIR)/JacobiSMoother.h $(SOURCE_DIR)/JacobiSmoother.cc \ -$(SOURCE_DIR)/SparseVector.h $(SOURCE_DIR)/SparseVector.hh $(SOURCE_DIR)/SparseVector.cc \ $(SOURCE_DIR)/VertexVector.h $(SOURCE_DIR)/VertexVector.cc \ $(SOURCE_DIR)/PeriodicBC.h $(SOURCE_DIR)/PeriodicBC.cc \ -$(SOURCE_DIR)/MultiGridSolverBase.h $(SOURCE_DIR)/MultiGridSolverBase.hh \ -$(SOURCE_DIR)/MultiGridSolver.h $(SOURCE_DIR)/MultiGridSolver.cc \ $(SOURCE_DIR)/Recovery.h $(SOURCE_DIR)/Recovery.cc \ $(SOURCE_DIR)/RecoveryEstimator.h $(SOURCE_DIR)/RecoveryEstimator.cc \ $(SOURCE_DIR)/ResidualEstimator.h $(SOURCE_DIR)/ResidualEstimator.cc \ $(SOURCE_DIR)/Cholesky.h $(SOURCE_DIR)/Cholesky.cc \ $(SOURCE_DIR)/AdaptBase.h $(SOURCE_DIR)/AdaptBase.cc \ -$(SOURCE_DIR)/ProblemIterationInterface.h $(SOURCE_DIR)/StandardProblemIteration.h $(SOURCE_DIR)/StandardProblemIteration.cc \ +$(SOURCE_DIR)/ProblemIterationInterface.h \ +$(SOURCE_DIR)/StandardProblemIteration.h $(SOURCE_DIR)/StandardProblemIteration.cc \ $(SOURCE_DIR)/ProblemScal.h $(SOURCE_DIR)/ProblemScal.cc \ $(SOURCE_DIR)/ProblemVec.h $(SOURCE_DIR)/ProblemVec.cc \ $(SOURCE_DIR)/DualTraverse.h $(SOURCE_DIR)/DualTraverse.cc \ @@ -511,7 +486,9 @@ $(SOURCE_DIR)/CreatorInterface.h \ $(SOURCE_DIR)/ElementFunction.h \ $(SOURCE_DIR)/ProblemInterpolScal.h $(SOURCE_DIR)/ProblemInterpolScal.cc \ $(SOURCE_DIR)/ProblemInterpolVec.h $(SOURCE_DIR)/ProblemInterpolVec.cc \ -$(SOURCE_DIR)/Serializable.h $(SOURCE_DIR)/BallProject.h $(SOURCE_DIR)/CylinderProject.h \ +$(SOURCE_DIR)/Serializable.h \ +$(SOURCE_DIR)/BallProject.h \ +$(SOURCE_DIR)/CylinderProject.h \ $(SOURCE_DIR)/MacroReader.h $(SOURCE_DIR)/MacroReader.cc \ $(SOURCE_DIR)/ValueReader.h $(SOURCE_DIR)/ValueReader.cc \ $(SOURCE_DIR)/Projection.h $(SOURCE_DIR)/Projection.cc \ @@ -526,18 +503,17 @@ $(SOURCE_DIR)/SystemVector.h \ $(SOURCE_DIR)/MatrixVector.h $(SOURCE_DIR)/MatrixVector.cc \ $(SOURCE_DIR)/SurfaceQuadrature.h $(SOURCE_DIR)/SurfaceQuadrature.cc \ $(SOURCE_DIR)/LeafData.h $(SOURCE_DIR)/LeafData.cc \ -$(SOURCE_DIR)/BoundaryManager.h $(SOURCE_DIR)/BoundaryManager.cc $(SOURCE_DIR)/BoundaryCondition.h \ +$(SOURCE_DIR)/BoundaryManager.h $(SOURCE_DIR)/BoundaryManager.cc \ +$(SOURCE_DIR)/BoundaryCondition.h \ $(SOURCE_DIR)/DirichletBC.h $(SOURCE_DIR)/DirichletBC.cc \ $(SOURCE_DIR)/RobinBC.h $(SOURCE_DIR)/RobinBC.cc \ $(SOURCE_DIR)/AbstractFunction.h \ $(SOURCE_DIR)/ProblemStatBase.h \ -$(SOURCE_DIR)/MatVecMultiplier.cc \ $(SOURCE_DIR)/DOFContainer.h \ $(SOURCE_DIR)/FileWriter.h $(SOURCE_DIR)/FileWriter.hh $(SOURCE_DIR)/FileWriter.cc \ $(SOURCE_DIR)/ElementFileWriter.h $(SOURCE_DIR)/ElementFileWriter.cc \ $(SOURCE_DIR)/ElInfo.cc \ $(SOURCE_DIR)/ElInfoStack.h $(SOURCE_DIR)/ElInfoStack.cc \ -$(SOURCE_DIR)/MatVecMultiplier.h \ $(SOURCE_DIR)/Operator.h $(SOURCE_DIR)/Operator.cc \ $(SOURCE_DIR)/Mesh.cc \ $(SOURCE_DIR)/AMDiS.h \ @@ -761,11 +737,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-FirstOrderAssembler.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-FixVec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-GNUPlotWriter.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-GSSmoother.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-Global.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-InteriorBoundary.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-InterpolRestrictMatrix.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-JacobiSmoother.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-Lagrange.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-LeafData.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-Line.Plo@am__quote@ @@ -773,14 +746,11 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-MacroReader.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-MacroWriter.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-Marker.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-MatVecMultiplier.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-MatrixVector.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-MemoryManager.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-MemoryPool.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-Mesh.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-MeshStructure.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-MultiGridPreconWrapper.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-MultiGridSolver.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-NonLinUpdater.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-Operator.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-ParMetisPartitioner.Plo@am__quote@ @@ -810,7 +780,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-RobinBC.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-ScalableQuadrature.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-SecondOrderAssembler.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-SparseVector.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-StandardProblemIteration.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-SubAssembler.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-SubElInfo.Plo@am__quote@ @@ -892,20 +861,6 @@ libamdis_la-ParMetisPartitioner.lo: $(PARALLEL_DIR)/ParMetisPartitioner.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-ParMetisPartitioner.lo `test -f '$(PARALLEL_DIR)/ParMetisPartitioner.cc' || echo '$(srcdir)/'`$(PARALLEL_DIR)/ParMetisPartitioner.cc -libamdis_la-MultiGridPreconWrapper.lo: $(SOURCE_DIR)/MultiGridPreconWrapper.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-MultiGridPreconWrapper.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-MultiGridPreconWrapper.Tpo" -c -o libamdis_la-MultiGridPreconWrapper.lo `test -f '$(SOURCE_DIR)/MultiGridPreconWrapper.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/MultiGridPreconWrapper.cc; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-MultiGridPreconWrapper.Tpo" "$(DEPDIR)/libamdis_la-MultiGridPreconWrapper.Plo"; else rm -f "$(DEPDIR)/libamdis_la-MultiGridPreconWrapper.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(SOURCE_DIR)/MultiGridPreconWrapper.cc' object='libamdis_la-MultiGridPreconWrapper.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-MultiGridPreconWrapper.lo `test -f '$(SOURCE_DIR)/MultiGridPreconWrapper.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/MultiGridPreconWrapper.cc - -libamdis_la-InterpolRestrictMatrix.lo: $(SOURCE_DIR)/InterpolRestrictMatrix.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-InterpolRestrictMatrix.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-InterpolRestrictMatrix.Tpo" -c -o libamdis_la-InterpolRestrictMatrix.lo `test -f '$(SOURCE_DIR)/InterpolRestrictMatrix.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/InterpolRestrictMatrix.cc; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-InterpolRestrictMatrix.Tpo" "$(DEPDIR)/libamdis_la-InterpolRestrictMatrix.Plo"; else rm -f "$(DEPDIR)/libamdis_la-InterpolRestrictMatrix.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(SOURCE_DIR)/InterpolRestrictMatrix.cc' object='libamdis_la-InterpolRestrictMatrix.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-InterpolRestrictMatrix.lo `test -f '$(SOURCE_DIR)/InterpolRestrictMatrix.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/InterpolRestrictMatrix.cc - libamdis_la-DOFIndexed.lo: $(SOURCE_DIR)/DOFIndexed.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-DOFIndexed.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-DOFIndexed.Tpo" -c -o libamdis_la-DOFIndexed.lo `test -f '$(SOURCE_DIR)/DOFIndexed.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/DOFIndexed.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-DOFIndexed.Tpo" "$(DEPDIR)/libamdis_la-DOFIndexed.Plo"; else rm -f "$(DEPDIR)/libamdis_la-DOFIndexed.Tpo"; exit 1; fi @@ -920,27 +875,6 @@ libamdis_la-GNUPlotWriter.lo: $(SOURCE_DIR)/GNUPlotWriter.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-GNUPlotWriter.lo `test -f '$(SOURCE_DIR)/GNUPlotWriter.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/GNUPlotWriter.cc -libamdis_la-GSSmoother.lo: $(SOURCE_DIR)/GSSmoother.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-GSSmoother.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-GSSmoother.Tpo" -c -o libamdis_la-GSSmoother.lo `test -f '$(SOURCE_DIR)/GSSmoother.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/GSSmoother.cc; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-GSSmoother.Tpo" "$(DEPDIR)/libamdis_la-GSSmoother.Plo"; else rm -f "$(DEPDIR)/libamdis_la-GSSmoother.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(SOURCE_DIR)/GSSmoother.cc' object='libamdis_la-GSSmoother.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-GSSmoother.lo `test -f '$(SOURCE_DIR)/GSSmoother.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/GSSmoother.cc - -libamdis_la-JacobiSmoother.lo: $(SOURCE_DIR)/JacobiSmoother.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-JacobiSmoother.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-JacobiSmoother.Tpo" -c -o libamdis_la-JacobiSmoother.lo `test -f '$(SOURCE_DIR)/JacobiSmoother.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/JacobiSmoother.cc; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-JacobiSmoother.Tpo" "$(DEPDIR)/libamdis_la-JacobiSmoother.Plo"; else rm -f "$(DEPDIR)/libamdis_la-JacobiSmoother.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(SOURCE_DIR)/JacobiSmoother.cc' object='libamdis_la-JacobiSmoother.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-JacobiSmoother.lo `test -f '$(SOURCE_DIR)/JacobiSmoother.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/JacobiSmoother.cc - -libamdis_la-SparseVector.lo: $(SOURCE_DIR)/SparseVector.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-SparseVector.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-SparseVector.Tpo" -c -o libamdis_la-SparseVector.lo `test -f '$(SOURCE_DIR)/SparseVector.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/SparseVector.cc; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-SparseVector.Tpo" "$(DEPDIR)/libamdis_la-SparseVector.Plo"; else rm -f "$(DEPDIR)/libamdis_la-SparseVector.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(SOURCE_DIR)/SparseVector.cc' object='libamdis_la-SparseVector.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-SparseVector.lo `test -f '$(SOURCE_DIR)/SparseVector.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/SparseVector.cc - libamdis_la-VertexVector.lo: $(SOURCE_DIR)/VertexVector.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-VertexVector.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-VertexVector.Tpo" -c -o libamdis_la-VertexVector.lo `test -f '$(SOURCE_DIR)/VertexVector.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/VertexVector.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-VertexVector.Tpo" "$(DEPDIR)/libamdis_la-VertexVector.Plo"; else rm -f "$(DEPDIR)/libamdis_la-VertexVector.Tpo"; exit 1; fi @@ -955,13 +889,6 @@ libamdis_la-PeriodicBC.lo: $(SOURCE_DIR)/PeriodicBC.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-PeriodicBC.lo `test -f '$(SOURCE_DIR)/PeriodicBC.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/PeriodicBC.cc -libamdis_la-MultiGridSolver.lo: $(SOURCE_DIR)/MultiGridSolver.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-MultiGridSolver.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-MultiGridSolver.Tpo" -c -o libamdis_la-MultiGridSolver.lo `test -f '$(SOURCE_DIR)/MultiGridSolver.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/MultiGridSolver.cc; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-MultiGridSolver.Tpo" "$(DEPDIR)/libamdis_la-MultiGridSolver.Plo"; else rm -f "$(DEPDIR)/libamdis_la-MultiGridSolver.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(SOURCE_DIR)/MultiGridSolver.cc' object='libamdis_la-MultiGridSolver.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-MultiGridSolver.lo `test -f '$(SOURCE_DIR)/MultiGridSolver.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/MultiGridSolver.cc - libamdis_la-Recovery.lo: $(SOURCE_DIR)/Recovery.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-Recovery.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-Recovery.Tpo" -c -o libamdis_la-Recovery.lo `test -f '$(SOURCE_DIR)/Recovery.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/Recovery.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-Recovery.Tpo" "$(DEPDIR)/libamdis_la-Recovery.Plo"; else rm -f "$(DEPDIR)/libamdis_la-Recovery.Tpo"; exit 1; fi @@ -1172,13 +1099,6 @@ libamdis_la-RobinBC.lo: $(SOURCE_DIR)/RobinBC.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-RobinBC.lo `test -f '$(SOURCE_DIR)/RobinBC.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/RobinBC.cc -libamdis_la-MatVecMultiplier.lo: $(SOURCE_DIR)/MatVecMultiplier.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-MatVecMultiplier.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-MatVecMultiplier.Tpo" -c -o libamdis_la-MatVecMultiplier.lo `test -f '$(SOURCE_DIR)/MatVecMultiplier.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/MatVecMultiplier.cc; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-MatVecMultiplier.Tpo" "$(DEPDIR)/libamdis_la-MatVecMultiplier.Plo"; else rm -f "$(DEPDIR)/libamdis_la-MatVecMultiplier.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(SOURCE_DIR)/MatVecMultiplier.cc' object='libamdis_la-MatVecMultiplier.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-MatVecMultiplier.lo `test -f '$(SOURCE_DIR)/MatVecMultiplier.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/MatVecMultiplier.cc - libamdis_la-FileWriter.lo: $(SOURCE_DIR)/FileWriter.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-FileWriter.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-FileWriter.Tpo" -c -o libamdis_la-FileWriter.lo `test -f '$(SOURCE_DIR)/FileWriter.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/FileWriter.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-FileWriter.Tpo" "$(DEPDIR)/libamdis_la-FileWriter.Plo"; else rm -f "$(DEPDIR)/libamdis_la-FileWriter.Tpo"; exit 1; fi diff --git a/AMDiS/src/AMDiS.h b/AMDiS/src/AMDiS.h index d64d0761..bc9f1767 100644 --- a/AMDiS/src/AMDiS.h +++ b/AMDiS/src/AMDiS.h @@ -48,7 +48,6 @@ #include "MacroElement.h" #include "MacroWriter.h" #include "Marker.h" -#include "MatVecMultiplier.h" #include "MatrixVector.h" #include "MemoryManager.h" #include "MemoryPool.h" @@ -83,9 +82,7 @@ #include "RefinementManager2d.h" #include "RefinementManager3d.h" #include "RobinBC.h" -#include "SmootherBase.h" #include "SolutionDataStorage.h" -#include "SparseVector.h" #include "SurfaceOperator.h" #include "SurfaceQuadrature.h" #include "SystemVector.h" diff --git a/AMDiS/src/AMDiS_fwd.h b/AMDiS/src/AMDiS_fwd.h index f51a3fd8..33091ba2 100644 --- a/AMDiS/src/AMDiS_fwd.h +++ b/AMDiS/src/AMDiS_fwd.h @@ -44,13 +44,11 @@ namespace AMDiS { class FileWriterInterface; class FiniteElemSpace; class IdentityPreconditioner; - class InterpolRestrictMatrix; class ITL_BasePreconditioner; class LeafDataPeriodic; class LevelAdmin; class Marker; class Mesh; - class MultiGridSortSolver; class OEMSolver; class Operator; class ProblemInstat; @@ -65,14 +63,12 @@ namespace AMDiS { class VertexVector; template<typename ReturnType, typename ArgumentType> class AbstractFunction; - template<typename VectorType> class MatVecMultiplier; template<typename T> class DOFVectorBase; template<typename T> class DOFVector; template<typename T> class ITL_Preconditioner; template<typename T> class Matrix; template<typename T> class MatVecMultiplier; template<typename T> class SolverMatrix; - template<typename T> class SparseVector; template<typename T> class Vector; template <typename ITLSolver> class ITL_OEMSolver; diff --git a/AMDiS/src/BoxSmoother.h b/AMDiS/src/BoxSmoother.h deleted file mode 100644 index 52deed36..00000000 --- a/AMDiS/src/BoxSmoother.h +++ /dev/null @@ -1,230 +0,0 @@ -#ifndef AMDIS_BOXSMOOTHER_H -#define AMDIS_BOXSMOOTHER_H - -#include "SmootherBase.h" -#include "MemoryManager.h" -#include "DOFMatrix.h" -#include "SparseVector.h" -#include "MatrixVector.h" -#include "Global.h" -#include "GaussElimination.h" -#include "FiniteElemSpace.h" -#include "GaussElimination.h" -#include <set> - -namespace AMDiS { - - class BoxSmoother - : public SmootherBase<Matrix<DOFMatrix*>, - Vector<SparseVector<double>*>, - Vector< std::set<DegreeOfFreedom>*> > - { - public: - MEMORY_MANAGED(BoxSmoother); - - class Creator - : public SmootherCreator<Matrix<DOFMatrix*>, - Vector<SparseVector<double>*>, - Vector< std::set<DegreeOfFreedom>*> > - { - public: - MEMORY_MANAGED(Creator); - - SmootherBase<Matrix<DOFMatrix*>, - Vector<SparseVector<double>*>, - Vector< std::set<DegreeOfFreedom>*> >* - create() { - return NEW BoxSmoother(this->name); - }; - }; - - BoxSmoother(std::string name) - : SmootherBase<Matrix<DOFMatrix*>, - Vector<SparseVector<double>*>, - Vector< std::set<DegreeOfFreedom>*> >(name), - boxMatrix_(NULL), - boxSolution_(NULL), - boxRHS_(NULL), - numComponents_(0), - sumDOFs_(0) - { - directSolver_ = - NEW GaussElimination<Matrix<double>, Vector<double> >(); - }; - - virtual ~BoxSmoother() - { - if(boxMatrix_) DELETE boxMatrix_; - if(boxSolution_) DELETE boxSolution_; - if(boxRHS_) DELETE boxRHS_; - DELETE directSolver_; - }; - - void smooth(Matrix<DOFMatrix*> *matrix, - Vector<SparseVector<double>*> *solution, - Vector<SparseVector<double>*> *rhs, - int iterations, - const Vector< std::set<DegreeOfFreedom>*> &dofSet) - { - FUNCNAME("BoxSmoother::smooth()"); - ERROR_EXIT("Will be rewritten - Peter\n"); - -#if 0 - int i, j, k; - - // allocate memory - if(!boxMatrix_) { - numComponents_ = solution->getSize(); - numDOFs_.resize(numComponents_); - sumDOFs_ = 0; - for(i = 0; i < numComponents_; i++) { - numDOFs_[i] = (*solution)[i]->getFESpace()->getBasisFcts()->getNumber(); - sumDOFs_ += numDOFs_[i]; - } - - boxMatrix_ = NEW Matrix<double>(sumDOFs_, sumDOFs_); - boxSolution_ = NEW Vector<double>(sumDOFs_); - boxRHS_ = NEW Vector<double>(sumDOFs_); - } - - // create local equation system - int boxSize = 0; - std::vector<int> offset(numComponents_, 0); - std::vector< std::map<DegreeOfFreedom, int> > indexOfDOF(numComponents_); - std::set<DegreeOfFreedom>::const_iterator dofIt, dofBegin, dofEnd; - std::vector<MatEntry>::iterator rowIt, rowBegin, rowEnd; - - int pos; - for(i = 0; i < numComponents_; i++) { - if(dofSet[i]) { - offset[i] = boxSize; - boxSize += numDOFs_[i]; - dofBegin = dofSet[i]->begin(); - dofEnd = dofSet[i]->end(); - pos = 0; - for(dofIt = dofBegin; dofIt != dofEnd; ++dofIt) { - indexOfDOF[i][*dofIt] = pos + 1; -// MSG("%d : %d, %d \n", *dofIt, i, pos); - ++pos; - } - } - } - - for(i = 0; i < boxSize; i++) { - for(j = 0; j < boxSize; j++) { - (*boxMatrix_)[i][j] = 0.0; - } - (*boxRHS_)[i] = 0.0; - } - - pos = 0; - for(i = 0; i < numComponents_; i++) { - if(dofSet[i]) { - dofBegin = dofSet[i]->begin(); - dofEnd = dofSet[i]->end(); - for(dofIt = dofBegin; dofIt != dofEnd; ++dofIt) { - - // fill box rhs - (*boxRHS_)[pos] = (*((*rhs)[i]))[*dofIt]; - - // fill box matrix - for(j = 0; j < numComponents_; j++) { - if((*matrix)[i][j] != NULL) { - rowBegin = (*((*matrix)[i][j]))[*dofIt].begin(); - rowEnd = (*((*matrix)[i][j]))[*dofIt].end(); - for(rowIt = rowBegin; rowIt != rowEnd; ++rowIt) { - if(rowIt->col == DOFMatrix::UNUSED_ENTRY) continue; - if(rowIt->col == DOFMatrix::NO_MORE_ENTRIES) break; - int ind = indexOfDOF[j][rowIt->col] - 1; - if(ind != -1) { - (*boxMatrix_)[pos][offset[j] + ind] = rowIt->entry; - } else { - (*boxRHS_)[pos] -= - rowIt->entry * (*((*solution)[j]))[rowIt->col]; - } - } - } else { - for(k = 0; k < numDOFs_[j]; k++) { - (*boxMatrix_)[pos][offset[j] + k] = 0.0; - } - } - } - - ++pos; - } - } - } - -// int a,b; - -// for(i = 0; i < numComponents_; i++) { -// MSG("DOFs %d: ", i); -// dofBegin = dofSet[i]->begin(); -// dofEnd = dofSet[i]->end(); -// for(dofIt = dofBegin; dofIt != dofEnd; ++dofIt) { -// MSG("%d ", *dofIt); -// } -// MSG("\n"); -// } - -// for(a = 0; a < numComponents_; a++) { -// for(b = 0; b < numComponents_; b++) { -// MSG("matrix[%d][%d]:\n", a, b); -// if((*matrix)[a][b]) { -// (*matrix)[a][b]->print(); -// MSG("solution[%d]\n", b); -// (*solution)[b]->print(); -// MSG("rhs[%d]\n", a); -// (*rhs)[a]->print(); -// } -// } -// } - -// MSG("matrix:\n"); -// for(a = 0; a < boxSize; a++) { -// for(b = 0; b < boxSize; b++) { -// MSG("%e ", (*boxMatrix_)[a][b]); -// } -// MSG("\n"); -// } - -// MSG("rhs:\n"); -// for(a = 0; a < boxSize; a++) { -// MSG("%e\n", (*boxRHS_)[a]); -// } - - // apply direct solver - directSolver_->solve(*boxMatrix_, *boxRHS_, *boxSolution_, boxSize); - -// MSG("solution:\n"); -// for(a = 0; a < boxSize; a++) { -// MSG("%e\n", (*boxSolution_)[a]); -// } - -// WAIT_REALLY; - - // copy solution - pos = 0; - for(i = 0; i < numComponents_; i++) { - dofBegin = dofSet[i]->begin(); - dofEnd = dofSet[i]->end(); - for(dofIt = dofBegin; dofIt != dofEnd; ++dofIt) { - (*((*solution)[i]))[*dofIt] = (*boxSolution_)[pos]; - ++pos; - } - } -#endif - }; - - protected: - Matrix<double> *boxMatrix_; - Vector<double> *boxSolution_; - Vector<double> *boxRHS_; - int numComponents_; - std::vector<int> numDOFs_; - int sumDOFs_; - DirectSolverInterface<Matrix<double>, Vector<double> > *directSolver_; - }; -} - -#endif diff --git a/AMDiS/src/CreatorMap.cc b/AMDiS/src/CreatorMap.cc index 31c4206c..0dd14dea 100644 --- a/AMDiS/src/CreatorMap.cc +++ b/AMDiS/src/CreatorMap.cc @@ -10,14 +10,8 @@ #include "ResidualEstimator.h" #include "LeafData.h" #include "SurfaceRegion_ED.h" -#include "MultiGridWrapper.h" #include "DOFMatrix.h" -#include "SparseVector.h" -#include "GSSmoother.h" -#include "JacobiSmoother.h" #include "ElementRegion_ED.h" -#include "BoxSmoother.h" -#include "MultiGridPreconWrapper.h" #include "UmfPackSolver.h" namespace AMDiS { @@ -64,12 +58,6 @@ namespace AMDiS { creator = NEW ICPreconditioner::Creator; addCreator("ic", creator); - - -#if 0 - creator = NEW MGPreconWrapperScal::Creator; - addCreator("mg", creator); -#endif } diff --git a/AMDiS/src/DOFMatrix.cc b/AMDiS/src/DOFMatrix.cc index d0f9edfc..4000fa39 100644 --- a/AMDiS/src/DOFMatrix.cc +++ b/AMDiS/src/DOFMatrix.cc @@ -43,9 +43,8 @@ namespace AMDiS { { TEST_EXIT(rowFESpace)("no rowFESpace\n"); - if (!colFESpace) { + if (!colFESpace) colFESpace = rowFESpace; - } if (rowFESpace && rowFESpace->getAdmin()) (const_cast<DOFAdmin*>(rowFESpace->getAdmin()))->addDOFIndexed(this); @@ -149,19 +148,22 @@ namespace AMDiS { DOFMatrix& DOFMatrix::operator=(const DOFMatrix& rhs) { - TEST_EXIT(rhs.inserter == 0 && inserter == 0)("Cannot copy during insertion"); - rowFESpace = rhs.rowFESpace; colFESpace = rhs.colFESpace; operators = rhs.operators; operatorFactor = rhs.operatorFactor; - matrix = rhs.matrix; coupleMatrix = rhs.coupleMatrix; + + /// The matrix values may only be copyed, if there is no active insertion. + if (rhs.inserter == 0 && inserter == 0) + matrix = rhs.matrix; + if (rhs.boundaryManager) { boundaryManager = NEW BoundaryManager(*rhs.boundaryManager); } else { boundaryManager = NULL; } + if (rhs.elementMatrix) { elementMatrix = NEW ElementMatrix(rowFESpace->getBasisFcts()->getNumber(), colFESpace->getBasisFcts()->getNumber()); diff --git a/AMDiS/src/DOFMatrix.h b/AMDiS/src/DOFMatrix.h index c4c5da5c..577a5fc1 100644 --- a/AMDiS/src/DOFMatrix.h +++ b/AMDiS/src/DOFMatrix.h @@ -22,10 +22,6 @@ #ifndef AMDIS_DOFMATRIX_H #define AMDIS_DOFMATRIX_H -// ============================================================================ -// ===== includes ============================================================= -// ============================================================================ - #include <vector> #include <set> #include <memory> @@ -49,110 +45,6 @@ namespace AMDiS { - - // =========================================================================== - // ===== struct MatEntry ===================================================== - // =========================================================================== - - /** \brief - * Represents one entry of a DOFMatrix - */ - struct MatEntry - { - /** \brief - * column index of entry (if >= 0; else unused) - */ - DegreeOfFreedom col; - - /** \brief - * matrix entry - */ - double entry; - }; - - - /** \brief - * Is used to search for all entries of a matrix which column index is - * smaller than a given value. - */ - class MatEntryValueLess : public std::unary_function<MatEntry, bool> { - private: - const double value_; - public: - MatEntryValueLess(const double& value) - : value_(value) - {} - - bool operator()(const MatEntry& m) { - return (fabs(m.entry) < value_); - } - }; - - - /** \brief - * Is used to search for all entries of a matrix which value is smaller - * than a given value. - */ - class MatEntryColLess : public std::unary_function<MatEntry, bool> { - private: - const int col_; - public: - MatEntryColLess(const int& col) - : col_(col) - {} - - bool operator()(const MatEntry& m) { - return (fabs(m.col) < col_); - } - }; - - - /** \brief - * This function is required if two MatEntries are compared by their col - * entry (for example when sorting a vector of MatEntries). - */ - struct CmpMatEntryCol : public std::binary_function<MatEntry, MatEntry, bool> { - bool operator()(const MatEntry& m1, const MatEntry m2) const { - return m1.col < m2.col; - } - }; - - - /** \brief - * This function compares two matrix entries by their values. It returns true, - * if the value of m2 is greater than the value of m1. - */ - struct CmpMatEntryValue : public std::binary_function<MatEntry, MatEntry, bool> { - bool operator()(const MatEntry& m1, const MatEntry m2) const { - return m1.entry < m2.entry; - } - }; - - - /** \brief - * This function compares two matrix entries by their values. It returns true, - * if the value of m2 is greater than the value of m1. - */ - struct CmpMatEntryAbsValueLess : public std::binary_function<MatEntry, MatEntry, bool> { - bool operator()(const MatEntry& m1, const MatEntry m2) const { - return fabs(m1.entry) < fabs(m2.entry); - } - }; - - /** \brief - * This function compares two matrix entries by their values. It returns true, - * if the value of m1 is greater than the value of m2. - */ - struct CmpMatEntryAbsValueGreater : public std::binary_function<MatEntry, MatEntry, bool> { - bool operator()(const MatEntry& m1, const MatEntry m2) const { - return fabs(m1.entry) > fabs(m2.entry); - } - }; - - // ============================================================================ - // ===== class DOFMatrix ====================================================== - // ============================================================================ - /** \ingroup DOFAdministration * \brief * A DOFMatrix is a sparse matrix representation for matrices that work @@ -175,28 +67,7 @@ namespace AMDiS { typedef mtl::matrix::inserter<base_matrix_type> inserter_type; private: - /** \ingroup DOFAdministration - * \brief - * Alias for DOFIterator< std::vector<MatEntry<T> > >. So one can access an - * iterator working on a DOFMatrix via DOFMatrix::Iterator - */ - class Iterator : public DOFIterator< std::vector<MatEntry> > { - public: - Iterator(DOFIndexed< std::vector<MatEntry> > *c, - DOFIteratorType type) - : DOFIterator< std::vector<MatEntry> >(c, type) - {} - }; - - /** \brief - * A MatrixRow represents one row of the sparse matrix. It is realized by - * a STL vector of MatEntry<T> objects - */ - typedef std::vector<MatEntry> MatrixRow; - - /** \brief - * Symbolic constant for an unused matrix entry - */ + /// Symbolic constant for an unused matrix entry static const int UNUSED_ENTRY = -1; /** \brief @@ -208,28 +79,17 @@ namespace AMDiS { public: DOFMatrix(); - /** \brief - * Constructs a DOFMatrix with name n and the given row and - * column FESpaces. - */ - DOFMatrix(const FiniteElemSpace* rowFESpace, - const FiniteElemSpace* colFESpace, + /// Constructs a DOFMatrix with name n and the given row and olumn FESpaces. + DOFMatrix(const FiniteElemSpace* rowFESpace, const FiniteElemSpace* colFESpace, std::string n = ""); - /** \brief - * Copy-Constructor - */ + /// Copy-Constructor DOFMatrix(const DOFMatrix& rhs); - - /** \brief - * Destructor - */ + /// Destructor virtual ~DOFMatrix(); - /** \brief - * operator= - */ + /// Assignment operator. DOFMatrix& operator=(const DOFMatrix& rhs); void copy(const DOFMatrix& rhs); @@ -249,12 +109,10 @@ namespace AMDiS { // Only to get rid of the abstract functions, I hope they are not used std::vector<bool>::iterator begin() {ERROR_EXIT("Shouldn't be used, only fake."); std::vector<bool> v; return v.begin();} std::vector<bool>::iterator end() {ERROR_EXIT("Shouldn't be used, only fake."); std::vector<bool> v; return v.end();} -#if 1 bool dummy; // Must be deleted later bool& operator[](int i) {ERROR_EXIT("Shouldn't be used, only fake."); return dummy;} const bool& operator[](int i) const {ERROR_EXIT("Shouldn't be used, only fake."); return dummy;} -#endif /// DOFMatrix does not need to be compressed before assembling, when using MTL4. void compressDOFIndexed(int first, int last, std::vector<DegreeOfFreedom> &newDOF) {} @@ -459,12 +317,6 @@ namespace AMDiS { int irow, int jcol, double entry, bool add = true); - void addMatEntry(int row, MatEntry entry); - - void addMatEntry(int row, int DegreeOfFreedom, double value); - - void addRow(std::vector<MatEntry> row); - void removeRowsWithDBC(std::set<int> *rows); /// Prints \ref matrix to stdout diff --git a/AMDiS/src/DOFVector.h b/AMDiS/src/DOFVector.h index f56e7889..7acd2856 100644 --- a/AMDiS/src/DOFVector.h +++ b/AMDiS/src/DOFVector.h @@ -22,10 +22,6 @@ #ifndef AMDIS_DOFVECTOR_H #define AMDIS_DOFVECTOR_H -// =========================================================================== -// ===== includes ============================================================ -// =========================================================================== - #include <vector> #include <memory> #include <list> @@ -51,10 +47,6 @@ namespace AMDiS { - // =========================================================================== - // ===== forward declarations ================================================ - // =========================================================================== - template<typename T> class DOFVectorBase : public DOFIndexed<T> { @@ -252,23 +244,13 @@ namespace AMDiS { int dim; }; - - // =========================================================================== - // ===== defs ================================================================ - // =========================================================================== - - /** \brief - * Specifies which operation should be done after coarsening - */ + /// Specifies which operation should be done after coarsening typedef enum{ NO_OPERATION = 0, COARSE_RESTRICT = 1, COARSE_INTERPOL = 2 } CoarsenOperation; - // =========================================================================== - // ===== class DOFVector ===================================================== - // =========================================================================== /** \ingroup DOFAdministration * \brief @@ -324,9 +306,7 @@ namespace AMDiS { }; public: - /** \brief - * Empty constructor. No initialization! - */ + /// Empty constructor. No initialization! DOFVector() : DOFVectorBase<T>(), //elementVector(NULL), @@ -334,19 +314,13 @@ namespace AMDiS { coarsenOperation(NO_OPERATION) {} - /** \brief - * Constructs a DOFVector with name n belonging to FiniteElemSpace f - */ + /// Constructs a DOFVector with name n belonging to FiniteElemSpace f DOFVector(const FiniteElemSpace* f, std::string n); - /** \brief - * Initialization. - */ + /// Initialization. void init(const FiniteElemSpace* f, std::string n); - /** \brief - * Copy Constructor - */ + /// Copy Constructor DOFVector(const DOFVector& rhs) { *this = rhs; name = rhs.name + "copy"; @@ -355,21 +329,15 @@ namespace AMDiS { } } - /** \brief - * Destructor - */ + /// Destructor virtual ~DOFVector(); - /** \brief - * Returns iterator to the begin of \ref vec - */ + /// Returns iterator to the begin of \ref vec typename std::vector<T>::iterator begin() { return vec.begin(); } - /** \brief - * Returns iterator to the end of \ref vec - */ + /// Returns iterator to the end of \ref vec typename std::vector<T>::iterator end() { return vec.end(); } @@ -380,72 +348,53 @@ namespace AMDiS { */ virtual void compressDOFIndexed(int first, int last, std::vector<DegreeOfFreedom> &newDof); - /** \brief - * Sets \ref coarsenOperation to op - */ + + /// Sets \ref coarsenOperation to op inline void setCoarsenOperation(CoarsenOperation op) { coarsenOperation = op; } - /** \brief - * Returns \ref coarsenOperation - */ + /// Returns \ref coarsenOperation inline CoarsenOperation getCoarsenOperation() { return coarsenOperation; } - /** \brief - * Restriction after coarsening. Implemented for DOFVector<double> - */ + /// Restriction after coarsening. Implemented for DOFVector<double> inline void coarseRestrict(RCNeighbourList&, int) {} - /** \brief - * Interpolation after refinement. - */ + /// Interpolation after refinement. inline void refineInterpol(RCNeighbourList&, int) {} - /** \brief - * Returns \ref vec - */ + /// Returns \ref vec std::vector<T>& getVector() { return vec; } - /** \brief - * Returns size of \ref vec - */ + /// Returns size of \ref vec inline int getSize() const { return vec.size(); } - /** \brief - * Returns used size of the vector. - */ + /// Returns used size of the vector. inline int getUsedSize() const { return feSpace->getAdmin()->getUsedSize(); } - /** \brief - * Resizes \ref vec to n - */ + /// Resizes \ref vec to n inline void resize(int n) { FUNCNAME("DOFVector<T>::resize()"); TEST_EXIT_DBG((n >= 0))("Can't resize DOFVector to negative size\n"); vec.resize(n); } - /** \brief - * Resizes \ref vec to n and inits new values with init - */ + /// Resizes \ref vec to n and inits new values with init inline void resize(int n, T init) { FUNCNAME("DOFVector<T>::resize()"); TEST_EXIT_DBG((n >= 0))("Can't resize DOFVector to negative size\n"); vec.resize(n, init); } - /** \brief - * Returns \ref vec[i] - */ + /// Returns \ref vec[i] inline const T& operator[](DegreeOfFreedom i) const { FUNCNAME("DOFVector<T>::operator[]"); TEST_EXIT_DBG((i>= 0) && (i < static_cast<int>(vec.size()))) @@ -453,9 +402,7 @@ namespace AMDiS { return vec[i]; } - /** \brief - * Returns \ref vec[i] - */ + /// Returns \ref vec[i] inline T& operator[](DegreeOfFreedom i) { FUNCNAME("DOFVector<T>::operator[]"); TEST_EXIT_DBG((i >= 0) && (i < static_cast<int>(vec.size()))) @@ -463,110 +410,72 @@ namespace AMDiS { return vec[i]; } - /** \brief - * Calculates Integral of this DOFVector - */ + /// Calculates Integral of this DOFVector double Int(Quadrature* q = NULL) const; - /** \brief - * Calculates L1 norm of this DOFVector - */ + /// Calculates L1 norm of this DOFVector double L1Norm(Quadrature* q = NULL) const; - /** \brief - * Calculates L2 norm of this DOFVector - */ + /// Calculates L2 norm of this DOFVector inline double L2Norm(Quadrature* q = NULL) const { return sqrt(L2NormSquare()); } - /** \brief - * Calculates square of L2 norm of this DOFVector - */ + /// Calculates square of L2 norm of this DOFVector double L2NormSquare(Quadrature* q = NULL) const; - /** \brief - * Calculates H1 norm of this DOFVector - */ + /// Calculates H1 norm of this DOFVector inline double H1Norm(Quadrature* q = NULL) const { return sqrt(H1NormSquare()); } - /** \brief - * Calculates square of H1 norm of this DOFVector - */ + /// Calculates square of H1 norm of this DOFVector double H1NormSquare(Quadrature* q = NULL) const; - /** \brief - * Calculates euclidian norm of this DOFVector - */ + /// Calculates euclidian norm of this DOFVector double nrm2() const; - /** \brief - * Returns square of the euclidian norm. - */ + /// Returns square of the euclidian norm. double squareNrm2() const; - /** \brief - * Calculates l2 norm of this DOFVector - */ + /// Calculates l2 norm of this DOFVector inline double l2norm() const { return nrm2(); } - /** \brief - * Calculates the absolute sum of this DOFVector - */ + /// Calculates the absolute sum of this DOFVector T asum() const; - /** \brief - * Calculates the l1 norm of this DOFVector - */ + /// Calculates the l1 norm of this DOFVector inline double l1norm() const { return asum(); } - /** \brief - * Calculates doublewell of this DOFVector - */ + /// Calculates doublewell of this DOFVector double DoubleWell(Quadrature* q = NULL) const; - /** \brief - * Calculates the sum of this DOFVector - */ + /// Calculates the sum of this DOFVector T sum() const; - /** \brief - * Sets \ref vec[i] = val, i=0 , ... , size - */ + /// Sets \ref vec[i] = val, i=0 , ... , size void set(T val); - /** \brief - * Assignment operator for setting complete vector to a certain value d - */ + /// Assignment operator for setting complete vector to a certain value d inline DOFVector<T>& operator=(T d) { set(d); return *this; } - /** \brief - * Assignment operator between two vectors - */ + /// Assignment operator between two vectors DOFVector<T>& operator=(const DOFVector<T>&); - /** \brief - * vec[i] = v.vec[i] - */ + /// vec[i] = v.vec[i] void copy(const DOFVector<T>& v); - /** \brief - * Returns minimum of DOFVector - */ + /// Returns minimum of DOFVector T min() const; - /** \brief - * Returns maximum of DOFVector - */ + /// Returns maximum of DOFVector T max() const; /// Returns absolute maximum of DOFVector @@ -616,29 +525,19 @@ namespace AMDiS { #endif protected: - /** \brief - * Used by Int while mesh traversal - */ + /// Used by Int while mesh traversal static int Int_fct(ElInfo* elinfo); - /** \brief - * Used by L1Norm while mesh traversal - */ + /// Used by L1Norm while mesh traversal static int L1Norm_fct(ElInfo* elinfo); - /** \brief - * Used by L2Norm while mesh traversal - */ + /// Used by L2Norm while mesh traversal static int L2Norm_fct(ElInfo* elinfo); - /** \brief - * Used by H1Norm while mesh traversal - */ + /// Used by H1Norm while mesh traversal static int H1Norm_fct(ElInfo* elinfo); - /** \brief - * Used by DoubleWell while mesh traversal - */ + /// Used by DoubleWell while mesh traversal static int DoubleWell_fct(ElInfo* elinfo); protected: @@ -673,7 +572,6 @@ namespace AMDiS { static double norm; }; - // =============================================================================== template<> void DOFVector<double>::refineInterpol(RCNeighbourList&, int); @@ -689,9 +587,6 @@ namespace AMDiS { return v.max(); } - // =========================================================================== - // ===== class DOFVectorDOF ================================================== - // =========================================================================== /** \ingroup DOFAdministration * \brief @@ -747,10 +642,6 @@ namespace AMDiS { }; - - // =============================================================================== - - template<typename T> double norm(DOFVector<T> *vec) { return vec->nrm2(); @@ -776,22 +667,18 @@ namespace AMDiS { const DOFVector<T>& operator*=(DOFVector<T>& x, const DOFVector<T>& y); // multiplication with scalar - template<typename T> const DOFVector<T>& operator*=(DOFVector<T>& x, T scal); // scalar product - template<typename T> T operator*(DOFVector<T>& x, DOFVector<T>& y); // addition - template<typename T> const DOFVector<T>& operator+=(DOFVector<T>& x, const DOFVector<T>& y); // subtraction - template<typename T> const DOFVector<T>& operator-=(DOFVector<T>& x, const DOFVector<T>& y); @@ -804,10 +691,7 @@ namespace AMDiS { template<typename T> const DOFVector<T>& operator+(const DOFVector<T>&v1 , const DOFVector<T>& v2); - - // y = a*x + y - template<typename T> void axpy(double a,const DOFVector<T>& x, DOFVector<T>& y); diff --git a/AMDiS/src/DOFVector.hh b/AMDiS/src/DOFVector.hh index 233c6769..68967f90 100644 --- a/AMDiS/src/DOFVector.hh +++ b/AMDiS/src/DOFVector.hh @@ -135,13 +135,11 @@ namespace AMDiS { template<typename T> DOFVector<T>::~DOFVector() { - if(feSpace && feSpace->getAdmin()) { + if (feSpace && feSpace->getAdmin()) (feSpace->getAdmin())->removeDOFIndexed(this); - } - if (this->boundaryManager) { + if (this->boundaryManager) DELETE this->boundaryManager; - } vec.clear(); } @@ -345,130 +343,6 @@ namespace AMDiS { return std::max(abs(max()), abs(min())); } - template<typename T> - void gemv(MatrixTranspose transpose, T alpha, - const DOFMatrix& a, const DOFVector<T>& x, - T beta, DOFVector<T>& y) - { - FUNCNAME("DOFVector<T>::gemv()"); - - int j, jcol, ysize; - T sum, ax; - const DOFMatrix::MatrixRow *row; - - TEST_EXIT_DBG(a.getRowFESpace() && - a.getColFESpace() && - x.getFESpace() && - y.getFESpace()) - ("feSpace is NULL: %8X, %8X, %8X, %8X\n", - a.getRowFESpace(), a.getColFESpace(), x.getFESpace(), y.getFESpace()); - TEST_EXIT_DBG(a.getRowFESpace()->getAdmin() && - a.getColFESpace()->getAdmin() && - (((transpose == NoTranspose) && - (a.getColFESpace()->getAdmin() == x.getFESpace()->getAdmin()) && - (a.getRowFESpace()->getAdmin() == y.getFESpace()->getAdmin()))|| - ((transpose == Transpose) && - (a.getRowFESpace()->getAdmin() == x.getFESpace()->getAdmin()) && - (a.getColFESpace()->getAdmin() == y.getFESpace()->getAdmin())))) - ("no admin or different admins: %8X, %8X, %8X, %8X\n", - a.getRowFESpace()->getAdmin(), a.getColFESpace()->getAdmin(), - x.getFESpace()->getAdmin(), y.getFESpace()->getAdmin()); - - if (transpose == NoTranspose) { - TEST_EXIT_DBG(static_cast<int>(x.getSize()) >= a.getColFESpace()->getAdmin()->getUsedSize()) - ("x.size = %d too small: admin->sizeUsed = %d\n", - x.getSize(), a.getColFESpace()->getAdmin()->getUsedSize()); - TEST_EXIT_DBG(static_cast<int>(y.getSize()) >= a.getRowFESpace()->getAdmin()->getUsedSize()) - ("y.size = %d too small: admin->sizeUsed = %d\n", - y.getSize(), a.getRowFESpace()->getAdmin()->getUsedSize()); - TEST_EXIT_DBG(static_cast<int>( a.getSize()) >= a.getRowFESpace()->getAdmin()->getUsedSize()) - ("a.size = %d too small: admin->sizeUsed = %d\n", - a.getSize(), a.getRowFESpace()->getAdmin()->getUsedSize()); - } - else if (transpose == Transpose) { - TEST_EXIT_DBG(static_cast<int>(x.getSize()) >= a.getRowFESpace()->getAdmin()->getUsedSize()) - ("x.size = %d too small: admin->sizeUsed = %d\n", - x.getSize(), a.getRowFESpace()->getAdmin()->getUsedSize()); - TEST_EXIT_DBG(static_cast<int>(y.getSize()) >= a.getColFESpace()->getAdmin()->getUsedSize()) - ("y.size = %d too small: admin->sizeUsed = %d\n", - y.getSize(), a.getColFESpace()->getAdmin()->getUsedSize()); - TEST_EXIT_DBG(static_cast<int>( a.getSize()) >= a.getRowFESpace()->getAdmin()->getUsedSize()) - ("a.size = %d too small: admin->sizeUsed = %d\n", - a.getSize(), a.getRowFESpace()->getAdmin()->getUsedSize()); - } - - // Create MTL vector as wrapper of y - mtl::vector::dense_vector<double> yy(y.getSize(), &y[0]); - DOFMatrix::base_matrix_type& A= a.getBaseMatrix(); - - if (transpose == NoTranspose) - yy= alpha*A*x + beta*yy; - else if (transpose == Transpose) - yy= alpha*trans(A)*x + beta*yy; - else - ERROR_EXIT("transpose=%d\n", transpose); - - -#if 0 - - //ysize = y.getSize(); - - typename DOFVector<T>::Iterator vecIterator(dynamic_cast<DOFIndexed<T>*>(&y), FREE_DOFS); - 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) { - sum = 0; - row = &(a[rowIterator.getDOFIndex()]); - 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]; - } else { - if (jcol == DOFMatrix::NO_MORE_ENTRIES) - break; - } - } - *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) { - *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) { - ax = alpha * (*xIterator); - row = &(a[rowIterator.getDOFIndex()]); - for (std::vector<MatEntry>::iterator colIterator = rowIterator->begin(); - colIterator != rowIterator->end(); - colIterator++) { - jcol = colIterator->col; - if (jcol >= 0) // entry used? - y[jcol] += ax * (static_cast<T>(colIterator->entry)); - else - if (jcol == DOFMatrix::NO_MORE_ENTRIES) break; - } - } - } - else { - ERROR_EXIT("transpose=%d\n", transpose); - } -#endif - - } - template<typename T> void DOFVector<T>::print() const { @@ -1271,7 +1145,6 @@ namespace AMDiS { return 1; } - template <typename T> inline void set_to_zero(AMDiS::DOFVector<T>& v) { diff --git a/AMDiS/src/DuneSolver.cc b/AMDiS/src/DuneSolver.cc deleted file mode 100644 index 654a8ec6..00000000 --- a/AMDiS/src/DuneSolver.cc +++ /dev/null @@ -1,156 +0,0 @@ -#ifdef HAVE_DUNE - -#define DUNE_MINIMAL_DEBUG_LEVEL 4 - -#include <dune/common/fmatrix.hh> -#include <dune/istl/bvector.hh> -#include <dune/istl/bcrsmatrix.hh> -#include <dune/istl/ilu.hh> -#include <dune/istl/operators.hh> -#include <dune/istl/solvers.hh> -#include <dune/istl/preconditioners.hh> -#include <dune/istl/matrix.hh> - -#include "DuneSolver.h" -#include "DOFVector.h" - -namespace AMDiS { - - template<> - int DuneSolver< DOFVector<double> >::solveSystem(MatVecMultiplier< DOFVector<double> > *mv, - DOFVector<double> *x, - DOFVector<double> *b) - { - FUNCNAME("DuneSolver::solveSystem()"); - - TEST_EXIT(x->getSize() == b->getSize())("Vectors x and b must have the same size!"); - - StandardMatVec<DOFMatrix, DOFVector<double> > *stdMatVec = - dynamic_cast<StandardMatVec<DOFMatrix, DOFVector<double> > *>(mv); - - DOFMatrix *m = stdMatVec->getMatrix(); - int nRows = m->getFESpace()->getAdmin()->getUsedSize(); - - DuneMatrix duneMatrix(nRows, nRows, DuneMatrix::random); - DuneVector duneVecX(nRows); - DuneVector duneVecB(nRows); - - mapDOFMatrix(m, &duneMatrix); - mapDOFVector(x, &duneVecX); - mapDOFVector(b, &duneVecB); - - MSG("solving system with DUNE ...\n"); - - Dune::MatrixAdapter<DuneMatrix, DuneVector, DuneVector> op(duneMatrix); - Dune::InverseOperatorResult opRes; - Dune::Preconditioner<DuneVector, DuneVector> *dunePreconditioner = - getPreconditioner<DuneMatrix, DuneVector>(&duneMatrix); - Dune::InverseOperator<DuneVector, DuneVector> *duneSolver = - getSolver<DuneMatrix, DuneVector>(&op, dunePreconditioner); - - duneSolver->apply(duneVecX, duneVecB, opRes); - - DuneVector::Iterator duneVecIt; - DOFVector<double>::Iterator vecXIter(x, USED_DOFS); - for (vecXIter.reset(), duneVecIt = duneVecX.begin(); - !vecXIter.end(); - ++vecXIter, ++duneVecIt) { - *vecXIter = *duneVecIt; - } - - delete dunePreconditioner; - delete duneSolver; - - return opRes.iterations; - } - - - template<> - int DuneSolver<SystemVector>::solveSystem(MatVecMultiplier<SystemVector> *mv, - SystemVector *x, SystemVector *b) - { - FUNCNAME("DuneSolver::solveSystem()"); - - // Calculate residual reduction which should be achieved by the dune solver. - *p = *x; - *p *= -1.0; - mv->matVec(NoTranspose, *p, *r); - *r += *b; - double reduction = this->tolerance / norm(r); - - typedef Dune::Matrix<DuneMatrix> SystemDuneMatrix; - typedef Dune::BlockVector<DuneVector> SystemDuneVector; - - TEST_EXIT(x->getSize() == b->getSize())("Vectors x and b must have the same size!"); - - StandardMatVec<Matrix<DOFMatrix*>, SystemVector> *stdMatVec = - dynamic_cast<StandardMatVec<Matrix<DOFMatrix*>, SystemVector> *>(mv); - Matrix<DOFMatrix*> *m = stdMatVec->getMatrix(); - - // Number of systems. - int nComponents = m->getSize(); - // Size of one DOF matrix. - int oneMatrixSize = ((*m)[0][0])->getFESpace()->getAdmin()->getUsedSize(); - - SystemDuneMatrix duneMatrix(nComponents, nComponents); - SystemDuneVector duneVecX(nComponents); - SystemDuneVector duneVecB(nComponents); - - for (int i = 0; i < nComponents; i++) { - for (int j = 0; j < nComponents; j++) { - if ((*m)[i][j]) { - duneMatrix[i][j].setSize(oneMatrixSize, oneMatrixSize); - duneMatrix[i][j].setBuildMode(DuneMatrix::random); - - mapDOFMatrix((*m)[i][j], &duneMatrix[i][j]); - } else { - duneMatrix[i][j].setSize(0, 0); - } - } - - duneVecX[i].resize(oneMatrixSize, false); - mapDOFVector(x->getDOFVector(i), &duneVecX[i]); - - duneVecB[i].resize(oneMatrixSize, false); - mapDOFVector(b->getDOFVector(i), &duneVecB[i]); - } - - MSG("solving system with DUNE ...\n"); - - Dune::MatrixAdapter<SystemDuneMatrix, SystemDuneVector, SystemDuneVector> op(duneMatrix); - Dune::InverseOperatorResult opRes; - Dune::Preconditioner<SystemDuneVector, SystemDuneVector> *dunePreconditioner = - getSystemPreconditioner<SystemDuneMatrix, SystemDuneVector>(&duneMatrix); - Dune::InverseOperator<SystemDuneVector, SystemDuneVector> *duneSolver = - getSolver<SystemDuneMatrix, SystemDuneVector>(&op, dunePreconditioner); - - duneSolver->apply(duneVecX, duneVecB, reduction, opRes); - - for (int i = 0; i < nComponents; i++) { - DuneVector::Iterator duneVecIt; - DOFVector<double>::Iterator vecXIter(x->getDOFVector(i), USED_DOFS); - for (vecXIter.reset(), duneVecIt = duneVecX[i].begin(); - !vecXIter.end(); - ++vecXIter, ++duneVecIt) { - *vecXIter = *duneVecIt; - } - } - - // Calculate and print the residual. - *p = *x; - *p *= -1.0; - mv->matVec(NoTranspose, *p, *r); - *r += *b; - - this->residual = norm(r); - - MSG("Residual: %e\n", this->residual); - - delete dunePreconditioner; - delete duneSolver; - - return opRes.iterations; - } -} - -#endif // HAVE_DUNE diff --git a/AMDiS/src/DuneSolver.h b/AMDiS/src/DuneSolver.h deleted file mode 100644 index d39f7961..00000000 --- a/AMDiS/src/DuneSolver.h +++ /dev/null @@ -1,192 +0,0 @@ -// ============================================================================ -// == == -// == AMDiS - Adaptive multidimensional simulations == -// == == -// ============================================================================ -// == == -// == crystal growth group == -// == == -// == Stiftung caesar == -// == Ludwig-Erhard-Allee 2 == -// == 53175 Bonn == -// == germany == -// == == -// ============================================================================ -// == == -// == http://www.caesar.de/cg/AMDiS == -// == == -// ============================================================================ - -/** \file DuneSolver.h */ - -#ifndef AMDIS_DUNESOLVER_H -#define AMDIS_DUNESOLVER_H - -#ifdef HAVE_DUNE - -#define DUNE_MINIMAL_DEBUG_LEVEL 4 - -#include <dune/common/fmatrix.hh> -#include <dune/istl/bvector.hh> -#include <dune/istl/bcrsmatrix.hh> - -#include <dune/istl/bvector.hh> -#include <dune/istl/bcrsmatrix.hh> -#include <dune/istl/ilu.hh> -#include <dune/istl/operators.hh> -#include <dune/istl/solvers.hh> -#include <dune/istl/preconditioners.hh> -#include <dune/istl/matrix.hh> - -#include "DOFVector.h" -#include "OEMSolver.h" -#include "MemoryManager.h" - -namespace AMDiS { - // ============================================================================ - // ===== class DuneSolver ===================================================== - // ============================================================================ - - typedef Dune::BCRSMatrix< Dune::FieldMatrix<double, 1, 1> > DuneMatrix; - typedef Dune::BlockVector< Dune::FieldVector<double, 1> > DuneVector; - - /** - * \ingroup Solver - * - * \brief - * Uses ISTL-module from the DUNE project (www.dune-project.com) to solve a - * linear system of equations. - */ - template<typename VectorType> - class DuneSolver : public OEMSolver<VectorType> - { - public: - MEMORY_MANAGED(DuneSolver<VectorType>); - - /** \brief - * Creator class used in the OEMSolverMap. - */ - class Creator : public OEMSolverCreator<VectorType> - { - public: - MEMORY_MANAGED(Creator); - - virtual ~Creator() {}; - - /** \brief - * Returns a new DuneSolver object. - */ - OEMSolver<VectorType>* create() { - return NEW DuneSolver<VectorType>(this->name); - }; - }; - - /** \brief - * constructor - */ - DuneSolver(std::string name); - - /** \brief - * destructor - */ - ~DuneSolver(); - - protected: - /** \brief - * DUNE's solver verbose mode: - * 0 : print nothing - * 1 : print initial and final defect and statistics - * 2 : print line for each iteration - */ - int verbose_; - - /** \brief - * DUNE's solver to be used. - */ - std::string solverType_; - - /** \brief - * DUNE's preconditioner to be used. - */ - std::string preconType_; - - /** \brief - * Relaxation factor for the preconditioner. - */ - double preconRelaxation_; - - /** \brief - * Number of iterations for the preconditioner. - */ - int preconIterations_; - - /** \brief - * Implements OEMSolver<VectorType>::init(). - */ - void init() - { - p = this->vectorCreator->create(); - r = this->vectorCreator->create(); - }; - - /** \brief - * Implements OEMSolver<VectorType>::exit(). - */ - void exit() - { - this->vectorCreator->free(p); - this->vectorCreator->free(r); - }; - - /** \brief - * Creates a dune preconditioner using the informations in the used init file. - */ - template<typename M, typename V> - Dune::Preconditioner<V, V>* getPreconditioner(M *matrix); - - - /** \brief - * Creates a dune preconditioner for systems of equations using the informations - * in the used init file. - */ - template<typename M, typename V> - Dune::Preconditioner<V, V>* getSystemPreconditioner(M *matrix); - - - /** \brief - * Creates a dune solver using the informations in the used init file. - */ - template<typename M, typename V> - Dune::InverseOperator<V, V>* getSolver(Dune::MatrixAdapter<M, V, V>* ma, - Dune::Preconditioner<V, V>* precon); - - /** \brief - * Implements OEMSolver<VectorType>::solve(). - */ - int solveSystem(MatVecMultiplier<VectorType> *mv, VectorType *x, VectorType *b); - - /** \brief - * Copies the data of one DOFMatrix to one DuneMatrix. The DuneMatrix has - * to be allocated before. - */ - void mapDOFMatrix(DOFMatrix *dofMatrix, DuneMatrix *duneMatrix); - - /** \brief - * Copies the data of one DOFVector to one DuneVector. The DuneVector has - * to be allocated before. - */ - void mapDOFVector(DOFVector<double> *dofVector, DuneVector *duneVector); - - private: - /** \brief - * These vectors are justed to calculate the final residual of the solution. - */ - VectorType *r, *p; - }; -} - -#include "DuneSolver.hh" - -#endif // HAVE_DUNE - -#endif // AMDIS_DUNESOLVER_H diff --git a/AMDiS/src/DuneSolver.hh b/AMDiS/src/DuneSolver.hh deleted file mode 100644 index 147491a8..00000000 --- a/AMDiS/src/DuneSolver.hh +++ /dev/null @@ -1,148 +0,0 @@ -#include "DOFVector.h" - -#include <dune/istl/bvector.hh> -#include <dune/istl/bcrsmatrix.hh> -#include <dune/istl/ilu.hh> -#include <dune/istl/operators.hh> -#include <dune/istl/solvers.hh> -#include <dune/istl/preconditioners.hh> -#include <dune/istl/matrix.hh> - -namespace AMDiS { - - template<typename VectorType> - DuneSolver<VectorType>::DuneSolver(std::string name) - : OEMSolver<VectorType>(name), - verbose_(1), - solverType_(""), - preconType_(""), - preconRelaxation_(1.0), - preconIterations_(1) - { - GET_PARAMETER(0, name + "->dune verbose", "%d", &verbose_); - GET_PARAMETER(0, name + "->dune solver", &solverType_); - GET_PARAMETER(0, name + "->dune precon", &preconType_); - - GET_PARAMETER(0, name + "->dune precon->relaxation", "%f", &preconRelaxation_); - GET_PARAMETER(0, name + "->dune precon->iterations", "%d", &preconIterations_); - - TEST_EXIT(solverType_ != "")("No DUNE solver chosen!\n"); - TEST_EXIT(preconType_ != "")("No DUNE preconditioner chosen!\n"); - } - - - template<typename VectorType> - DuneSolver<VectorType>::~DuneSolver() - {} - - - template<typename VectorType> - template<typename M, typename V> - Dune::Preconditioner<V, V>* DuneSolver<VectorType>::getPreconditioner(M *matrix) - { - if (preconType_ == "ilu0") { - return new Dune::SeqILU0<M, V, V>(*matrix, preconRelaxation_); - } else if (preconType_ == "ilun") { - return new Dune::SeqILUn<M, V, V>(*matrix, preconIterations_, preconRelaxation_); - } else if (preconType_ == "jac") { - return new Dune::SeqJac<M, V, V>(*matrix, preconIterations_, preconRelaxation_); - } else if (preconType_ == "gs") { - return new Dune::SeqGS<M, V, V>(*matrix, preconIterations_, preconRelaxation_); - } else if (preconType_ == "sor") { - return new Dune::SeqSOR<M, V, V>(*matrix, preconIterations_, preconRelaxation_); - } else if (preconType_ == "ssor") { - return new Dune::SeqSSOR<M, V, V>(*matrix, preconIterations_, preconRelaxation_); - }; - - ERROR_EXIT("Wrong DUNE preconditioner type!\n"); - - return NULL; - } - - - template<typename VectorType> - template<typename M, typename V> - Dune::Preconditioner<V, V>* DuneSolver<VectorType>::getSystemPreconditioner(M *matrix) - { - if (preconType_ == "ilu0") { - ERROR_EXIT("ILU0 is not supported for systems!\n"); - } else if (preconType_ == "ilun") { - ERROR_EXIT("ILUN is not supported for systems!\n"); - } else if (preconType_ == "jac") { - return new Dune::SeqJac<M, V, V, 2>(*matrix, preconIterations_, preconRelaxation_); - } else if (preconType_ == "gs") { - return new Dune::SeqGS<M, V, V, 2>(*matrix, preconIterations_, preconRelaxation_); - } else if (preconType_ == "sor") { - return new Dune::SeqSOR<M, V, V, 2>(*matrix, preconIterations_, preconRelaxation_); - } else if (preconType_ == "ssor") { - return new Dune::SeqSSOR<M, V, V, 2>(*matrix, preconIterations_, preconRelaxation_); - }; - - ERROR_EXIT("Wrong DUNE preconditioner type!\n"); - - return NULL; - } - - - template<typename VectorType> - template<typename M, typename V> - Dune::InverseOperator<V, V>* DuneSolver<VectorType>::getSolver(Dune::MatrixAdapter<M, V, V>* ma, - Dune::Preconditioner<V, V>* precon) - { - if (solverType_ == "bicgstab") { - return new Dune::BiCGSTABSolver<V>(*ma, *precon, this->tolerance, this->max_iter, verbose_); - } else if (solverType_ == "cg") { - return new Dune::CGSolver<V>(*ma, *precon, this->tolerance, this->max_iter, verbose_); - } else if (solverType_ == "gradient") { - return new Dune::GradientSolver<V>(*ma, *precon, this->tolerance, this->max_iter, verbose_); - } else if (solverType_ == "loop") { - return new Dune::LoopSolver<V>(*ma, *precon, this->tolerance, this->max_iter, verbose_); - } - - ERROR_EXIT("Wrong DUNE solver type!\n"); - - return NULL; - } - - - template<typename VectorType> - void DuneSolver<VectorType>::mapDOFMatrix(DOFMatrix *dofMatrix, DuneMatrix *duneMatrix) - { - int rowIndex = 0; - DOFMatrix::Iterator matrixRowIt(dofMatrix, USED_DOFS); - for (matrixRowIt.reset(); !matrixRowIt.end(); ++matrixRowIt, rowIndex++) { - duneMatrix->setrowsize(rowIndex, (*matrixRowIt).size()); - } - - duneMatrix->endrowsizes(); - - rowIndex = 0; - for (matrixRowIt.reset(); !matrixRowIt.end(); ++matrixRowIt, rowIndex++) { - int nCols = static_cast<int>((*matrixRowIt).size()); - for (int i = 0; i < nCols; i++) { - duneMatrix->addindex(rowIndex, (*matrixRowIt)[i].col); - } - } - - duneMatrix->endindices(); - - DuneMatrix::Iterator duneMatIt = duneMatrix->begin(); - for (matrixRowIt.reset(); !matrixRowIt.end(); ++matrixRowIt, ++duneMatIt) { - int nCols = static_cast<int>((*matrixRowIt).size()); - for (int i = 0; i < nCols; i++) { - (*duneMatIt)[(*matrixRowIt)[i].col] = (*matrixRowIt)[i].entry; - } - } - - } - - template<typename VectorType> - void DuneSolver<VectorType>::mapDOFVector(DOFVector<double> *dofVector, DuneVector *duneVector) - { - DuneVector::Iterator duneVecIt = duneVector->begin(); - DOFVector<double>::Iterator dofVecIt(dofVector, USED_DOFS); - for (dofVecIt.reset(); !dofVecIt.end(); ++dofVecIt, ++duneVecIt) { - *duneVecIt = *dofVecIt; - } - } -} diff --git a/AMDiS/src/GSSmoother.cc b/AMDiS/src/GSSmoother.cc deleted file mode 100755 index 2f26b126..00000000 --- a/AMDiS/src/GSSmoother.cc +++ /dev/null @@ -1,155 +0,0 @@ -#include "GSSmoother.h" -#include "DOFMatrix.h" -#include "DOFVector.h" -#include "SparseVector.h" -#include "MatrixVector.h" - -namespace AMDiS { - - template<> - void GSSmoother<DOFMatrix, - SparseVector<double>, - std::set<DegreeOfFreedom> >:: - smooth(DOFMatrix *matrix, - SparseVector<double> *solution, - SparseVector<double> *rhs, - int iterations, - const std::set<DegreeOfFreedom> &dofSet) - { - ERROR_EXIT("Will be rewritten - Peter\n"); - -#if 0 - int i, j, rowNumber, colNumber, numCols; - - double entry, diagEntry = 0.0; - double oldSolution; - - std::set<DegreeOfFreedom>::iterator dofIt, - dofEnd = const_cast< std::set<DegreeOfFreedom>&>(dofSet).end(); - - for(i = 0; i < iterations; i++) { - for(dofIt = const_cast< std::set<DegreeOfFreedom>&>(dofSet).begin(); - dofIt != dofEnd; - ++dofIt) - { - rowNumber = *dofIt; - const std::vector<MatEntry>& row = matrix->getRow(rowNumber); - numCols = static_cast<int>(row.size()); - - oldSolution = (*solution)[rowNumber]; - - (*solution)[rowNumber] = (*rhs)[rowNumber]; - - for(j = 0; j < numCols; j++) { - colNumber = row[j].col; - if(colNumber == DOFMatrix::NO_MORE_ENTRIES) break; - if(colNumber == DOFMatrix::UNUSED_ENTRY) continue; - entry = row[j].entry; - if(colNumber == rowNumber) { - diagEntry = entry; - } else { - (*solution)[rowNumber] -= entry * (*solution)[colNumber]; - } - } - (*solution)[rowNumber] *= omega_ / diagEntry; - (*solution)[rowNumber] += (1.0 - omega_) * oldSolution; - } - } - - // dofEnd = const_cast< std::set<DegreeOfFreedom>&>(dofSet).begin(); - - // for(i = 0; i < iterations; i++) { - // for(dofIt = const_cast< std::set<DegreeOfFreedom>&>(dofSet).end(); - // dofIt != dofEnd; - // --dofIt) - // { - // rowNumber = *dofIt; - // const std::vector<MatEntry>& row = matrix->getRow(rowNumber); - // numCols = static_cast<int>(row.size()); - - // oldSolution = (*solution)[rowNumber]; - - // (*solution)[rowNumber] = (*rhs)[rowNumber]; - - // for(j = 0; j < numCols; j++) { - // colNumber = row[j].col; - // if(colNumber == DOFMatrix::NO_MORE_ENTRIES) break; - // if(colNumber == DOFMatrix::UNUSED_ENTRY) continue; - // entry = row[j].entry; - // if(colNumber == rowNumber) { - // diagEntry = entry; - // } else { - // (*solution)[rowNumber] -= entry * (*solution)[colNumber]; - // } - // } - // (*solution)[rowNumber] *= omega_ / diagEntry; - // (*solution)[rowNumber] += (1.0 - omega_) * oldSolution; - // } - // } -#endif - } - - template<> - void GSSmoother<Matrix<DOFMatrix*>, - Vector<SparseVector<double>*>, - Vector< std::set<DegreeOfFreedom>*> >:: - smooth(Matrix<DOFMatrix*> *m, - Vector<SparseVector<double>*> *s, - Vector<SparseVector<double>*> *r, - int iterations, - const Vector< std::set<DegreeOfFreedom>*> &dofSet) - { - ERROR_EXIT("Will be rewritten - Peter\n"); - -#if 0 - int numComponents = s->getSize(); - int i, j, k, l; - int rowNumber, colNumber, numCols; - - double entry, diagEntry = 0.0; - double oldSolution; - - DOFMatrix *matrix; - SparseVector<double> *rhs; - - std::set<DegreeOfFreedom>::iterator dofIt, dofEnd; - - for(i = 0; i < iterations; i++) { - for(j = 0; j < numComponents; j++) { - dofEnd = dofSet[j]->end(); - rhs = (*r)[j]; - - for(dofIt = dofSet[j]->begin(); dofIt != dofEnd; ++dofIt) { - rowNumber = *dofIt; - - oldSolution = (*(*s)[j])[rowNumber]; - (*(*s)[j])[rowNumber] = (*rhs)[rowNumber]; - - for(k = 0; k < numComponents; k++) { - matrix = (*m)[j][k]; - - if(matrix) { - const std::vector<MatEntry>& row = matrix->getRow(rowNumber); - numCols = static_cast<int>(row.size()); - - for(l = 0; l < numCols; l++) { - colNumber = row[l].col; - if(colNumber == DOFMatrix::NO_MORE_ENTRIES) break; - if(colNumber == DOFMatrix::UNUSED_ENTRY) continue; - entry = row[l].entry; - if(j == k && colNumber == rowNumber) { - diagEntry = entry; - } else { - (*(*s)[j])[rowNumber] -= entry * (*(*s)[k])[colNumber]; - } - } - } - } - (*(*s)[j])[rowNumber] *= omega_ / diagEntry; - (*(*s)[j])[rowNumber] += (1.0 - omega_) * oldSolution; - } - } - } -#endif - } -} diff --git a/AMDiS/src/GSSmoother.h b/AMDiS/src/GSSmoother.h deleted file mode 100755 index 20d4e7c5..00000000 --- a/AMDiS/src/GSSmoother.h +++ /dev/null @@ -1,66 +0,0 @@ -// ============================================================================ -// == == -// == AMDiS - Adaptive multidimensional simulations == -// == == -// ============================================================================ -// == == -// == crystal growth group == -// == == -// == Stiftung caesar == -// == Ludwig-Erhard-Allee 2 == -// == 53175 Bonn == -// == germany == -// == == -// ============================================================================ -// == == -// == http://www.caesar.de/cg/AMDiS == -// == == -// ============================================================================ - -/** \file SmootherBase.h */ - -#ifndef AMDIS_GSSMOOTHER_H -#define AMDIS_GSSMOOTHER_H - -#include "SmootherBase.h" -#include "MemoryManager.h" -#include "Parameters.h" - -namespace AMDiS { - - template<typename MatrixType, typename VectorType, typename DOFSetType> - class GSSmoother : public SmootherBase<MatrixType, VectorType, DOFSetType> - { - public: - MEMORY_MANAGED(GSSmoother<MatrixType COMMA VectorType COMMA DOFSetType>); - - class Creator : public SmootherCreator<MatrixType, VectorType, DOFSetType> - { - public: - MEMORY_MANAGED(Creator); - - SmootherBase<MatrixType, VectorType, DOFSetType> *create() { - return NEW GSSmoother<MatrixType, VectorType, DOFSetType>(this->name); - }; - }; - - GSSmoother(std::string name_) - : SmootherBase<MatrixType, VectorType, DOFSetType>(name_), - omega_(1.0) - { - GET_PARAMETER(0, name_ + "->omega", "%f", &omega_); - }; - - void smooth(MatrixType *matrix, - VectorType *solution, - VectorType *rhs, - int iterations, - const DOFSetType &dofSet); - - protected: - double omega_; - }; - -} - -#endif diff --git a/AMDiS/src/InterpolRestrictMatrix.cc b/AMDiS/src/InterpolRestrictMatrix.cc deleted file mode 100644 index e1f2de8a..00000000 --- a/AMDiS/src/InterpolRestrictMatrix.cc +++ /dev/null @@ -1,566 +0,0 @@ -#include "InterpolRestrictMatrix.h" -#include "FiniteElemSpace.h" -#include "DOFVector.h" -#include "Traverse.h" -#include "ElInfo.h" -#include "Mesh.h" -#include "BasisFunction.h" -#include "DOFAdmin.h" -#include "Element.h" -#include "SparseVector.h" -#include "ElementMatrix.h" -#include "DOFMatrix.h" -#include <set> - -namespace AMDiS { - - InterpolRestrictMatrix::InterpolRestrictMatrix(int numFcts, - int numRows, - int numCols, - bool type0Used) - : numFcts_(numFcts), - numRows_(numRows), - numCols_(numCols), - type0_used_(type0Used), - transposed_(false), - initialized_(false) - { - parentDOFs_ = GET_MEMORY(DegreeOfFreedom, numFcts_); - child0DOFs_ = GET_MEMORY(DegreeOfFreedom, numFcts_); - child1DOFs_ = GET_MEMORY(DegreeOfFreedom, numFcts_); - - rowDOFPtrs_ = GET_MEMORY(DegreeOfFreedom*, numRows_); - colDOFPtrs_ = GET_MEMORY(DegreeOfFreedom*, numCols_); - - type0_rowDOFPtrs_ = - type0_used_ ? GET_MEMORY(DegreeOfFreedom*, numRows_) : NULL; - type0_colDOFPtrs_ = - type0_used_ ? GET_MEMORY(DegreeOfFreedom*, numCols_) : NULL; - } - - - InterpolRestrictMatrix::InterpolRestrictMatrix(InterpolRestrictMatrix& matrix, - bool transposed) - : numFcts_(matrix.numFcts_), - numRows_(matrix.numCols_), - numCols_(matrix.numRows_), - parentDOFs_(matrix.parentDOFs_), - child0DOFs_(matrix.child0DOFs_), - child1DOFs_(matrix.child1DOFs_), - rowDOFPtrs_(matrix.colDOFPtrs_), - colDOFPtrs_(matrix.rowDOFPtrs_), - type0_used_(matrix.type0_used_), - type0_rowDOFPtrs_(matrix.type0_colDOFPtrs_), - type0_colDOFPtrs_(matrix.type0_rowDOFPtrs_), - transposed_(true), - initialized_(true) - { - FUNCNAME("InterpolRestrictMatrix : copy constructor"); - TEST_EXIT(transposed == true)("not yet for transposed == false\n"); - - if(!matrix.initialized_) { - matrix.initialized_ = true; - matrix.fillMemory(); - } - - // copy directCopyDOFs_ - std::vector<DegreeOfFreedom>::const_iterator copyIt; - std::vector<DegreeOfFreedom>::const_iterator copyBegin = - matrix.directCopyDOFs_.begin(); - std::vector<DegreeOfFreedom>::const_iterator copyEnd = - matrix.directCopyDOFs_.end(); - for(copyIt = copyBegin; copyIt != copyEnd; ++copyIt) { - directCopyDOFs_.push_back(*copyIt); - } - - // fill matrices - std::map<int, std::map<int, double> >::const_iterator rowsIt; - std::map<int, std::map<int, double> >::const_iterator rowsBegin; - std::map<int, std::map<int, double> >::const_iterator rowsEnd; - std::map<int, double>::const_iterator colIt; - std::map<int, double>::const_iterator colBegin; - std::map<int, double>::const_iterator colEnd; - - // unique row matrix - rowsBegin = matrix.uniqueColMatrix_.begin(); - rowsEnd = matrix.uniqueColMatrix_.end(); - for(rowsIt = rowsBegin; rowsIt != rowsEnd; ++rowsIt) { - int row = rowsIt->first; - colBegin = rowsIt->second.begin(); - colEnd = rowsIt->second.end(); - for(colIt = colBegin; colIt != colEnd; ++colIt) { - int col = colIt->first; - double entry = colIt->second; - uniqueRowMatrix_[col][row] = entry; - } - } - - // unique col matrix - rowsBegin = matrix.uniqueRowMatrix_.begin(); - rowsEnd = matrix.uniqueRowMatrix_.end(); - for(rowsIt = rowsBegin; rowsIt != rowsEnd; ++rowsIt) { - int row = rowsIt->first; - colBegin = rowsIt->second.begin(); - colEnd = rowsIt->second.end(); - for(colIt = colBegin; colIt != colEnd; ++colIt) { - int col = colIt->first; - double entry = colIt->second; - uniqueColMatrix_[col][row] = entry; - } - } - - // normal matrix - rowsBegin = matrix.matrix_.begin(); - rowsEnd = matrix.matrix_.end(); - for(rowsIt = rowsBegin; rowsIt != rowsEnd; ++rowsIt) { - int row = rowsIt->first; - colBegin = rowsIt->second.begin(); - colEnd = rowsIt->second.end(); - for(colIt = colBegin; colIt != colEnd; ++colIt) { - int col = colIt->first; - double entry = colIt->second; - matrix_[col][row] = entry; - } - } - } - - - InterpolRestrictMatrix::~InterpolRestrictMatrix() - { - if(!transposed_) { - FREE_MEMORY(parentDOFs_, DegreeOfFreedom, numFcts_); - FREE_MEMORY(child0DOFs_, DegreeOfFreedom, numFcts_); - FREE_MEMORY(child1DOFs_, DegreeOfFreedom, numFcts_); - - FREE_MEMORY(rowDOFPtrs_, DegreeOfFreedom*, numRows_); - FREE_MEMORY(colDOFPtrs_, DegreeOfFreedom*, numCols_); - - if(type0_used_) { - FREE_MEMORY(type0_rowDOFPtrs_, DegreeOfFreedom*, numRows_); - FREE_MEMORY(type0_colDOFPtrs_, DegreeOfFreedom*, numCols_); - } - } - } - - // Disabled for the moment - - void InterpolRestrictMatrix::mv(DOFVectorBase<double> *src, - DOFVectorBase<double> *dest, - int coarseLevel) - {ERROR_EXIT("Will be rewritten - Peter\n");} - - void InterpolRestrictMatrix::assembleDOFMatrix(DOFMatrix *dest, - int coarseLevel) - {ERROR_EXIT("Will be rewritten - Peter\n");} - - void InterpolRestrictMatrix::print() - {ERROR_EXIT("Will be rewritten - Peter\n");} - - -#if 0 - - - void InterpolRestrictMatrix::mv(DOFVectorBase<double> *src, - DOFVectorBase<double> *dest, - int coarseLevel) - { - FUNCNAME("InterpolRestrictMatrix::mv()"); - - if(!initialized_) { - initialized_ = true; - fillMemory(); - } - - TEST_EXIT_DBG(src)("src not set\n"); - TEST_EXIT_DBG(dest)("dest not set\n"); - TEST_EXIT_DBG(src->getFESpace() == dest->getFESpace())("invalid feSpaces\n"); - - const FiniteElemSpace *feSpace = src->getFESpace(); - - TEST_EXIT_DBG(feSpace->getBasisFcts()->getNumber() == numFcts_) - ("invalid number of basis functions\n"); - - // do matrix vector multiplication - DOFVector<int> visitedRowDOFs(feSpace, "visited row DOFs"); - DOFVector<int> visitedColDOFs(feSpace, "visited col DOFs"); - - const BasisFunction *basFcts = feSpace->getBasisFcts(); - DOFAdmin *admin = feSpace->getAdmin(); - - std::map<int, std::map<int, double> >::iterator rowsIt; - std::map<int, std::map<int, double> >::iterator rowsBegin; - std::map<int, std::map<int, double> >::iterator rowsEnd; - std::map<int, double>::iterator colIt; - std::map<int, double>::iterator colBegin; - std::map<int, double>::iterator colEnd; - std::vector<DegreeOfFreedom>::iterator dofIt; - std::vector<DegreeOfFreedom>::iterator dofBegin = directCopyDOFs_.begin(); - std::vector<DegreeOfFreedom>::iterator dofEnd = directCopyDOFs_.end(); - - // traverse mesh - TraverseStack stack; - ElInfo *elInfo = stack.traverseFirst(feSpace->getMesh(), -1, - Mesh::CALL_EVERY_EL_PREORDER); - while(elInfo) { - Element *element = elInfo->getElement(); - if(elInfo->getLevel() == coarseLevel && !element->isLeaf()) { - - DegreeOfFreedom **rowDOFPtrs; - DegreeOfFreedom **colDOFPtrs; - - if(type0_used_ && dynamic_cast<ElInfo3d*>(elInfo)->getType() == 0) { - rowDOFPtrs = type0_rowDOFPtrs_; - colDOFPtrs = type0_colDOFPtrs_; - } else { - rowDOFPtrs = rowDOFPtrs_; - colDOFPtrs = colDOFPtrs_; - } - - Element *child0 = element->getChild(0); - Element *child1 = element->getChild(1); - - basFcts->getLocalIndices(element, admin, parentDOFs_); - basFcts->getLocalIndices(child0, admin, child0DOFs_); - basFcts->getLocalIndices(child1, admin, child1DOFs_); - - // direct copy dofs from src to dest if necessary - if(src != dest) { - for(dofIt = dofBegin; dofIt != dofEnd; ++dofIt) { - DegreeOfFreedom rowDOF = *(rowDOFPtrs[*dofIt]); - if(visitedRowDOFs[rowDOF] == 0) { - DegreeOfFreedom colDOF = *(colDOFPtrs[*dofIt]); - (*dest)[rowDOF] = (*src)[colDOF]; - visitedRowDOFs[rowDOF] = 1; - } - } - } - - // treat unique rows - rowsBegin = uniqueRowMatrix_.begin(); - rowsEnd = uniqueRowMatrix_.end(); - for(rowsIt = rowsBegin; rowsIt != rowsEnd; ++rowsIt) { - int row = rowsIt->first; - DegreeOfFreedom rowDOF = *(rowDOFPtrs[row]); - if(visitedRowDOFs[rowDOF] == 0) { - visitedRowDOFs[rowDOF] = 1; - (*dest)[rowDOF] = 0.0; - colBegin = rowsIt->second.begin(); - colEnd = rowsIt->second.end(); - for(colIt = colBegin; colIt != colEnd; ++colIt) { - int col = colIt->first; - DegreeOfFreedom colDOF = *(colDOFPtrs[col]); - double entry = colIt->second; - (*dest)[rowDOF] += entry * (*src)[colDOF]; - } - } - } - - // treat unique cols - std::set<DegreeOfFreedom> elementColDOFs; - rowsBegin = uniqueColMatrix_.begin(); - rowsEnd = uniqueColMatrix_.end(); - for(rowsIt = rowsBegin; rowsIt != rowsEnd; ++rowsIt) { - int row = rowsIt->first; - DegreeOfFreedom rowDOF = *(rowDOFPtrs[row]); - colBegin = rowsIt->second.begin(); - colEnd = rowsIt->second.end(); - for(colIt = colBegin; colIt != colEnd; ++colIt) { - int col = colIt->first; - DegreeOfFreedom colDOF = *(colDOFPtrs[col]); - if(visitedColDOFs[colDOF] == 0) { - elementColDOFs.insert(colDOF); - double entry = colIt->second; - (*dest)[rowDOF] += entry * (*src)[colDOF]; - } - } - } - - std::set<DegreeOfFreedom>::iterator setIt; - std::set<DegreeOfFreedom>::iterator setBegin = elementColDOFs.begin(); - std::set<DegreeOfFreedom>::iterator setEnd = elementColDOFs.end(); - for(setIt = setBegin; setIt != setEnd; ++setIt) { - visitedColDOFs[*setIt] = 1; - } - - // treat other dofs - rowsBegin = matrix_.begin(); - rowsEnd = matrix_.end(); - for(rowsIt = rowsBegin; rowsIt != rowsEnd; ++rowsIt) { - int row = rowsIt->first; - DegreeOfFreedom rowDOF = *(rowDOFPtrs[row]); - colBegin = rowsIt->second.begin(); - colEnd = rowsIt->second.end(); - for(colIt = colBegin; colIt != colEnd; ++colIt) { - int col = colIt->first; - DegreeOfFreedom colDOF = *(colDOFPtrs[col]); - double entry = colIt->second; - (*dest)[rowDOF] += entry * (*src)[colDOF]; - } - } - } - elInfo = stack.traverseNext(elInfo); - } - } - - - void InterpolRestrictMatrix::assembleDOFMatrix(DOFMatrix *dest, - int coarseLevel) - { - FUNCNAME("InterpolRestrictMatrix::assembleDOFMatrix()"); - TEST_EXIT_DBG(dest)("dest not set\n"); - - if(!initialized_) { - initialized_ = true; - fillMemory(); - } - - dest->clear(); - - const FiniteElemSpace *feSpace = dest->getRowFESpace(); - - TEST_EXIT_DBG(feSpace->getBasisFcts()->getNumber() == numFcts_) - ("invalid number of basis functions\n"); - - DOFVector<int> visitedRowDOFs(feSpace, "visited row DOFs"); - DOFVector<int> visitedColDOFs(feSpace, "visited col DOFs"); - - const BasisFunction *basFcts = feSpace->getBasisFcts(); - DOFAdmin *admin = feSpace->getAdmin(); - - std::map<int, std::map<int, double> >::iterator rowsIt; - std::map<int, std::map<int, double> >::iterator rowsBegin; - std::map<int, std::map<int, double> >::iterator rowsEnd; - std::map<int, double>::iterator colIt; - std::map<int, double>::iterator colBegin; - std::map<int, double>::iterator colEnd; - std::vector<DegreeOfFreedom>::iterator dofIt; - std::vector<DegreeOfFreedom>::iterator dofBegin = directCopyDOFs_.begin(); - std::vector<DegreeOfFreedom>::iterator dofEnd = directCopyDOFs_.end(); - - ElementMatrix elementMatrix(numRows_, numCols_); - - int i; - TraverseStack stack; - ElInfo *elInfo = stack.traverseFirst(feSpace->getMesh(), -1, - Mesh::CALL_EVERY_EL_PREORDER); - - while (elInfo) { - Element *element = elInfo->getElement(); - if (!element->isLeaf()) { - if (elInfo->getLevel() == coarseLevel) { - - DegreeOfFreedom **rowDOFPtrs; - DegreeOfFreedom **colDOFPtrs; - - if (type0_used_ && dynamic_cast<ElInfo3d*>(elInfo)->getType() == 0) { - rowDOFPtrs = type0_rowDOFPtrs_; - colDOFPtrs = type0_colDOFPtrs_; - } else { - rowDOFPtrs = rowDOFPtrs_; - colDOFPtrs = colDOFPtrs_; - } - - Element *child0 = element->getChild(0); - Element *child1 = element->getChild(1); - - basFcts->getLocalIndices(element, admin, parentDOFs_); - basFcts->getLocalIndices(child0, admin, child0DOFs_); - basFcts->getLocalIndices(child1, admin, child1DOFs_); - - // init element matrix - elementMatrix.set(0.0); - elementMatrix.rowIndices.resize(numRows_); - for (i = 0; i < numRows_; i++) { - elementMatrix.rowIndices[i] = *(rowDOFPtrs[i]); - } - elementMatrix.colIndices.resize(numCols_); - for (i = 0; i < numCols_; i++) { - elementMatrix.colIndices[i] = *(colDOFPtrs[i]); - } - - // treat direct-copy dofs - for (dofIt = dofBegin; dofIt != dofEnd; ++dofIt) { - DegreeOfFreedom rowDOF = *(rowDOFPtrs[*dofIt]); - if (visitedRowDOFs[rowDOF] == 0) { - elementMatrix[*dofIt][*dofIt] = 1.0; - visitedRowDOFs[rowDOF] = 1; - } - } - - // treat unique rows - rowsBegin = uniqueRowMatrix_.begin(); - rowsEnd = uniqueRowMatrix_.end(); - for(rowsIt = rowsBegin; rowsIt != rowsEnd; ++rowsIt) { - int row = rowsIt->first; - DegreeOfFreedom rowDOF = *(rowDOFPtrs[row]); - if(visitedRowDOFs[rowDOF] == 0) { - visitedRowDOFs[rowDOF] = 1; - colBegin = rowsIt->second.begin(); - colEnd = rowsIt->second.end(); - for(colIt = colBegin; colIt != colEnd; ++colIt) { - int col = colIt->first; - double entry = colIt->second; - elementMatrix[row][col] += entry; - } - } - } - - // treat unique cols - std::set<DegreeOfFreedom> elementColDOFs; - rowsBegin = uniqueColMatrix_.begin(); - rowsEnd = uniqueColMatrix_.end(); - for(rowsIt = rowsBegin; rowsIt != rowsEnd; ++rowsIt) { - int row = rowsIt->first; - colBegin = rowsIt->second.begin(); - colEnd = rowsIt->second.end(); - for(colIt = colBegin; colIt != colEnd; ++colIt) { - int col = colIt->first; - DegreeOfFreedom colDOF = *(colDOFPtrs[col]); - if(visitedColDOFs[colDOF] == 0) { - elementColDOFs.insert(colDOF); - double entry = colIt->second; - elementMatrix[row][col] += entry; - } - } - } - - std::set<DegreeOfFreedom>::iterator setIt; - std::set<DegreeOfFreedom>::iterator setBegin = elementColDOFs.begin(); - std::set<DegreeOfFreedom>::iterator setEnd = elementColDOFs.end(); - for(setIt = setBegin; setIt != setEnd; ++setIt) { - visitedColDOFs[*setIt] = 1; - } - - // treat other dofs - rowsBegin = matrix_.begin(); - rowsEnd = matrix_.end(); - for(rowsIt = rowsBegin; rowsIt != rowsEnd; ++rowsIt) { - int row = rowsIt->first; - colBegin = rowsIt->second.begin(); - colEnd = rowsIt->second.end(); - for(colIt = colBegin; colIt != colEnd; ++colIt) { - int col = colIt->first; - double entry = colIt->second; - elementMatrix[row][col] += entry; - } - } - - dest->addElementMatrix(1.0, elementMatrix, NULL); - } - } - elInfo = stack.traverseNext(elInfo); - } - - // set matrix to identity for other dofs - DOFMatrix::Iterator destIt(dest, USED_DOFS); - for(destIt.reset(); !destIt.end(); ++destIt) { - if(destIt->size() == 0) { - MatEntry matEntry; - matEntry.col = destIt.getDOFIndex(); - matEntry.entry = 1.0; - destIt->push_back(matEntry); - } - } - } - - void InterpolRestrictMatrix::print() - { - FUNCNAME("InterpolRestrictMatrix::print()"); - - if(!initialized_) { - initialized_ = true; - fillMemory(); - } - - std::map<int, std::map<int, double> >::iterator rowsIt; - std::map<int, std::map<int, double> >::iterator rowsBegin; - std::map<int, std::map<int, double> >::iterator rowsEnd; - std::map<int, double>::iterator colIt; - std::map<int, double>::iterator colBegin; - std::map<int, double>::iterator colEnd; - std::vector<DegreeOfFreedom>::iterator dofIt; - std::vector<DegreeOfFreedom>::iterator dofBegin = directCopyDOFs_.begin(); - std::vector<DegreeOfFreedom>::iterator dofEnd = directCopyDOFs_.end(); - - - // treat direct-copy dofs - MSG("direct copy dofs:\n"); - for(dofIt = dofBegin; dofIt != dofEnd; ++dofIt) { - MSG("%d\n", *dofIt); - } - - // treat unique rows - MSG("unique row matrix:\n"); - rowsBegin = uniqueRowMatrix_.begin(); - rowsEnd = uniqueRowMatrix_.end(); - for(rowsIt = rowsBegin; rowsIt != rowsEnd; ++rowsIt) { - int row = rowsIt->first; - colBegin = rowsIt->second.begin(); - colEnd = rowsIt->second.end(); - for(colIt = colBegin; colIt != colEnd; ++colIt) { - int col = colIt->first; - double entry = colIt->second; - MSG("uniqueRow[%d][%d] = %e\n", row, col, entry); - } - } - - // treat unique cols - MSG("unique col matrix:\n"); - rowsBegin = uniqueColMatrix_.begin(); - rowsEnd = uniqueColMatrix_.end(); - for(rowsIt = rowsBegin; rowsIt != rowsEnd; ++rowsIt) { - int row = rowsIt->first; - colBegin = rowsIt->second.begin(); - colEnd = rowsIt->second.end(); - for(colIt = colBegin; colIt != colEnd; ++colIt) { - int col = colIt->first; - double entry = colIt->second; - MSG("uniqueCol[%d][%d] = %e\n", row, col, entry); - } - } - - // treat other dofs - MSG("matrix:\n"); - rowsBegin = matrix_.begin(); - rowsEnd = matrix_.end(); - for(rowsIt = rowsBegin; rowsIt != rowsEnd; ++rowsIt) { - int row = rowsIt->first; - colBegin = rowsIt->second.begin(); - colEnd = rowsIt->second.end(); - for(colIt = colBegin; colIt != colEnd; ++colIt) { - int col = colIt->first; - double entry = colIt->second; - MSG("matrix[%d][%d] = %e\n", row, col, entry); - } - } - - // print row dof ptrs - MSG("row DOF ptrs:\n"); - int i; - for(i = 0; i < numRows_; i++) { - MSG("row %d : %p\n", i, rowDOFPtrs_[i]); - } - - // print col dof ptrs - MSG("col DOF ptrs:\n"); - for(i = 0; i < numCols_; i++) { - MSG("col %d : %p\n", i, colDOFPtrs_[i]); - } - - // print row dof ptrs - if(type0_used_) { - MSG("type0 row DOF ptrs:\n"); - int i; - for(i = 0; i < numRows_; i++) { - MSG("row %d : %p\n", i, type0_rowDOFPtrs_[i]); - } - - // print col dof ptrs - MSG("type0 col DOF ptrs:\n"); - for(i = 0; i < numCols_; i++) { - MSG("col %d : %p\n", i, type0_colDOFPtrs_[i]); - } - } - } -#endif -} // namespace AMDiS diff --git a/AMDiS/src/InterpolRestrictMatrix.h b/AMDiS/src/InterpolRestrictMatrix.h deleted file mode 100644 index 3e7c84b2..00000000 --- a/AMDiS/src/InterpolRestrictMatrix.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef AMDIS_INTERPOLRESTRICTMATRIX_H -#define AMDIS_INTERPOLRESTRICTMATRIX_H - -#include <map> -#include <vector> -#include <string> - -#include "AMDiS_fwd.h" -#include "Global.h" -#include "MemoryManager.h" - -namespace AMDiS { - - /** \brief - * Defines the data structure for a general interpolation or restriction matrix. - * Both can be used to map vectors from a fine mesh to a coarser mesh and vice - * versa. - */ - class InterpolRestrictMatrix - { - public: - MEMORY_MANAGED(InterpolRestrictMatrix); - - InterpolRestrictMatrix(int numFcts, - int numRows, - int numCols, - bool type0Used); - - - /** \brief - * Creates transposed matrix. Uses memory of original matrix. - */ - InterpolRestrictMatrix(InterpolRestrictMatrix& matrix, - bool transposed); - - virtual ~InterpolRestrictMatrix(); - - /** \brief - * dest = matrix * src without assembling global matrix - */ - void mv(DOFVectorBase<double> *src, - DOFVectorBase<double> *dest, - int coarseLevel); - - void assembleDOFMatrix(DOFMatrix *dest, - int coarseLevel); - - void print(); - - protected: - virtual void fillMemory() {} - - protected: - int numFcts_; - int numRows_; - int numCols_; - - std::vector<DegreeOfFreedom> directCopyDOFs_; - - std::map<int, std::map<int, double> > uniqueRowMatrix_; - std::map<int, std::map<int, double> > uniqueColMatrix_; - std::map<int, std::map<int, double> > matrix_; - - DegreeOfFreedom *parentDOFs_; - DegreeOfFreedom *child0DOFs_; - DegreeOfFreedom *child1DOFs_; - - DegreeOfFreedom **rowDOFPtrs_; - DegreeOfFreedom **colDOFPtrs_; - - bool type0_used_; - - DegreeOfFreedom **type0_rowDOFPtrs_; - DegreeOfFreedom **type0_colDOFPtrs_; - - bool transposed_; - - bool initialized_; - }; -} - -#endif diff --git a/AMDiS/src/JacobiSmoother.cc b/AMDiS/src/JacobiSmoother.cc deleted file mode 100755 index 0aeed6a4..00000000 --- a/AMDiS/src/JacobiSmoother.cc +++ /dev/null @@ -1,125 +0,0 @@ -#include "JacobiSmoother.h" -#include "DOFMatrix.h" -#include "DOFVector.h" -#include "SparseVector.h" -#include "MatrixVector.h" - -namespace AMDiS { - - template<> - void JacobiSmoother<DOFMatrix, - SparseVector<double>, - std::set<DegreeOfFreedom> >:: - smooth(DOFMatrix *matrix, - SparseVector<double> *solution, - SparseVector<double> *rhs, - int iterations, - const std::set<DegreeOfFreedom> &dofSet) - { - ERROR_EXIT("Will be rewritten - Peter\n"); - -#if 0 - int i, j, rowNumber, colNumber, numCols; - - double entry, diagEntry = 0.0; - - SparseVector<double> oldSolution("old solution", solution); - - std::set<DegreeOfFreedom>::iterator dofIt, - dofEnd = const_cast< std::set<DegreeOfFreedom>&>(dofSet).end(); - - for(i = 0; i < iterations; i++) { - oldSolution.copy(*solution, dofSet); - for(dofIt = const_cast< std::set<DegreeOfFreedom>&>(dofSet).begin(); - dofIt != dofEnd; - ++dofIt) - { - rowNumber = *dofIt; - const std::vector<MatEntry>& row = matrix->getRow(rowNumber); - numCols = static_cast<int>(row.size()); - - (*solution)[rowNumber] = (*rhs)[rowNumber]; - - for(j = 0; j < numCols; j++) { - colNumber = row[j].col; - if(colNumber == DOFMatrix::NO_MORE_ENTRIES) break; - if(colNumber == DOFMatrix::UNUSED_ENTRY) continue; - entry = row[j].entry; - if(colNumber == rowNumber) { - diagEntry = entry; - } else { - (*solution)[rowNumber] -= entry * oldSolution[colNumber]; - } - } - (*solution)[rowNumber] *= omega_ / diagEntry; - (*solution)[rowNumber] += (1.0 - omega_) * oldSolution[rowNumber]; - } - } -#endif - } - - template<> - void JacobiSmoother<Matrix<DOFMatrix*>, - Vector<SparseVector<double>*>, - Vector< std::set<DegreeOfFreedom>*> >:: - smooth(Matrix<DOFMatrix*> *m, - Vector<SparseVector<double>*> *s, - Vector<SparseVector<double>*> *r, - int iterations, - const Vector< std::set<DegreeOfFreedom>*> &dofSet) - { - ERROR_EXIT("not yet (still gs)\n"); - -#if 0 - int numComponents = s->getSize(); - int i, j, k, l; - int rowNumber, colNumber, numCols; - - double entry, diagEntry = 0.0; - double oldSolution; - - DOFMatrix *matrix; - SparseVector<double> *rhs; - - std::set<DegreeOfFreedom>::iterator dofIt, dofEnd; - - for(i = 0; i < iterations; i++) { - for(j = 0; j < numComponents; j++) { - dofEnd = dofSet[j]->end(); - rhs = (*r)[j]; - - for(dofIt = dofSet[j]->begin(); dofIt != dofEnd; ++dofIt) { - rowNumber = *dofIt; - - oldSolution = (*(*s)[j])[rowNumber]; - (*(*s)[j])[rowNumber] = (*rhs)[rowNumber]; - - for(k = 0; k < numComponents; k++) { - matrix = (*m)[j][k]; - - if(matrix) { - const std::vector<MatEntry>& row = matrix->getRow(rowNumber); - numCols = static_cast<int>(row.size()); - - for(l = 0; l < numCols; l++) { - colNumber = row[l].col; - if(colNumber == DOFMatrix::NO_MORE_ENTRIES) break; - if(colNumber == DOFMatrix::UNUSED_ENTRY) continue; - entry = row[l].entry; - if(j == k && colNumber == rowNumber) { - diagEntry = entry; - } else { - (*(*s)[j])[rowNumber] -= entry * (*(*s)[k])[colNumber]; - } - } - } - } - (*(*s)[j])[rowNumber] *= omega_ / diagEntry; - (*(*s)[j])[rowNumber] += (1.0 - omega_) * oldSolution; - } - } - } -#endif - } - -} diff --git a/AMDiS/src/JacobiSmoother.h b/AMDiS/src/JacobiSmoother.h deleted file mode 100755 index 4c6c99de..00000000 --- a/AMDiS/src/JacobiSmoother.h +++ /dev/null @@ -1,66 +0,0 @@ -// ============================================================================ -// == == -// == AMDiS - Adaptive multidimensional simulations == -// == == -// ============================================================================ -// == == -// == crystal growth group == -// == == -// == Stiftung caesar == -// == Ludwig-Erhard-Allee 2 == -// == 53175 Bonn == -// == germany == -// == == -// ============================================================================ -// == == -// == http://www.caesar.de/cg/AMDiS == -// == == -// ============================================================================ - -/** \file SmootherBase.h */ - -#ifndef AMDIS_JACOBISMOOTHER_H -#define AMDIS_JACOBISMOOTHER_H - -#include "SmootherBase.h" -#include "MemoryManager.h" -#include "Parameters.h" - -namespace AMDiS { - - template<typename MatrixType, typename VectorType, typename DOFSetType> - class JacobiSmoother : public SmootherBase<MatrixType, VectorType, DOFSetType> - { - public: - MEMORY_MANAGED(JacobiSmoother<MatrixType COMMA VectorType COMMA DOFSetType>); - - class Creator : public SmootherCreator<MatrixType, VectorType, DOFSetType> - { - public: - MEMORY_MANAGED(Creator); - - SmootherBase<MatrixType, VectorType, DOFSetType> *create() { - return NEW JacobiSmoother<MatrixType, VectorType, DOFSetType>(this->name); - }; - }; - - JacobiSmoother(std::string name) - : SmootherBase<MatrixType, VectorType, DOFSetType>(name), - omega_(1.0) - { - GET_PARAMETER(0, name + "->omega", "%f", &omega_); - }; - - void smooth(MatrixType *matrix, - VectorType *solution, - VectorType *rhs, - int iterations, - const DOFSetType &dofSet); - - protected: - double omega_; - }; - -} - -#endif diff --git a/AMDiS/src/LagrangeInterpolRestrict.h b/AMDiS/src/LagrangeInterpolRestrict.h deleted file mode 100644 index fb85fba8..00000000 --- a/AMDiS/src/LagrangeInterpolRestrict.h +++ /dev/null @@ -1,1283 +0,0 @@ -#ifndef AMDIS_LAGRANGEINTERPOLRESTRICT_H -#define AMDIS_LAGRANGEINTERPOLRESTRICT_H - -#include "InterpolRestrictMatrix.h" - -namespace AMDiS { - - /** \brief - * Defines the interpolation and restriction matrix for 1d-elements - * and 1d-lagrange basis functions. - */ - class IM_1d_1 : public InterpolRestrictMatrix - { - public: - IM_1d_1() : - InterpolRestrictMatrix(2, 3, 2, false) - {} - - protected: - void fillMemory() - { - directCopyDOFs_.resize(2); - directCopyDOFs_[0] = 0; - directCopyDOFs_[1] = 1; - - uniqueRowMatrix_[2][0] = 0.5; - uniqueRowMatrix_[2][1] = 0.5; - - rowDOFPtrs_[0] = parentDOFs_ + 0; - rowDOFPtrs_[1] = parentDOFs_ + 1; - rowDOFPtrs_[2] = child0DOFs_ + 1; - - colDOFPtrs_[0] = parentDOFs_ + 0; - colDOFPtrs_[1] = parentDOFs_ + 1; - } - }; - - - /** \brief - * Defines the interpolation and restriction matrix for 1d-elements - * and 2d-lagrange basis functions. - */ - class IM_1d_2 : public InterpolRestrictMatrix - { - public: - IM_1d_2() : - InterpolRestrictMatrix(3, 5, 3, false) - {} - - protected: - void fillMemory() - { - directCopyDOFs_.push_back(0); - directCopyDOFs_.push_back(1); - - uniqueRowMatrix_[2][2] = 1.0; - - uniqueRowMatrix_[3][0] = 0.375; - uniqueRowMatrix_[3][1] = -0.125; - uniqueRowMatrix_[3][2] = 0.75; - - uniqueRowMatrix_[4][0] = -0.125; - uniqueRowMatrix_[4][1] = 0.375; - uniqueRowMatrix_[4][2] = 0.75; - - rowDOFPtrs_[0] = parentDOFs_ + 0; - rowDOFPtrs_[1] = parentDOFs_ + 1; - rowDOFPtrs_[2] = child0DOFs_ + 1; - rowDOFPtrs_[3] = child0DOFs_ + 2; - rowDOFPtrs_[4] = child1DOFs_ + 2; - - colDOFPtrs_[0] = parentDOFs_ + 0; - colDOFPtrs_[1] = parentDOFs_ + 1; - colDOFPtrs_[2] = parentDOFs_ + 2; - } - }; - - - /** \brief - * Defines the interpolation and restriction matrix for 1d-elements - * and 4d-lagrange basis functions. - */ - class IM_1d_4 : public InterpolRestrictMatrix - { - public: - IM_1d_4() : - InterpolRestrictMatrix(5, 9, 5, false) - {} - - protected: - void fillMemory() - { - directCopyDOFs_.resize(2); - directCopyDOFs_[0] = 0; - directCopyDOFs_[1] = 1; - - uniqueRowMatrix_[2][0] = 0.5; - uniqueRowMatrix_[2][1] = 0.5; - - rowDOFPtrs_[0] = parentDOFs_ + 0; - rowDOFPtrs_[1] = parentDOFs_ + 1; - rowDOFPtrs_[2] = child0DOFs_ + 1; - - colDOFPtrs_[0] = parentDOFs_ + 0; - colDOFPtrs_[1] = parentDOFs_ + 1; - } - }; - - - /** \brief - * Defines the interpolation and restriction matrix for 2d-elements - * and 1d-lagrange basis functions. - */ - class IM_2d_1 : public InterpolRestrictMatrix - { - public: - IM_2d_1() : - InterpolRestrictMatrix(3, 4, 3, false) - {} - - void fillMemory() - { - directCopyDOFs_.resize(3); - directCopyDOFs_[0] = 0; - directCopyDOFs_[1] = 1; - directCopyDOFs_[2] = 2; - - uniqueRowMatrix_[3][0] = 0.5; - uniqueRowMatrix_[3][1] = 0.5; - - rowDOFPtrs_[0] = parentDOFs_ + 0; - rowDOFPtrs_[1] = parentDOFs_ + 1; - rowDOFPtrs_[2] = parentDOFs_ + 2; - rowDOFPtrs_[3] = child0DOFs_ + 2; - - colDOFPtrs_[0] = parentDOFs_ + 0; - colDOFPtrs_[1] = parentDOFs_ + 1; - colDOFPtrs_[2] = parentDOFs_ + 2; - } - }; - - - /** \brief - * Defines the interpolation and restriction matrix for 2d-elements - * and 2d-lagrange basis functions. - */ - class IM_2d_2 : public InterpolRestrictMatrix - { - public: - IM_2d_2() : - InterpolRestrictMatrix(6, 9, 6, false) - {} - - void fillMemory() - { - directCopyDOFs_.push_back(0); - directCopyDOFs_.push_back(1); - directCopyDOFs_.push_back(2); - directCopyDOFs_.push_back(3); - directCopyDOFs_.push_back(4); - - uniqueRowMatrix_[5][5] = 1.0; - - uniqueRowMatrix_[6][0] = 0.375; - uniqueRowMatrix_[6][1] = -0.125; - uniqueRowMatrix_[6][5] = 0.75; - - uniqueRowMatrix_[7][0] = -0.125; - uniqueRowMatrix_[7][1] = -0.125; - uniqueRowMatrix_[7][3] = 0.5; - uniqueRowMatrix_[7][4] = 0.5; - uniqueRowMatrix_[7][5] = 0.25; - - uniqueRowMatrix_[8][0] = -0.125; - uniqueRowMatrix_[8][1] = 0.375; - uniqueRowMatrix_[8][5] = 0.75; - - rowDOFPtrs_[0] = parentDOFs_ + 0; - rowDOFPtrs_[1] = parentDOFs_ + 1; - rowDOFPtrs_[2] = parentDOFs_ + 2; - rowDOFPtrs_[3] = parentDOFs_ + 3; - rowDOFPtrs_[4] = parentDOFs_ + 4; - rowDOFPtrs_[5] = child0DOFs_ + 2; - rowDOFPtrs_[6] = child0DOFs_ + 3; - rowDOFPtrs_[7] = child0DOFs_ + 4; - rowDOFPtrs_[8] = child1DOFs_ + 4; - - colDOFPtrs_[0] = parentDOFs_ + 0; - colDOFPtrs_[1] = parentDOFs_ + 1; - colDOFPtrs_[2] = parentDOFs_ + 2; - colDOFPtrs_[3] = parentDOFs_ + 3; - colDOFPtrs_[4] = parentDOFs_ + 4; - colDOFPtrs_[5] = parentDOFs_ + 5; - } - }; - - - /** \brief - * Defines the interpolation and restriction matrix for 2d-elements - * and 3d-lagrange basis functions. - */ - class IM_2d_3 : public InterpolRestrictMatrix - { - public: - IM_2d_3() : - InterpolRestrictMatrix(10, 16, 10, false) - {} - - void fillMemory() - { - directCopyDOFs_.push_back(0); - directCopyDOFs_.push_back(1); - directCopyDOFs_.push_back(2); - directCopyDOFs_.push_back(3); - directCopyDOFs_.push_back(4); - directCopyDOFs_.push_back(5); - directCopyDOFs_.push_back(6); - - uniqueRowMatrix_[7][7] = 1.0; - uniqueRowMatrix_[8][8] = 1.0; - uniqueRowMatrix_[9][9] = 1.0; - - uniqueRowMatrix_[10][0] = -0.0625; - uniqueRowMatrix_[10][1] = -0.0625; - uniqueRowMatrix_[10][7] = 0.5625; - uniqueRowMatrix_[10][8] = 0.5625; - - uniqueRowMatrix_[11][0] = 0.3125; - uniqueRowMatrix_[11][1] = 0.0625; - uniqueRowMatrix_[11][7] = 0.9375; - uniqueRowMatrix_[11][8] = -0.3125; - - uniqueRowMatrix_[12][0] = 0.0625; - uniqueRowMatrix_[12][1] = 0.0625; - uniqueRowMatrix_[12][3] = -0.25; - uniqueRowMatrix_[12][4] = 0.5; - uniqueRowMatrix_[12][5] = 0.5; - uniqueRowMatrix_[12][6] = -0.25; - uniqueRowMatrix_[12][7] = -0.0625; - uniqueRowMatrix_[12][8] = -0.0625; - uniqueRowMatrix_[12][9] = 0.5; - - uniqueRowMatrix_[13][0] = -0.0625; - uniqueRowMatrix_[13][1] = 0.0625; - uniqueRowMatrix_[13][3] = -0.125; - uniqueRowMatrix_[13][6] = 0.375; - uniqueRowMatrix_[13][7] = 0.1875; - uniqueRowMatrix_[13][8] = -0.1875; - uniqueRowMatrix_[13][9] = 0.75; - - uniqueRowMatrix_[14][0] = 0.0625; - uniqueRowMatrix_[14][1] = 0.3125; - uniqueRowMatrix_[14][7] = -0.3125; - uniqueRowMatrix_[14][8] = 0.9375; - - uniqueRowMatrix_[15][0] = 0.0625; - uniqueRowMatrix_[15][1] = -0.0625; - uniqueRowMatrix_[15][3] = 0.375; - uniqueRowMatrix_[15][6] = -0.125; - uniqueRowMatrix_[15][7] = -0.1875; - uniqueRowMatrix_[15][8] = 0.1875; - uniqueRowMatrix_[15][9] = 0.75; - - rowDOFPtrs_[ 0] = parentDOFs_ + 0; - rowDOFPtrs_[ 1] = parentDOFs_ + 1; - rowDOFPtrs_[ 2] = parentDOFs_ + 2; - rowDOFPtrs_[ 3] = parentDOFs_ + 3; - rowDOFPtrs_[ 4] = parentDOFs_ + 4; - rowDOFPtrs_[ 5] = parentDOFs_ + 5; - rowDOFPtrs_[ 6] = parentDOFs_ + 6; - rowDOFPtrs_[ 7] = child0DOFs_ + 4; - rowDOFPtrs_[ 8] = child1DOFs_ + 5; - rowDOFPtrs_[ 9] = child0DOFs_ + 5; - rowDOFPtrs_[10] = child0DOFs_ + 2; - rowDOFPtrs_[11] = child0DOFs_ + 3; - rowDOFPtrs_[12] = child0DOFs_ + 6; - rowDOFPtrs_[13] = child0DOFs_ + 9; - rowDOFPtrs_[14] = child1DOFs_ + 6; - rowDOFPtrs_[15] = child1DOFs_ + 9; - - colDOFPtrs_[0] = parentDOFs_ + 0; - colDOFPtrs_[1] = parentDOFs_ + 1; - colDOFPtrs_[2] = parentDOFs_ + 2; - colDOFPtrs_[3] = parentDOFs_ + 3; - colDOFPtrs_[4] = parentDOFs_ + 4; - colDOFPtrs_[5] = parentDOFs_ + 5; - colDOFPtrs_[6] = parentDOFs_ + 6; - colDOFPtrs_[7] = parentDOFs_ + 7; - colDOFPtrs_[8] = parentDOFs_ + 8; - colDOFPtrs_[9] = parentDOFs_ + 9; - } - }; - - - /** \brief - * Defines the interpolation and restriction matrix for 2d-elements - * and 4d-lagrange basis functions. - */ - class IM_2d_4 : public InterpolRestrictMatrix - { - public: - IM_2d_4() : - InterpolRestrictMatrix(15, 25, 15, false) - {} - - void fillMemory() - { - directCopyDOFs_.push_back(0); - directCopyDOFs_.push_back(1); - directCopyDOFs_.push_back(2); - directCopyDOFs_.push_back(3); - directCopyDOFs_.push_back(4); - directCopyDOFs_.push_back(5); - directCopyDOFs_.push_back(6); - directCopyDOFs_.push_back(7); - directCopyDOFs_.push_back(8); - - uniqueRowMatrix_[ 9][ 9] = 1.0; - uniqueRowMatrix_[10][10] = 1.0; - uniqueRowMatrix_[11][11] = 1.0; - uniqueRowMatrix_[12][12] = 1.0; - uniqueRowMatrix_[13][13] = 1.0; - uniqueRowMatrix_[14][14] = 1.0; - - uniqueRowMatrix_[15][ 0] = 0.2734375; - uniqueRowMatrix_[15][ 1] = -0.0390625; - uniqueRowMatrix_[15][ 9] = 1.09375; - uniqueRowMatrix_[15][10] = -0.546875; - uniqueRowMatrix_[15][11] = 0.21875; - - uniqueRowMatrix_[16][ 0] = -0.0390625; - uniqueRowMatrix_[16][ 1] = 0.0234375; - uniqueRowMatrix_[16][ 9] = 0.46875; - uniqueRowMatrix_[16][10] = 0.703125; - uniqueRowMatrix_[16][11] = -0.15625; - - uniqueRowMatrix_[17][ 0] = 0.0234375; - uniqueRowMatrix_[17][ 1] = 0.0234375; - uniqueRowMatrix_[17][ 3] = -0.0625; - uniqueRowMatrix_[17][ 8] = -0.0625; - uniqueRowMatrix_[17][ 9] = -0.09375; - uniqueRowMatrix_[17][10] = 0.140625; - uniqueRowMatrix_[17][11] = -0.09375; - uniqueRowMatrix_[17][12] = 0.5625; - uniqueRowMatrix_[17][13] = 0.5625; - - uniqueRowMatrix_[18][ 0] = -0.0390625; - uniqueRowMatrix_[18][ 1] = -0.0390625; - uniqueRowMatrix_[18][ 3] = 0.1875; - uniqueRowMatrix_[18][ 4] = -0.375; - uniqueRowMatrix_[18][ 5] = 0.5; - uniqueRowMatrix_[18][ 6] = 0.5; - uniqueRowMatrix_[18][ 7] = -0.375; - uniqueRowMatrix_[18][ 8] = 0.1875; - uniqueRowMatrix_[18][ 9] = 0.03125; - uniqueRowMatrix_[18][10] = 0.015625; - uniqueRowMatrix_[18][11] = 0.03125; - uniqueRowMatrix_[18][12] = -0.1875; - uniqueRowMatrix_[18][13] = -0.1875; - uniqueRowMatrix_[18][14] = 0.75; - - uniqueRowMatrix_[19][ 0] = 0.0234375; - uniqueRowMatrix_[19][ 1] = -0.0390625; - uniqueRowMatrix_[19][ 3] = 0.125; - uniqueRowMatrix_[19][ 4] = -0.125; - uniqueRowMatrix_[19][ 7] = 0.375; - uniqueRowMatrix_[19][ 8] = -0.125; - uniqueRowMatrix_[19][ 9] = -0.03125; - uniqueRowMatrix_[19][10] = -0.046875; - uniqueRowMatrix_[19][11] = 0.09375; - uniqueRowMatrix_[19][12] = 0.375; - uniqueRowMatrix_[19][13] = -0.375; - uniqueRowMatrix_[19][14] = 0.75; - - uniqueRowMatrix_[20][ 0] = -0.0390625; - uniqueRowMatrix_[20][ 1] = -0.0390625; - uniqueRowMatrix_[20][ 3] = 0.0625; - uniqueRowMatrix_[20][ 8] = 0.3125; - uniqueRowMatrix_[20][13] = -0.3125; - uniqueRowMatrix_[20][ 9] = 0.15625; - uniqueRowMatrix_[20][11] = 0.15625; - uniqueRowMatrix_[20][10] = -0.234375; - uniqueRowMatrix_[20][12] = 0.9375; - - uniqueRowMatrix_[21][ 0] = 0.0234375; - uniqueRowMatrix_[21][ 1] = -0.0390625; - uniqueRowMatrix_[21][ 9] = -0.15625; - uniqueRowMatrix_[21][10] = 0.703125; - uniqueRowMatrix_[21][11] = 0.46875; - - uniqueRowMatrix_[22][ 0] = -0.0390625; - uniqueRowMatrix_[22][ 1] = 0.2734375; - uniqueRowMatrix_[22][ 9] = 0.21875; - uniqueRowMatrix_[22][10] = -0.546875; - uniqueRowMatrix_[22][11] = 1.09375; - - uniqueRowMatrix_[23][ 0] = -0.0390625; - uniqueRowMatrix_[23][ 1] = -0.0390625; - uniqueRowMatrix_[23][ 3] = 0.3125; - uniqueRowMatrix_[23][ 8] = 0.0625; - uniqueRowMatrix_[23][ 9] = 0.15625; - uniqueRowMatrix_[23][10] = -0.234375; - uniqueRowMatrix_[23][11] = 0.15625; - uniqueRowMatrix_[23][12] = -0.3125; - uniqueRowMatrix_[23][13] = 0.9375; - - uniqueRowMatrix_[24][ 0] = -0.0390625; - uniqueRowMatrix_[24][ 1] = 0.0234375; - uniqueRowMatrix_[24][ 3] = -0.125; - uniqueRowMatrix_[24][ 7] = -0.125; - uniqueRowMatrix_[24][ 8] = 0.125; - uniqueRowMatrix_[24][ 4] = 0.375; - uniqueRowMatrix_[24][12] = -0.375; - uniqueRowMatrix_[24][13] = 0.375; - uniqueRowMatrix_[24][ 9] = 0.09375; - uniqueRowMatrix_[24][10] = -0.046875; - uniqueRowMatrix_[24][11] = -0.03125; - uniqueRowMatrix_[24][14] = 0.75; - - rowDOFPtrs_[ 0] = parentDOFs_ + 0; - rowDOFPtrs_[ 1] = parentDOFs_ + 1; - rowDOFPtrs_[ 2] = parentDOFs_ + 2; - rowDOFPtrs_[ 3] = parentDOFs_ + 3; - rowDOFPtrs_[ 4] = parentDOFs_ + 4; - rowDOFPtrs_[ 5] = parentDOFs_ + 5; - rowDOFPtrs_[ 6] = parentDOFs_ + 6; - rowDOFPtrs_[ 7] = parentDOFs_ + 7; - rowDOFPtrs_[ 8] = parentDOFs_ + 8; - rowDOFPtrs_[ 9] = child0DOFs_ + 4; - rowDOFPtrs_[10] = child0DOFs_ + 2; - rowDOFPtrs_[11] = child1DOFs_ + 7; - rowDOFPtrs_[12] = child0DOFs_ + 14; - rowDOFPtrs_[13] = child1DOFs_ + 14; - rowDOFPtrs_[14] = child0DOFs_ + 7; - rowDOFPtrs_[15] = child0DOFs_ + 3; - rowDOFPtrs_[16] = child0DOFs_ + 5; - rowDOFPtrs_[17] = child0DOFs_ + 6; - rowDOFPtrs_[18] = child0DOFs_ + 8; - rowDOFPtrs_[19] = child0DOFs_ + 12; - rowDOFPtrs_[20] = child0DOFs_ + 13; - rowDOFPtrs_[21] = child1DOFs_ + 6; - rowDOFPtrs_[22] = child1DOFs_ + 8; - rowDOFPtrs_[23] = child1DOFs_ + 12; - rowDOFPtrs_[24] = child1DOFs_ + 13; - - colDOFPtrs_[ 0] = parentDOFs_ + 0; - colDOFPtrs_[ 1] = parentDOFs_ + 1; - colDOFPtrs_[ 2] = parentDOFs_ + 2; - colDOFPtrs_[ 3] = parentDOFs_ + 3; - colDOFPtrs_[ 4] = parentDOFs_ + 4; - colDOFPtrs_[ 5] = parentDOFs_ + 5; - colDOFPtrs_[ 6] = parentDOFs_ + 6; - colDOFPtrs_[ 7] = parentDOFs_ + 7; - colDOFPtrs_[ 8] = parentDOFs_ + 8; - colDOFPtrs_[ 9] = parentDOFs_ + 9; - colDOFPtrs_[10] = parentDOFs_ + 10; - colDOFPtrs_[11] = parentDOFs_ + 11; - colDOFPtrs_[12] = parentDOFs_ + 12; - colDOFPtrs_[13] = parentDOFs_ + 13; - colDOFPtrs_[14] = parentDOFs_ + 14; - } - }; - - - - /** \brief - * Defines the interpolation and restriction matrix for 3d-elements - * and 1d-lagrange basis functions. - */ - class IM_3d_1 : public InterpolRestrictMatrix - { - public: - IM_3d_1() : - InterpolRestrictMatrix(4, 5, 4, false) - {} - - void fillMemory() - { - directCopyDOFs_.resize(4); - directCopyDOFs_[0] = 0; - directCopyDOFs_[1] = 1; - directCopyDOFs_[2] = 2; - directCopyDOFs_[3] = 3; - - uniqueRowMatrix_[4][0] = 0.5; - uniqueRowMatrix_[4][1] = 0.5; - - rowDOFPtrs_[0] = parentDOFs_ + 0; - rowDOFPtrs_[1] = parentDOFs_ + 1; - rowDOFPtrs_[2] = parentDOFs_ + 2; - rowDOFPtrs_[3] = parentDOFs_ + 3; - rowDOFPtrs_[4] = child0DOFs_ + 3; - - colDOFPtrs_[0] = parentDOFs_ + 0; - colDOFPtrs_[1] = parentDOFs_ + 1; - colDOFPtrs_[2] = parentDOFs_ + 2; - colDOFPtrs_[3] = parentDOFs_ + 3; - } - }; - - - - /** \brief - * Defines the interpolation and restriction matrix for 3d-elements - * and 2d-lagrange basis functions. - */ - class IM_3d_2 : public InterpolRestrictMatrix - { - public: - IM_3d_2() : - InterpolRestrictMatrix(10, 14, 10, false) - {} - - void fillMemory() - { - directCopyDOFs_.push_back(0); - directCopyDOFs_.push_back(1); - directCopyDOFs_.push_back(2); - directCopyDOFs_.push_back(3); - directCopyDOFs_.push_back(5); - directCopyDOFs_.push_back(6); - directCopyDOFs_.push_back(7); - directCopyDOFs_.push_back(8); - directCopyDOFs_.push_back(9); - - uniqueRowMatrix_[4][4] = 1.0; - - uniqueRowMatrix_[10][0] = 0.375; - uniqueRowMatrix_[10][1] = -0.125; - uniqueRowMatrix_[10][4] = 0.75; - - uniqueRowMatrix_[11][0] = -0.125; - uniqueRowMatrix_[11][1] = -0.125; - uniqueRowMatrix_[11][4] = 0.25; - uniqueRowMatrix_[11][5] = 0.5; - uniqueRowMatrix_[11][7] = 0.5; - - uniqueRowMatrix_[12][0] = -0.125; - uniqueRowMatrix_[12][1] = -0.125; - uniqueRowMatrix_[12][4] = 0.25; - uniqueRowMatrix_[12][6] = 0.5; - uniqueRowMatrix_[12][8] = 0.5; - - uniqueRowMatrix_[13][0] = -0.125; - uniqueRowMatrix_[13][1] = 0.375; - uniqueRowMatrix_[13][4] = 0.75; - - - rowDOFPtrs_[0] = parentDOFs_ + 0; - rowDOFPtrs_[1] = parentDOFs_ + 1; - rowDOFPtrs_[2] = parentDOFs_ + 2; - rowDOFPtrs_[3] = parentDOFs_ + 3; - rowDOFPtrs_[4] = child0DOFs_ + 3; - rowDOFPtrs_[5] = parentDOFs_ + 5; - rowDOFPtrs_[6] = parentDOFs_ + 6; - rowDOFPtrs_[7] = parentDOFs_ + 7; - rowDOFPtrs_[8] = parentDOFs_ + 8; - rowDOFPtrs_[9] = parentDOFs_ + 9; - rowDOFPtrs_[10] = child0DOFs_ + 6; - rowDOFPtrs_[11] = child0DOFs_ + 8; - rowDOFPtrs_[12] = child0DOFs_ + 9; - rowDOFPtrs_[13] = child1DOFs_ + 6; - - colDOFPtrs_[0] = parentDOFs_ + 0; - colDOFPtrs_[1] = parentDOFs_ + 1; - colDOFPtrs_[2] = parentDOFs_ + 2; - colDOFPtrs_[3] = parentDOFs_ + 3; - colDOFPtrs_[4] = parentDOFs_ + 4; - colDOFPtrs_[5] = parentDOFs_ + 5; - colDOFPtrs_[6] = parentDOFs_ + 6; - colDOFPtrs_[7] = parentDOFs_ + 7; - colDOFPtrs_[8] = parentDOFs_ + 8; - colDOFPtrs_[9] = parentDOFs_ + 9; - } - }; - - - - /** \brief - * Defines the interpolation and restriction matrix for 3d-elements - * and 3d-lagrange basis functions. - */ - class IM_3d_3 : public InterpolRestrictMatrix - { - public: - IM_3d_3() : - InterpolRestrictMatrix(20, 30, 20, true) - {} - - void fillMemory() - { - directCopyDOFs_.push_back(0); - directCopyDOFs_.push_back(1); - directCopyDOFs_.push_back(2); - directCopyDOFs_.push_back(3); - directCopyDOFs_.push_back(6); - directCopyDOFs_.push_back(7); - directCopyDOFs_.push_back(8); - directCopyDOFs_.push_back(9); - directCopyDOFs_.push_back(10); - directCopyDOFs_.push_back(11); - directCopyDOFs_.push_back(12); - directCopyDOFs_.push_back(13); - directCopyDOFs_.push_back(14); - directCopyDOFs_.push_back(15); - directCopyDOFs_.push_back(16); - directCopyDOFs_.push_back(17); - - uniqueRowMatrix_[ 4][ 4] = 1.0; - uniqueRowMatrix_[ 5][ 5] = 1.0; - uniqueRowMatrix_[18][18] = 1.0; - uniqueRowMatrix_[19][19] = 1.0; - - uniqueRowMatrix_[20][ 0] = -0.0625; - uniqueRowMatrix_[20][ 1] = -0.0625; - uniqueRowMatrix_[20][ 4] = 0.5625; - uniqueRowMatrix_[20][ 5] = 0.5625; - - uniqueRowMatrix_[21][ 0] = 0.3125; - uniqueRowMatrix_[21][ 1] = 0.0625; - uniqueRowMatrix_[21][ 4] = 0.9375; - uniqueRowMatrix_[21][ 5] = -0.3125; - - uniqueRowMatrix_[22][ 0] = 0.0625; - uniqueRowMatrix_[22][ 1] = 0.0625; - uniqueRowMatrix_[22][ 4] = -0.0625; - uniqueRowMatrix_[22][ 5] = -0.0625; - uniqueRowMatrix_[22][ 6] = -0.25; - uniqueRowMatrix_[22][ 7] = 0.5; - uniqueRowMatrix_[22][10] = -0.25; - uniqueRowMatrix_[22][11] = 0.5; - uniqueRowMatrix_[22][19] = 0.5; - - uniqueRowMatrix_[23][ 0] = 0.0625; - uniqueRowMatrix_[23][ 1] = 0.0625; - uniqueRowMatrix_[23][ 4] = -0.0625; - uniqueRowMatrix_[23][ 5] = -0.0625; - uniqueRowMatrix_[23][ 8] = -0.25; - uniqueRowMatrix_[23][ 9] = 0.5; - uniqueRowMatrix_[23][12] = -0.25; - uniqueRowMatrix_[23][13] = 0.5; - uniqueRowMatrix_[23][18] = 0.5; - - uniqueRowMatrix_[24][ 0] = 0.0625; - uniqueRowMatrix_[24][ 1] = 0.0625; - uniqueRowMatrix_[24][ 4] = -0.0625; - uniqueRowMatrix_[24][ 5] = -0.0625; - uniqueRowMatrix_[24][ 6] = -0.125; - uniqueRowMatrix_[24][ 8] = -0.125; - uniqueRowMatrix_[24][10] = -0.125; - uniqueRowMatrix_[24][12] = -0.125; - uniqueRowMatrix_[24][16] = 0.5; - uniqueRowMatrix_[24][17] = 0.5; - uniqueRowMatrix_[24][18] = 0.25; - uniqueRowMatrix_[24][19] = 0.25; - - uniqueRowMatrix_[25][ 0] = -0.0625; - uniqueRowMatrix_[25][ 1] = 0.0625; - uniqueRowMatrix_[25][ 4] = 0.1875; - uniqueRowMatrix_[25][ 5] = -0.1875; - uniqueRowMatrix_[25][ 8] = 0.375; - uniqueRowMatrix_[25][12] = -0.125; - uniqueRowMatrix_[25][18] = 0.75; - - uniqueRowMatrix_[26][ 0] = -0.0625; - uniqueRowMatrix_[26][ 1] = 0.0625; - uniqueRowMatrix_[26][ 4] = 0.1875; - uniqueRowMatrix_[26][ 5] = -0.1875; - uniqueRowMatrix_[26][ 6] = 0.375; - uniqueRowMatrix_[26][10] = -0.125; - uniqueRowMatrix_[26][19] = 0.75; - - uniqueRowMatrix_[27][ 0] = 0.0625; - uniqueRowMatrix_[27][ 1] = 0.3125; - uniqueRowMatrix_[27][ 4] = -0.3125; - uniqueRowMatrix_[27][ 5] = 0.9375; - - uniqueRowMatrix_[28][ 0] = 0.0625; - uniqueRowMatrix_[28][ 1] = -0.0625; - uniqueRowMatrix_[28][ 4] = -0.1875; - uniqueRowMatrix_[28][ 5] = 0.1875; - uniqueRowMatrix_[28][ 8] = -0.125; - uniqueRowMatrix_[28][12] = 0.375; - uniqueRowMatrix_[28][18] = 0.75; - - uniqueRowMatrix_[29][ 0] = 0.0625; - uniqueRowMatrix_[29][ 1] = -0.0625; - uniqueRowMatrix_[29][ 4] = -0.1875; - uniqueRowMatrix_[29][ 5] = 0.1875; - uniqueRowMatrix_[29][ 6] = -0.125; - uniqueRowMatrix_[29][10] = 0.375; - uniqueRowMatrix_[29][19] = 0.75; - - rowDOFPtrs_[0] = parentDOFs_ + 0; - rowDOFPtrs_[1] = parentDOFs_ + 1; - rowDOFPtrs_[2] = parentDOFs_ + 2; - rowDOFPtrs_[3] = parentDOFs_ + 3; - rowDOFPtrs_[4] = child0DOFs_ + 9; - rowDOFPtrs_[5] = child1DOFs_ + 9; - rowDOFPtrs_[6] = parentDOFs_ + 6; - rowDOFPtrs_[7] = parentDOFs_ + 7; - rowDOFPtrs_[8] = parentDOFs_ + 8; - rowDOFPtrs_[9] = parentDOFs_ + 9; - rowDOFPtrs_[10] = parentDOFs_ + 10; - rowDOFPtrs_[11] = parentDOFs_ + 11; - rowDOFPtrs_[12] = parentDOFs_ + 12; - rowDOFPtrs_[13] = parentDOFs_ + 13; - rowDOFPtrs_[14] = parentDOFs_ + 14; - rowDOFPtrs_[15] = parentDOFs_ + 15; - rowDOFPtrs_[16] = parentDOFs_ + 16; - rowDOFPtrs_[17] = parentDOFs_ + 17; - rowDOFPtrs_[18] = child0DOFs_ + 15; - rowDOFPtrs_[19] = child0DOFs_ + 13; - rowDOFPtrs_[20] = child0DOFs_ + 3; - rowDOFPtrs_[21] = child0DOFs_ + 8; - rowDOFPtrs_[22] = child0DOFs_ + 12; - rowDOFPtrs_[23] = child0DOFs_ + 14; - rowDOFPtrs_[24] = child0DOFs_ + 16; - rowDOFPtrs_[25] = child0DOFs_ + 17; - rowDOFPtrs_[26] = child0DOFs_ + 18; - rowDOFPtrs_[27] = child1DOFs_ + 8; - rowDOFPtrs_[28] = child1DOFs_ + 17; - rowDOFPtrs_[29] = child1DOFs_ + 18; - - colDOFPtrs_[ 0] = parentDOFs_ + 0; - colDOFPtrs_[ 1] = parentDOFs_ + 1; - colDOFPtrs_[ 2] = parentDOFs_ + 2; - colDOFPtrs_[ 3] = parentDOFs_ + 3; - colDOFPtrs_[ 4] = parentDOFs_ + 4; - colDOFPtrs_[ 5] = parentDOFs_ + 5; - colDOFPtrs_[ 6] = parentDOFs_ + 6; - colDOFPtrs_[ 7] = parentDOFs_ + 7; - colDOFPtrs_[ 8] = parentDOFs_ + 8; - colDOFPtrs_[ 9] = parentDOFs_ + 9; - colDOFPtrs_[10] = parentDOFs_ + 10; - colDOFPtrs_[11] = parentDOFs_ + 11; - colDOFPtrs_[12] = parentDOFs_ + 12; - colDOFPtrs_[13] = parentDOFs_ + 13; - colDOFPtrs_[14] = parentDOFs_ + 14; - colDOFPtrs_[15] = parentDOFs_ + 15; - colDOFPtrs_[16] = parentDOFs_ + 16; - colDOFPtrs_[17] = parentDOFs_ + 17; - colDOFPtrs_[18] = parentDOFs_ + 18; - colDOFPtrs_[19] = parentDOFs_ + 19; - - type0_rowDOFPtrs_[0] = parentDOFs_ + 0; - type0_rowDOFPtrs_[1] = parentDOFs_ + 1; - type0_rowDOFPtrs_[2] = parentDOFs_ + 2; - type0_rowDOFPtrs_[3] = parentDOFs_ + 3; - type0_rowDOFPtrs_[4] = child0DOFs_ + 9; - type0_rowDOFPtrs_[5] = child1DOFs_ + 9; - type0_rowDOFPtrs_[6] = parentDOFs_ + 6; - type0_rowDOFPtrs_[7] = parentDOFs_ + 7; - type0_rowDOFPtrs_[8] = parentDOFs_ + 8; - type0_rowDOFPtrs_[9] = parentDOFs_ + 9; - type0_rowDOFPtrs_[10] = parentDOFs_ + 10; - type0_rowDOFPtrs_[11] = parentDOFs_ + 11; - type0_rowDOFPtrs_[12] = parentDOFs_ + 12; - type0_rowDOFPtrs_[13] = parentDOFs_ + 13; - type0_rowDOFPtrs_[14] = parentDOFs_ + 14; - type0_rowDOFPtrs_[15] = parentDOFs_ + 15; - type0_rowDOFPtrs_[16] = parentDOFs_ + 16; - type0_rowDOFPtrs_[17] = parentDOFs_ + 17; - type0_rowDOFPtrs_[18] = child0DOFs_ + 15; - type0_rowDOFPtrs_[19] = child0DOFs_ + 13; - type0_rowDOFPtrs_[20] = child0DOFs_ + 3; - type0_rowDOFPtrs_[21] = child0DOFs_ + 8; - type0_rowDOFPtrs_[22] = child0DOFs_ + 12; - type0_rowDOFPtrs_[23] = child0DOFs_ + 14; - type0_rowDOFPtrs_[24] = child0DOFs_ + 16; - type0_rowDOFPtrs_[25] = child0DOFs_ + 17; - type0_rowDOFPtrs_[26] = child0DOFs_ + 18; - type0_rowDOFPtrs_[27] = child1DOFs_ + 8; - type0_rowDOFPtrs_[28] = child1DOFs_ + 18; - type0_rowDOFPtrs_[29] = child1DOFs_ + 17; - - type0_colDOFPtrs_[ 0] = parentDOFs_ + 0; - type0_colDOFPtrs_[ 1] = parentDOFs_ + 1; - type0_colDOFPtrs_[ 2] = parentDOFs_ + 2; - type0_colDOFPtrs_[ 3] = parentDOFs_ + 3; - type0_colDOFPtrs_[ 4] = parentDOFs_ + 4; - type0_colDOFPtrs_[ 5] = parentDOFs_ + 5; - type0_colDOFPtrs_[ 6] = parentDOFs_ + 6; - type0_colDOFPtrs_[ 7] = parentDOFs_ + 7; - type0_colDOFPtrs_[ 8] = parentDOFs_ + 8; - type0_colDOFPtrs_[ 9] = parentDOFs_ + 9; - type0_colDOFPtrs_[10] = parentDOFs_ + 10; - type0_colDOFPtrs_[11] = parentDOFs_ + 11; - type0_colDOFPtrs_[12] = parentDOFs_ + 12; - type0_colDOFPtrs_[13] = parentDOFs_ + 13; - type0_colDOFPtrs_[14] = parentDOFs_ + 14; - type0_colDOFPtrs_[15] = parentDOFs_ + 15; - type0_colDOFPtrs_[16] = parentDOFs_ + 16; - type0_colDOFPtrs_[17] = parentDOFs_ + 17; - type0_colDOFPtrs_[18] = parentDOFs_ + 18; - type0_colDOFPtrs_[19] = parentDOFs_ + 19; - } - }; - - - /** \brief - * Defines the interpolation and restriction matrix for 3d-elements - * and 4d-lagrange basis functions. - */ - class IM_3d_4 : public InterpolRestrictMatrix - { - public: - IM_3d_4() : - InterpolRestrictMatrix(35, 55, 35, true) - {} - - void fillMemory() - { - directCopyDOFs_.push_back(0); - directCopyDOFs_.push_back(1); - directCopyDOFs_.push_back(2); - directCopyDOFs_.push_back(3); - directCopyDOFs_.push_back(7); - directCopyDOFs_.push_back(8); - directCopyDOFs_.push_back(9); - directCopyDOFs_.push_back(10); - directCopyDOFs_.push_back(11); - directCopyDOFs_.push_back(12); - directCopyDOFs_.push_back(13); - directCopyDOFs_.push_back(14); - directCopyDOFs_.push_back(15); - directCopyDOFs_.push_back(16); - directCopyDOFs_.push_back(17); - directCopyDOFs_.push_back(18); - directCopyDOFs_.push_back(19); - directCopyDOFs_.push_back(20); - directCopyDOFs_.push_back(21); - directCopyDOFs_.push_back(22); - directCopyDOFs_.push_back(23); - directCopyDOFs_.push_back(24); - directCopyDOFs_.push_back(25); - directCopyDOFs_.push_back(26); - directCopyDOFs_.push_back(27); - - uniqueRowMatrix_[ 4][ 4] = 1.0; - uniqueRowMatrix_[ 5][ 5] = 1.0; - uniqueRowMatrix_[ 6][ 6] = 1.0; - uniqueRowMatrix_[28][28] = 1.0; - uniqueRowMatrix_[29][29] = 1.0; - uniqueRowMatrix_[30][30] = 1.0; - uniqueRowMatrix_[31][31] = 1.0; - uniqueRowMatrix_[32][32] = 1.0; - uniqueRowMatrix_[33][33] = 1.0; - uniqueRowMatrix_[34][34] = 1.0; - - uniqueRowMatrix_[35][ 0] = 0.2734375; - uniqueRowMatrix_[35][ 1] = -0.0390625; - uniqueRowMatrix_[35][ 4] = 1.09375; - uniqueRowMatrix_[35][ 5] = -0.546875; - uniqueRowMatrix_[35][ 6] = 0.21875; - - uniqueRowMatrix_[36][ 0] = -0.0390625; - uniqueRowMatrix_[36][ 1] = 0.0234375; - uniqueRowMatrix_[36][ 4] = 0.46875; - uniqueRowMatrix_[36][ 5] = 0.703125; - uniqueRowMatrix_[36][ 6] = -0.15625; - - uniqueRowMatrix_[37][ 0] = -0.0390625; - uniqueRowMatrix_[37][ 1] = -0.0390625; - uniqueRowMatrix_[37][ 4] = 0.03125; - uniqueRowMatrix_[37][ 5] = 0.015625; - uniqueRowMatrix_[37][ 6] = 0.03125; - uniqueRowMatrix_[37][ 7] = 0.1875; - uniqueRowMatrix_[37][ 8] = -0.375; - uniqueRowMatrix_[37][ 9] = 0.5; - uniqueRowMatrix_[37][13] = 0.1875; - uniqueRowMatrix_[37][14] = -0.375; - uniqueRowMatrix_[37][15] = 0.5; - uniqueRowMatrix_[37][31] = -0.1875; - uniqueRowMatrix_[37][32] = -0.1875; - uniqueRowMatrix_[37][33] = 0.75; - - uniqueRowMatrix_[38][ 0] = 0.0234375; - uniqueRowMatrix_[38][ 1] = 0.0234375; - uniqueRowMatrix_[38][ 4] = -0.09375; - uniqueRowMatrix_[38][ 5] = 0.140625; - uniqueRowMatrix_[38][ 6] = -0.09375; - uniqueRowMatrix_[38][ 7] = -0.0625; - uniqueRowMatrix_[38][13] = -0.0625; - uniqueRowMatrix_[38][31] = 0.5625; - uniqueRowMatrix_[38][32] = 0.5625; - - uniqueRowMatrix_[39][ 0] = -0.0390625; - uniqueRowMatrix_[39][ 1] = -0.0390625; - uniqueRowMatrix_[39][ 4] = 0.03125; - uniqueRowMatrix_[39][ 5] = 0.015625; - uniqueRowMatrix_[39][ 6] = 0.03125; - uniqueRowMatrix_[39][10] = 0.1875; - uniqueRowMatrix_[39][11] = -0.375; - uniqueRowMatrix_[39][12] = 0.5; - uniqueRowMatrix_[39][16] = 0.1875; - uniqueRowMatrix_[39][17] = -0.375; - uniqueRowMatrix_[39][18] = 0.5; - uniqueRowMatrix_[39][28] = -0.1875; - uniqueRowMatrix_[39][29] = -0.1875; - uniqueRowMatrix_[39][30] = 0.75; - - uniqueRowMatrix_[40][ 0] = 0.0234375; - uniqueRowMatrix_[40][ 1] = 0.0234375; - uniqueRowMatrix_[40][ 4] = -0.09375; - uniqueRowMatrix_[40][ 5] = 0.140625; - uniqueRowMatrix_[40][ 6] = -0.09375; - uniqueRowMatrix_[40][10] = -0.0625; - uniqueRowMatrix_[40][16] = -0.0625; - uniqueRowMatrix_[40][28] = 0.5625; - uniqueRowMatrix_[40][29] = 0.5625; - - uniqueRowMatrix_[41][ 0] = -0.0390625; - uniqueRowMatrix_[41][ 1] = -0.0390625; - uniqueRowMatrix_[41][ 4] = 0.03125; - uniqueRowMatrix_[41][ 5] = 0.015625; - uniqueRowMatrix_[41][ 6] = 0.03125; - uniqueRowMatrix_[41][ 7] = 0.125; - uniqueRowMatrix_[41][ 8] = -0.125; - uniqueRowMatrix_[41][10] = 0.0625; - uniqueRowMatrix_[41][13] = 0.125; - uniqueRowMatrix_[41][14] = -0.125; - uniqueRowMatrix_[41][16] = 0.0625; - uniqueRowMatrix_[41][22] = -0.25; - uniqueRowMatrix_[41][23] = 0.5; - uniqueRowMatrix_[41][25] = -0.25; - uniqueRowMatrix_[41][26] = 0.5; - uniqueRowMatrix_[41][28] = -0.0625; - uniqueRowMatrix_[41][29] = -0.0625; - uniqueRowMatrix_[41][31] = -0.125; - uniqueRowMatrix_[41][32] = -0.125; - uniqueRowMatrix_[41][33] = 0.25; - uniqueRowMatrix_[41][34] = 0.5; - - uniqueRowMatrix_[42][ 0] = -0.0390625; - uniqueRowMatrix_[42][ 1] = -0.0390625; - uniqueRowMatrix_[42][ 4] = 0.03125; - uniqueRowMatrix_[42][ 5] = 0.015625; - uniqueRowMatrix_[42][ 6] = 0.03125; - uniqueRowMatrix_[42][ 7] = 0.0625; - uniqueRowMatrix_[42][10] = 0.125; - uniqueRowMatrix_[42][11] = -0.125; - uniqueRowMatrix_[42][13] = 0.0625; - uniqueRowMatrix_[42][16] = 0.125; - uniqueRowMatrix_[42][17] = -0.125; - uniqueRowMatrix_[42][22] = -0.25; - uniqueRowMatrix_[42][24] = 0.5; - uniqueRowMatrix_[42][25] = -0.25; - uniqueRowMatrix_[42][27] = 0.5; - uniqueRowMatrix_[42][28] = -0.125; - uniqueRowMatrix_[42][29] = -0.125; - uniqueRowMatrix_[42][30] = 0.25; - uniqueRowMatrix_[42][31] = -0.0625; - uniqueRowMatrix_[42][32] = -0.0625; - uniqueRowMatrix_[42][34] = 0.5; - - uniqueRowMatrix_[43][ 0] = -0.0390625; - uniqueRowMatrix_[43][ 1] = -0.0390625; - uniqueRowMatrix_[43][ 4] = 0.15625; - uniqueRowMatrix_[43][ 5] = -0.234375; - uniqueRowMatrix_[43][ 6] = 0.15625; - uniqueRowMatrix_[43][10] = 0.3125; - uniqueRowMatrix_[43][16] = 0.0625; - uniqueRowMatrix_[43][28] = 0.9375; - uniqueRowMatrix_[43][29] = -0.3125; - - uniqueRowMatrix_[44][ 0] = 0.0234375; - uniqueRowMatrix_[44][ 1] = -0.0390625; - uniqueRowMatrix_[44][ 4] = -0.03125; - uniqueRowMatrix_[44][ 5] = -0.046875; - uniqueRowMatrix_[44][ 6] = 0.09375; - uniqueRowMatrix_[44][10] = -0.125; - uniqueRowMatrix_[44][11] = 0.375; - uniqueRowMatrix_[44][16] = 0.125; - uniqueRowMatrix_[44][17] = -0.125; - uniqueRowMatrix_[44][28] = 0.375; - uniqueRowMatrix_[44][29] = -0.375; - uniqueRowMatrix_[44][30] = 0.75; - - uniqueRowMatrix_[45][ 0] = -0.0390625; - uniqueRowMatrix_[45][ 1] = -0.0390625; - uniqueRowMatrix_[45][ 4] = 0.15625; - uniqueRowMatrix_[45][ 5] = -0.234375; - uniqueRowMatrix_[45][ 6] = 0.15625; - uniqueRowMatrix_[45][ 7] = 0.3125; - uniqueRowMatrix_[45][13] = 0.0625; - uniqueRowMatrix_[45][31] = 0.9375; - uniqueRowMatrix_[45][32] = -0.3125; - - uniqueRowMatrix_[46][ 0] = 0.0234375; - uniqueRowMatrix_[46][ 1] = -0.0390625; - uniqueRowMatrix_[46][ 4] = -0.03125; - uniqueRowMatrix_[46][ 5] = -0.046875; - uniqueRowMatrix_[46][ 6] = 0.09375; - uniqueRowMatrix_[46][ 7] = -0.125; - uniqueRowMatrix_[46][ 8] = 0.375; - uniqueRowMatrix_[46][13] = 0.125; - uniqueRowMatrix_[46][14] = -0.125; - uniqueRowMatrix_[46][31] = 0.375; - uniqueRowMatrix_[46][32] = -0.375; - uniqueRowMatrix_[46][33] = 0.75; - - uniqueRowMatrix_[47][ 0] = 0.0234375; - uniqueRowMatrix_[47][ 1] = -0.0390625; - uniqueRowMatrix_[47][ 4] = -0.03125; - uniqueRowMatrix_[47][ 5] = -0.046875; - uniqueRowMatrix_[47][ 6] = 0.09375; - uniqueRowMatrix_[47][ 7] = -0.0625; - uniqueRowMatrix_[47][10] = -0.0625; - uniqueRowMatrix_[47][13] = 0.0625; - uniqueRowMatrix_[47][16] = 0.0625; - uniqueRowMatrix_[47][22] = -0.125; - uniqueRowMatrix_[47][25] = 0.375; - uniqueRowMatrix_[47][28] = 0.1875; - uniqueRowMatrix_[47][29] = -0.1875; - uniqueRowMatrix_[47][31] = 0.1875; - uniqueRowMatrix_[47][32] = -0.1875; - uniqueRowMatrix_[47][34] = 0.75; - - uniqueRowMatrix_[48][ 0] = -0.0390625; - uniqueRowMatrix_[48][ 1] = 0.2734375; - uniqueRowMatrix_[48][ 4] = 0.21875; - uniqueRowMatrix_[48][ 5] = -0.546875; - uniqueRowMatrix_[48][ 6] = 1.09375; - - uniqueRowMatrix_[49][ 0] = 0.0234375; - uniqueRowMatrix_[49][ 1] = -0.0390625; - uniqueRowMatrix_[49][ 4] = -0.15625; - uniqueRowMatrix_[49][ 5] = 0.703125; - uniqueRowMatrix_[49][ 6] = 0.46875; - - uniqueRowMatrix_[50][ 0] = -0.0390625; - uniqueRowMatrix_[50][ 1] = -0.0390625; - uniqueRowMatrix_[50][ 4] = 0.15625; - uniqueRowMatrix_[50][ 5] = -0.234375; - uniqueRowMatrix_[50][ 6] = 0.15625; - uniqueRowMatrix_[50][10] = 0.0625; - uniqueRowMatrix_[50][16] = 0.3125; - uniqueRowMatrix_[50][28] = -0.3125; - uniqueRowMatrix_[50][29] = 0.9375; - - uniqueRowMatrix_[51][ 0] = -0.0390625; - uniqueRowMatrix_[51][ 1] = 0.0234375; - uniqueRowMatrix_[51][ 4] = 0.09375; - uniqueRowMatrix_[51][ 5] = -0.046875; - uniqueRowMatrix_[51][ 6] = -0.03125; - uniqueRowMatrix_[51][10] = 0.125; - uniqueRowMatrix_[51][11] = -0.125; - uniqueRowMatrix_[51][16] = -0.125; - uniqueRowMatrix_[51][17] = 0.375; - uniqueRowMatrix_[51][28] = -0.375; - uniqueRowMatrix_[51][29] = 0.375; - uniqueRowMatrix_[51][30] = 0.75; - - uniqueRowMatrix_[52][ 0] = -0.0390625; - uniqueRowMatrix_[52][ 1] = -0.0390625; - uniqueRowMatrix_[52][ 4] = 0.15625; - uniqueRowMatrix_[52][ 5] = -0.234375; - uniqueRowMatrix_[52][ 6] = 0.15625; - uniqueRowMatrix_[52][ 7] = 0.0625; - uniqueRowMatrix_[52][13] = 0.3125; - uniqueRowMatrix_[52][31] = -0.3125; - uniqueRowMatrix_[52][32] = 0.9375; - - uniqueRowMatrix_[53][ 0] = -0.0390625; - uniqueRowMatrix_[53][ 1] = 0.0234375; - uniqueRowMatrix_[53][ 4] = 0.09375; - uniqueRowMatrix_[53][ 5] = -0.046875; - uniqueRowMatrix_[53][ 6] = -0.03125; - uniqueRowMatrix_[53][ 7] = 0.125; - uniqueRowMatrix_[53][ 8] = -0.125; - uniqueRowMatrix_[53][13] = -0.125; - uniqueRowMatrix_[53][14] = 0.375; - uniqueRowMatrix_[53][31] = -0.375; - uniqueRowMatrix_[53][32] = 0.375; - uniqueRowMatrix_[53][33] = 0.75; - - uniqueRowMatrix_[54][ 0] = -0.0390625; - uniqueRowMatrix_[54][ 1] = 0.0234375; - uniqueRowMatrix_[54][ 4] = 0.09375; - uniqueRowMatrix_[54][ 5] = -0.046875; - uniqueRowMatrix_[54][ 6] = -0.03125; - uniqueRowMatrix_[54][ 7] = 0.0625; - uniqueRowMatrix_[54][10] = 0.0625; - uniqueRowMatrix_[54][13] = -0.0625; - uniqueRowMatrix_[54][16] = -0.0625; - uniqueRowMatrix_[54][22] = 0.375; - uniqueRowMatrix_[54][25] = -0.125; - uniqueRowMatrix_[54][28] = -0.1875; - uniqueRowMatrix_[54][29] = 0.1875; - uniqueRowMatrix_[54][31] = -0.1875; - uniqueRowMatrix_[54][32] = 0.1875; - uniqueRowMatrix_[54][34] = 0.75; - - - rowDOFPtrs_[ 0] = parentDOFs_ + 0; - rowDOFPtrs_[ 1] = parentDOFs_ + 1; - rowDOFPtrs_[ 2] = parentDOFs_ + 2; - rowDOFPtrs_[ 3] = parentDOFs_ + 3; - rowDOFPtrs_[ 4] = child0DOFs_ + 11; - rowDOFPtrs_[ 5] = child0DOFs_ + 3; - rowDOFPtrs_[ 6] = child1DOFs_ + 11; - rowDOFPtrs_[ 7] = parentDOFs_ + 7; - rowDOFPtrs_[ 8] = parentDOFs_ + 8; - rowDOFPtrs_[ 9] = parentDOFs_ + 9; - rowDOFPtrs_[10] = parentDOFs_ + 10; - rowDOFPtrs_[11] = parentDOFs_ + 11; - rowDOFPtrs_[12] = parentDOFs_ + 12; - rowDOFPtrs_[13] = parentDOFs_ + 13; - rowDOFPtrs_[14] = parentDOFs_ + 14; - rowDOFPtrs_[15] = parentDOFs_ + 15; - rowDOFPtrs_[16] = parentDOFs_ + 16; - rowDOFPtrs_[17] = parentDOFs_ + 17; - rowDOFPtrs_[18] = parentDOFs_ + 18; - rowDOFPtrs_[19] = parentDOFs_ + 19; - rowDOFPtrs_[20] = parentDOFs_ + 20; - rowDOFPtrs_[21] = parentDOFs_ + 21; - rowDOFPtrs_[22] = parentDOFs_ + 22; - rowDOFPtrs_[23] = parentDOFs_ + 23; - rowDOFPtrs_[24] = parentDOFs_ + 24; - rowDOFPtrs_[25] = parentDOFs_ + 25; - rowDOFPtrs_[26] = parentDOFs_ + 26; - rowDOFPtrs_[27] = parentDOFs_ + 27; - rowDOFPtrs_[28] = child0DOFs_ + 27; - rowDOFPtrs_[29] = child1DOFs_ + 27; - rowDOFPtrs_[30] = child0DOFs_ + 20; - rowDOFPtrs_[31] = child0DOFs_ + 30; - rowDOFPtrs_[32] = child1DOFs_ + 30; - rowDOFPtrs_[33] = child0DOFs_ + 17; - rowDOFPtrs_[34] = child0DOFs_ + 24; - rowDOFPtrs_[35] = child0DOFs_ + 10; - rowDOFPtrs_[36] = child0DOFs_ + 12; - rowDOFPtrs_[37] = child0DOFs_ + 16; - rowDOFPtrs_[38] = child0DOFs_ + 18; - rowDOFPtrs_[39] = child0DOFs_ + 19; - rowDOFPtrs_[40] = child0DOFs_ + 21; - rowDOFPtrs_[41] = child0DOFs_ + 22; - rowDOFPtrs_[42] = child0DOFs_ + 23; - rowDOFPtrs_[43] = child0DOFs_ + 25; - rowDOFPtrs_[44] = child0DOFs_ + 26; - rowDOFPtrs_[45] = child0DOFs_ + 28; - rowDOFPtrs_[46] = child0DOFs_ + 29; - rowDOFPtrs_[47] = child0DOFs_ + 34; - rowDOFPtrs_[48] = child1DOFs_ + 10; - rowDOFPtrs_[49] = child1DOFs_ + 12; - rowDOFPtrs_[50] = child1DOFs_ + 25; - rowDOFPtrs_[51] = child1DOFs_ + 26; - rowDOFPtrs_[52] = child1DOFs_ + 28; - rowDOFPtrs_[53] = child1DOFs_ + 29; - rowDOFPtrs_[54] = child1DOFs_ + 34; - - colDOFPtrs_[ 0] = parentDOFs_ + 0; - colDOFPtrs_[ 1] = parentDOFs_ + 1; - colDOFPtrs_[ 2] = parentDOFs_ + 2; - colDOFPtrs_[ 3] = parentDOFs_ + 3; - colDOFPtrs_[ 4] = parentDOFs_ + 4; - colDOFPtrs_[ 5] = parentDOFs_ + 5; - colDOFPtrs_[ 6] = parentDOFs_ + 6; - colDOFPtrs_[ 7] = parentDOFs_ + 7; - colDOFPtrs_[ 8] = parentDOFs_ + 8; - colDOFPtrs_[ 9] = parentDOFs_ + 9; - colDOFPtrs_[10] = parentDOFs_ + 10; - colDOFPtrs_[11] = parentDOFs_ + 11; - colDOFPtrs_[12] = parentDOFs_ + 12; - colDOFPtrs_[13] = parentDOFs_ + 13; - colDOFPtrs_[14] = parentDOFs_ + 14; - colDOFPtrs_[15] = parentDOFs_ + 15; - colDOFPtrs_[16] = parentDOFs_ + 16; - colDOFPtrs_[17] = parentDOFs_ + 17; - colDOFPtrs_[18] = parentDOFs_ + 18; - colDOFPtrs_[19] = parentDOFs_ + 19; - colDOFPtrs_[20] = parentDOFs_ + 20; - colDOFPtrs_[21] = parentDOFs_ + 21; - colDOFPtrs_[22] = parentDOFs_ + 22; - colDOFPtrs_[23] = parentDOFs_ + 23; - colDOFPtrs_[24] = parentDOFs_ + 24; - colDOFPtrs_[25] = parentDOFs_ + 25; - colDOFPtrs_[26] = parentDOFs_ + 26; - colDOFPtrs_[27] = parentDOFs_ + 27; - colDOFPtrs_[28] = parentDOFs_ + 28; - colDOFPtrs_[29] = parentDOFs_ + 29; - colDOFPtrs_[30] = parentDOFs_ + 30; - colDOFPtrs_[31] = parentDOFs_ + 31; - colDOFPtrs_[32] = parentDOFs_ + 32; - colDOFPtrs_[33] = parentDOFs_ + 33; - colDOFPtrs_[34] = parentDOFs_ + 34; - - type0_rowDOFPtrs_[ 0] = parentDOFs_ + 0; - type0_rowDOFPtrs_[ 1] = parentDOFs_ + 1; - type0_rowDOFPtrs_[ 2] = parentDOFs_ + 2; - type0_rowDOFPtrs_[ 3] = parentDOFs_ + 3; - type0_rowDOFPtrs_[ 4] = child0DOFs_ + 11; - type0_rowDOFPtrs_[ 5] = child0DOFs_ + 3; - type0_rowDOFPtrs_[ 6] = child1DOFs_ + 11; - type0_rowDOFPtrs_[ 7] = parentDOFs_ + 7; - type0_rowDOFPtrs_[ 8] = parentDOFs_ + 8; - type0_rowDOFPtrs_[ 9] = parentDOFs_ + 9; - type0_rowDOFPtrs_[10] = parentDOFs_ + 10; - type0_rowDOFPtrs_[11] = parentDOFs_ + 11; - type0_rowDOFPtrs_[12] = parentDOFs_ + 12; - type0_rowDOFPtrs_[13] = parentDOFs_ + 13; - type0_rowDOFPtrs_[14] = parentDOFs_ + 14; - type0_rowDOFPtrs_[15] = parentDOFs_ + 15; - type0_rowDOFPtrs_[16] = parentDOFs_ + 16; - type0_rowDOFPtrs_[17] = parentDOFs_ + 17; - type0_rowDOFPtrs_[18] = parentDOFs_ + 18; - type0_rowDOFPtrs_[19] = parentDOFs_ + 19; - type0_rowDOFPtrs_[20] = parentDOFs_ + 20; - type0_rowDOFPtrs_[21] = parentDOFs_ + 21; - type0_rowDOFPtrs_[22] = parentDOFs_ + 22; - type0_rowDOFPtrs_[23] = parentDOFs_ + 23; - type0_rowDOFPtrs_[24] = parentDOFs_ + 24; - type0_rowDOFPtrs_[25] = parentDOFs_ + 25; - type0_rowDOFPtrs_[26] = parentDOFs_ + 26; - type0_rowDOFPtrs_[27] = parentDOFs_ + 27; - type0_rowDOFPtrs_[28] = child0DOFs_ + 27; - type0_rowDOFPtrs_[29] = child1DOFs_ + 30; - type0_rowDOFPtrs_[30] = child0DOFs_ + 20; - type0_rowDOFPtrs_[31] = child0DOFs_ + 30; - type0_rowDOFPtrs_[32] = child1DOFs_ + 27; - type0_rowDOFPtrs_[33] = child0DOFs_ + 17; - type0_rowDOFPtrs_[34] = child0DOFs_ + 24; - type0_rowDOFPtrs_[35] = child0DOFs_ + 10; - type0_rowDOFPtrs_[36] = child0DOFs_ + 12; - type0_rowDOFPtrs_[37] = child0DOFs_ + 16; - type0_rowDOFPtrs_[38] = child0DOFs_ + 18; - type0_rowDOFPtrs_[39] = child0DOFs_ + 19; - type0_rowDOFPtrs_[40] = child0DOFs_ + 21; - type0_rowDOFPtrs_[41] = child0DOFs_ + 22; - type0_rowDOFPtrs_[42] = child0DOFs_ + 23; - type0_rowDOFPtrs_[43] = child0DOFs_ + 25; - type0_rowDOFPtrs_[44] = child0DOFs_ + 26; - type0_rowDOFPtrs_[45] = child0DOFs_ + 28; - type0_rowDOFPtrs_[46] = child0DOFs_ + 29; - type0_rowDOFPtrs_[47] = child0DOFs_ + 34; - type0_rowDOFPtrs_[48] = child1DOFs_ + 10; - type0_rowDOFPtrs_[49] = child1DOFs_ + 12; - type0_rowDOFPtrs_[50] = child1DOFs_ + 28; - type0_rowDOFPtrs_[51] = child1DOFs_ + 29; - type0_rowDOFPtrs_[52] = child1DOFs_ + 25; - type0_rowDOFPtrs_[53] = child1DOFs_ + 26; - type0_rowDOFPtrs_[54] = child1DOFs_ + 34; - - type0_colDOFPtrs_[ 0] = parentDOFs_ + 0; - type0_colDOFPtrs_[ 1] = parentDOFs_ + 1; - type0_colDOFPtrs_[ 2] = parentDOFs_ + 2; - type0_colDOFPtrs_[ 3] = parentDOFs_ + 3; - type0_colDOFPtrs_[ 4] = parentDOFs_ + 4; - type0_colDOFPtrs_[ 5] = parentDOFs_ + 5; - type0_colDOFPtrs_[ 6] = parentDOFs_ + 6; - type0_colDOFPtrs_[ 7] = parentDOFs_ + 7; - type0_colDOFPtrs_[ 8] = parentDOFs_ + 8; - type0_colDOFPtrs_[ 9] = parentDOFs_ + 9; - type0_colDOFPtrs_[10] = parentDOFs_ + 10; - type0_colDOFPtrs_[11] = parentDOFs_ + 11; - type0_colDOFPtrs_[12] = parentDOFs_ + 12; - type0_colDOFPtrs_[13] = parentDOFs_ + 13; - type0_colDOFPtrs_[14] = parentDOFs_ + 14; - type0_colDOFPtrs_[15] = parentDOFs_ + 15; - type0_colDOFPtrs_[16] = parentDOFs_ + 16; - type0_colDOFPtrs_[17] = parentDOFs_ + 17; - type0_colDOFPtrs_[18] = parentDOFs_ + 18; - type0_colDOFPtrs_[19] = parentDOFs_ + 19; - type0_colDOFPtrs_[20] = parentDOFs_ + 20; - type0_colDOFPtrs_[21] = parentDOFs_ + 21; - type0_colDOFPtrs_[22] = parentDOFs_ + 22; - type0_colDOFPtrs_[23] = parentDOFs_ + 23; - type0_colDOFPtrs_[24] = parentDOFs_ + 24; - type0_colDOFPtrs_[25] = parentDOFs_ + 25; - type0_colDOFPtrs_[26] = parentDOFs_ + 26; - type0_colDOFPtrs_[27] = parentDOFs_ + 27; - type0_colDOFPtrs_[28] = parentDOFs_ + 28; - type0_colDOFPtrs_[29] = parentDOFs_ + 29; - type0_colDOFPtrs_[30] = parentDOFs_ + 30; - type0_colDOFPtrs_[31] = parentDOFs_ + 31; - type0_colDOFPtrs_[32] = parentDOFs_ + 32; - type0_colDOFPtrs_[33] = parentDOFs_ + 33; - type0_colDOFPtrs_[34] = parentDOFs_ + 34; - } - }; -} - -#endif diff --git a/AMDiS/src/MatVecMultiplier.cc b/AMDiS/src/MatVecMultiplier.cc deleted file mode 100644 index 741e8753..00000000 --- a/AMDiS/src/MatVecMultiplier.cc +++ /dev/null @@ -1,181 +0,0 @@ -#include <iostream> -#include <fstream> -#include <vector> -#include "time.h" -#include "MatVecMultiplier.h" -#include "FiniteElemSpace.h" -#include "DOFMatrix.h" -#include "DOFVector.h" -#include "MatrixVector.h" -#include "SystemVector.h" - -// These sources are rather suspicious -- Peter - -namespace AMDiS { - - template<> void - StandardMatVec<DOFMatrix, DOFVector<double> >::matVec(MatrixTranspose transpose, - const DOFVector<double> &x, - DOFVector<double> &result, - bool add) - { - FUNCNAME("StandardMatVec::matVec()"); - - TEST_EXIT((x.getFESpace() == matrix->getColFESpace())) - ("finite element spaces of matrix and x must be the same!\n"); - - mv(transpose, *matrix, x, result, add); - } - - template <> void - StandardMatVec<Matrix<DOFMatrix*>, SystemVector>::matVec(MatrixTranspose transpose, - const SystemVector &x, - SystemVector &result, - bool add) - { - mv(*matrix, x, result); - } - - - - template<> void - StandardMatVec< std::vector< std::vector<MatEntry> >, - std::vector<double> >::matVec(MatrixTranspose transpose, - const std::vector<double> &x, - std::vector<double> &result, - bool add) - { - FUNCNAME("StandardMatVec::matVec()"); - - unsigned int nRows = matrix->size(); - - TEST_EXIT_DBG(x.size() == nRows)("SIZE!\n"); - TEST_EXIT_DBG(result.size() == nRows)("SIZE!\n"); - - if (!add) { - for (unsigned int i = 0; i < nRows; i++) { - result[i] = 0.0; - } - } - - for (unsigned int row = 0; row < nRows; row++) { - for (unsigned int col = 0; col < (*matrix)[row].size(); col++) { - MatEntry *m = &(*matrix)[row][col]; - - result[row] += m->entry * x[m->col]; - } - } - } - - template<> - void MassLumpingMatVec<DOFMatrix, DOFVector<double> >::calcMassLumpingMatrix(DOFMatrix *m) - { - ERROR_EXIT("Will be rewritten (if any needs it) - Peter\n"); - -#if 0 - // create new or clear old matrix - if (!matrix) { - matrix = NEW DOFMatrix(m->getRowFESpace(), - m->getColFESpace(), - "mass lumping matrix"); - } - else { - matrix->clear(); - } - - // for all rows - DOFMatrix::Iterator rowIt1(m, USED_DOFS); - DOFMatrix::Iterator rowIt2(matrix, USED_DOFS); - for (rowIt1.reset(), rowIt2.reset(); - !rowIt1.end(); - ++rowIt1, ++rowIt2) - { - double rowSum = 0.0; - int rowSize = static_cast<int>(rowIt1->size()); - - for (int i = 0; i < rowSize; i++) { - if ((*rowIt1)[i].col == DOFMatrix::NO_MORE_ENTRIES) { - break; - } - if ((*rowIt1)[i].col == DOFMatrix::UNUSED_ENTRY) { - continue; - } - - double entry = (*rowIt1)[i].entry; - - TEST_EXIT_DBG(entry >= 0)("entries must be >= 0\n"); - - rowSum += entry; - } - - TEST_EXIT_DBG(rowSum > 1E-20)("matrix not inversable\n"); - - (*rowIt2).resize(1); - (*rowIt2)[0].col = rowIt2.getDOFIndex(); - (*rowIt2)[0].entry = 1.0 / rowSum; - } -#endif - } - - template<> - void MassLumpingMatVec<Matrix<DOFMatrix*>, SystemVector>::calcMassLumpingMatrix(Matrix<DOFMatrix*> *m) - { - ERROR_EXIT("Will be rewritten (if any needs it) - Peter\n"); - -#if 0 - int numComponents = m->getNumRows(); - // create new or clear old matrix - if(!matrix) { - matrix = NEW Matrix<DOFMatrix*>(numComponents, numComponents); - for (int i = 0; i < numComponents; i++) { - (*matrix)[i][i] = NEW DOFMatrix((*m)[i][i]->getRowFESpace(), - (*m)[i][i]->getColFESpace(), - "mass lumping matrix"); - } - } - else { - for (int i = 0; i < numComponents; i++) - (*matrix)[i][i]->clear(); - } - - // for all rows - for (int i = 0; i < numComponents; i++) { - DOFMatrix::Iterator rowIt1((*m)[i][i], USED_DOFS); - DOFMatrix::Iterator rowIt2((*matrix)[i][i], USED_DOFS); - for (rowIt1.reset(), rowIt2.reset(); - !rowIt1.end(); - ++rowIt1, ++rowIt2) - { - double rowSum = 0.0; - int rowSize = static_cast<int>(rowIt1->size()); - - for (int j = 0; j < rowSize; j++) { - if((*rowIt1)[j].col == DOFMatrix::NO_MORE_ENTRIES) { - break; - } - if((*rowIt1)[j].col == DOFMatrix::UNUSED_ENTRY) { - continue; - } - - double entry = (*rowIt1)[j].entry; - - TEST_EXIT_DBG(entry >= 0)("entries must be >= 0\n"); - - rowSum += entry; - } - - TEST_EXIT_DBG(rowSum > 1E-20)("matrix not inversable\n"); - - (*rowIt2).resize(1); - (*rowIt2)[0].col = rowIt2.getDOFIndex(); - (*rowIt2)[0].entry = 1.0 / rowSum; - } - } -#endif - } - - - StandardMatVec<Matrix<DOFMatrix*>, SystemVector> _enf_(NULL); - StandardMatVec<DOFMatrix, DOFVector<double> > _grmpf_(NULL); - -} diff --git a/AMDiS/src/MatVecMultiplier.h b/AMDiS/src/MatVecMultiplier.h deleted file mode 100644 index 5a1e575c..00000000 --- a/AMDiS/src/MatVecMultiplier.h +++ /dev/null @@ -1,188 +0,0 @@ -// ============================================================================ -// == == -// == AMDiS - Adaptive multidimensional simulations == -// == == -// ============================================================================ -// == == -// == crystal growth group == -// == == -// == Stiftung caesar == -// == Ludwig-Erhard-Allee 2 == -// == 53175 Bonn == -// == germany == -// == == -// ============================================================================ -// == == -// == http://www.caesar.de/cg/AMDiS == -// == == -// ============================================================================ - -/** \file MatVecMultipler.h */ - -#ifndef AMDIS_MATVECMULTIPLIER_H -#define AMDIS_MATVECMULTIPLIER_H - -#include<vector> - -#include "Global.h" -#include "MemoryManager.h" -//#include "Boundary.h" -#include "DOFVector.h" -#include "DOFMatrix.h" -#include "MatrixVector.h" -#include "time.h" - -namespace AMDiS { - - template<typename T> class DOFVector; - - // =========================================================================== - // ===== class MatVecMultiplier ============================================== - // =========================================================================== - - /** - * \ingroup Solver - * - * \brief - * Interface for matrix-vector multiplication. - */ - template<typename Vector> - class MatVecMultiplier - { - public: - MEMORY_MANAGED(MatVecMultiplier); - - /** \brief - * Destructor. - */ - virtual ~MatVecMultiplier() {}; - - /** \brief - * To be overloaded by concrete implementations. - */ - virtual void matVec(MatrixTranspose transpose, - const Vector &vec, - Vector &result, - bool add = false) = 0; - }; - - // =========================================================================== - // ===== class StandardMatVec ================================================ - // =========================================================================== - - /** - * \ingroup Solver - * - * \brief - * Implementation of the standard matrix vector multiplication. - */ - template<typename MatrixType, typename VectorType> - class StandardMatVec : public MatVecMultiplier<VectorType> - { - public: - MEMORY_MANAGED(StandardMatVec<MatrixType COMMA VectorType>); - - /** \brief - * - */ - StandardMatVec(MatrixType *mat) - : matrix(mat) - {}; - - virtual ~StandardMatVec() {}; - - /** \brief - * Implements \ref MatVecMultiplier::matVec(). - */ - virtual void matVec(MatrixTranspose transpose, - const VectorType &x, - VectorType &result, - bool add = false) { - FUNCNAME("StandardMatVec::matVec()"); - - WARNING("Non specialised function should not be called\n"); - }; - - /** \brief - * Sets \ref matrix. - */ - virtual void setMatrix(MatrixType *m) { - matrix = m; - }; - - virtual MatrixType* getMatrix() { - return matrix; - }; - - virtual const MatrixType* getMatrix() const { - return matrix; - }; - - protected: - /** \brief - * Matrix used for matrix-vector multiplication. - */ - MatrixType *matrix; - }; - - - - template<typename MatrixType, typename VectorType> - class MassLumpingMatVec : public StandardMatVec<MatrixType, VectorType> - { - public: - /** - * Empty constructor. - */ - MassLumpingMatVec() - : StandardMatVec<MatrixType, VectorType>(NULL) - {}; - - /** \brief - * - */ - MassLumpingMatVec(MatrixType *mat) - : StandardMatVec<MatrixType, VectorType>(NULL) - { - calcMassLumpingMatrix(mat); - }; - - virtual ~MassLumpingMatVec() { - if (this->matrix) - DELETE this->matrix; - }; - - /** \brief - * Sets \ref matrix. - */ - void setMatrix(MatrixType *m) { - FUNCNAME("MassLumpingMatVec::setMatrix()"); - - ERROR_EXIT("should not be called\n"); - }; - - void calcMassLumpingMatrix(MatrixType *m); - }; - - - - template<> void - StandardMatVec<DOFMatrix, DOFVector<double> >::matVec(MatrixTranspose transpose, - const DOFVector<double> &x, - DOFVector<double> &result, - bool add); - - - class SystemVector; - - template <> void - StandardMatVec<Matrix<DOFMatrix*>, SystemVector>::matVec( - MatrixTranspose transpose, - const SystemVector &x, - SystemVector &result, - bool add - ); - - -} -#endif // AMDIS_MATVECMULTIPLIER_H diff --git a/AMDiS/src/MultiGridPreconWrapper.cc b/AMDiS/src/MultiGridPreconWrapper.cc deleted file mode 100644 index 42ef2f8e..00000000 --- a/AMDiS/src/MultiGridPreconWrapper.cc +++ /dev/null @@ -1,49 +0,0 @@ -#if 0 - -#include "MultiGridPreconWrapper.h" -#include "MultiGridSolver.h" -#include "DOFVector.h" - -namespace AMDiS { - - MGPreconWrapperScal::MGPreconWrapperScal(std::string name, int size_, int row_) - : PreconditionerScal(size_, row_), - solution_(NULL) - { - mgSolver_ = NEW MultiGridSolverScal(name); - } - - MGPreconWrapperScal::~MGPreconWrapperScal() - { - if(solution_) { - DELETE solution_; - } - DELETE mgSolver_; - } - - void MGPreconWrapperScal::init() { - FUNCNAME("MGPreconWrapperScal::init"); - TEST_EXIT(matrix[row])("no matrix\n"); - initMG_ = true; - }; - - void MGPreconWrapperScal::exit() { - mgSolver_->exitMultiGrid(); - }; - - void MGPreconWrapperScal::precon(DOFVector<double> *vec) - { - if(!solution_) { - solution_ = NEW DOFVector<double>(vec->getFESpace(), "MG precon solution"); - } - - solution_->set(0.0); - mgSolver_->solve((*(*(matrix[row]))), *solution_, *vec, initMG_, false); - initMG_ = false; - - vec->copy(*solution_); - } - -} - -#endif diff --git a/AMDiS/src/MultiGridPreconWrapper.h b/AMDiS/src/MultiGridPreconWrapper.h deleted file mode 100644 index 961c75d0..00000000 --- a/AMDiS/src/MultiGridPreconWrapper.h +++ /dev/null @@ -1,99 +0,0 @@ -// ============================================================================ -// == == -// == AMDiS - Adaptive multidimensional simulations == -// == == -// ============================================================================ -// == == -// == crystal growth group == -// == == -// == Stiftung caesar == -// == Ludwig-Erhard-Allee 2 == -// == 53175 Bonn == -// == germany == -// == == -// ============================================================================ -// == == -// == http://www.caesar.de/cg/AMDiS == -// == == -// ============================================================================ - -/** \file MultiGridPreconWrapper.h */ - -#ifndef AMDIS_MULTIGRIDPRECONWRAPPER_H -#define AMDIS_MULTIGRIDPRECONWRAPPER_H - -#if 0 - -#include "Preconditioner.h" -#include "MemoryManager.h" - -namespace AMDiS { - - template<typename T> class DOFVector; - template<typename M, typename V> class MultiGridSolverBase; - - // ========================================================================= - // ===== MGPreconWrqpperScal =============================================== - // ========================================================================= - - /** \brief - * \ingroup Solver - * Wrapper for using multigrid as preconditioner within other iterative - * solvers. - */ - class MGPreconWrapperScal : public PreconditionerScal - { - public: - /** \brief - * Constructor. - */ - MGPreconWrapperScal(std::string name, int size_ = 1, int row_ = 0); - - /** \brief - * Destructor. - */ - virtual ~MGPreconWrapperScal(); - - /** \brief - * realisation of Preconditioner::init - */ - void init(); - - /** \brief - * realisation of Preconditioner::precon - */ - void precon(DOFVector<double> *vec); - - /** \brief - * realisation of Preconditioner::exit - */ - void exit(); - - // ======================================================================= - // ===== Creator ========================================================= - // ======================================================================= - - class Creator : public PreconditionerScalCreator - { - public: - MEMORY_MANAGED(Creator); - - /** \brief - * Creates a DiagonalPreconditioner. - */ - PreconditionerScal *create() { - return NEW MGPreconWrapperScal(name_, size, row); - }; - }; - - protected: - MultiGridSolverBase<DOFMatrix, DOFVector<double> > *mgSolver_; - DOFVector<double> *solution_; - bool initMG_; - }; - -} - -#endif - -#endif diff --git a/AMDiS/src/MultiGridSolver.cc b/AMDiS/src/MultiGridSolver.cc deleted file mode 100644 index 8a56fd7c..00000000 --- a/AMDiS/src/MultiGridSolver.cc +++ /dev/null @@ -1,1731 +0,0 @@ -#if 0 - -#include "MultiGridSolver.h" -#include "FiniteElemSpace.h" -#include "DOFVector.h" -#include "DOFMatrix.h" -#include "Traverse.h" -#include "MacroWriter.h" -#include "ValueWriter.h" -#include "SparseVector.h" -#include "ElInfo.h" -#include "Parameters.h" -#include "SystemVector.h" -#include "GSSmoother.h" -#include <algorithm> -#include "InterpolRestrictMatrix.h" -#include "LagrangeInterpolRestrict.h" -#include "DirichletBC.h" - -namespace AMDiS { - - - MultiGridSolverScal::MultiGridSolverScal(const ::std::string &name) - : MultiGridSolverBase<DOFMatrix, DOFVector<double> >(name) {ERROR_EXIT("Will be rewritten - Peter\n");} - void MultiGridSolverScal::initMaxLevel() {ERROR_EXIT("Will be rewritten - Peter\n");} - void MultiGridSolverScal::initMultiGrid(bool initMG) {ERROR_EXIT("Will be rewritten - Peter\n");} - void MultiGridSolverScal::exitMultiGrid() {ERROR_EXIT("Will be rewritten - Peter\n");} - void MultiGridSolverScal::smooth(int level, int steps) {ERROR_EXIT("Will be rewritten - Peter\n");} - void MultiGridSolverScal::prolongate(int level, int coarseLevel) {ERROR_EXIT("Will be rewritten - Peter\n");} - void MultiGridSolverScal::restrict(int level, int coarseLevel) {ERROR_EXIT("Will be rewritten - Peter\n");} - void MultiGridSolverScal::computeResidual(int level, int coarseLevel) {ERROR_EXIT("Will be rewritten - Peter\n");} - void MultiGridSolverScal::computeRHS(int level, int coarseLevel) {ERROR_EXIT("Will be rewritten - Peter\n");} - void MultiGridSolverScal::computeCorrection(int level, int coarseLevel) {ERROR_EXIT("Will be rewritten - Peter\n");} - void MultiGridSolverScal::fixSolution(int level, int coarseLevel) {ERROR_EXIT("Will be rewritten - Peter\n");} - void MultiGridSolverScal::exactSolve(int level) {ERROR_EXIT("Will be rewritten - Peter\n");} - bool MultiGridSolverScal::toleranceReached(double tol) {ERROR_EXIT("Will be rewritten - Peter\n"); return true; } - void MultiGridSolverScal::initFullMultiGrid() {ERROR_EXIT("Will be rewritten - Peter\n");} - void MultiGridSolverScal::fmgInterpol(int level) {ERROR_EXIT("Will be rewritten - Peter\n");} - MultiGridSolverVec::MultiGridSolverVec(const ::std::string &name) - : MultiGridSolverBase<Matrix<DOFMatrix*>, SystemVector>(name) {ERROR_EXIT("Will be rewritten - Peter\n");} - void MultiGridSolverVec::initMaxLevel() {ERROR_EXIT("Will be rewritten - Peter\n");} - void MultiGridSolverVec::initMultiGrid(bool initMG) {ERROR_EXIT("Will be rewritten - Peter\n");} - void MultiGridSolverVec::exitMultiGrid() {ERROR_EXIT("Will be rewritten - Peter\n");} - void MultiGridSolverVec::smooth(int level, int steps) {ERROR_EXIT("Will be rewritten - Peter\n");} - void MultiGridSolverVec::prolongate(int level, int coarseLevel) {ERROR_EXIT("Will be rewritten - Peter\n");} - void MultiGridSolverVec::restrict(int level, int coarseLevel) {ERROR_EXIT("Will be rewritten - Peter\n");} - void MultiGridSolverVec::computeResidual(int level, int coarseLevel) {ERROR_EXIT("Will be rewritten - Peter\n");} - void MultiGridSolverVec::computeRHS(int level, int coarseLevel) {ERROR_EXIT("Will be rewritten - Peter\n");} - void MultiGridSolverVec::computeCorrection(int level, int coarseLevel) {ERROR_EXIT("Will be rewritten - Peter\n");} - void MultiGridSolverVec::fixSolution(int level, int coarseLevel) {ERROR_EXIT("Will be rewritten - Peter\n");} - void MultiGridSolverVec::exactSolve(int level) {ERROR_EXIT("Will be rewritten - Peter\n");} - bool MultiGridSolverVec::toleranceReached(double tol) {ERROR_EXIT("Will be rewritten - Peter\n"); return true; } - void MultiGridSolverVec::initFullMultiGrid() {ERROR_EXIT("Will be rewritten - Peter\n");} - void MultiGridSolverVec::fmgInterpol(int level) {ERROR_EXIT("Will be rewritten - Peter\n");} - - -#if 0 - - MultiGridSolverScal::MultiGridSolverScal(const ::std::string &name) - : MultiGridSolverBase<DOFMatrix, DOFVector<double> >(name), - sparseResidual_(NULL), - denseResidual_(NULL), - lastRes_(1.0), - iteration_(0), - coarseSmoothingSteps_(2), - minLevelGap_(0), - maxMGLevels_(100), - interpolMatrix_(NULL), - restrictMatrix_(NULL), - galerkin_(0) - { - FUNCNAME("MultiGridSolverScal::MultiGridSolverScal()"); - - GET_PARAMETER(0, name_ + "->coarse level smoothing steps", "%d", &coarseSmoothingSteps_); - GET_PARAMETER(0, name_ + "->min level gap", "%d", &minLevelGap_); - GET_PARAMETER(0, name_ + "->max mg levels", "%d", &maxMGLevels_); - GET_PARAMETER(0, name_ + "->use galerkin operator", "%d", &galerkin_); - - // Create smoother - ::std::string smootherType("gs"); - GET_PARAMETER(0, name_ + "->smoother", &smootherType); - SmootherCreator<DOFMatrix, SparseVector<double>, ::std::set<DegreeOfFreedom> > *smootherCreator = - dynamic_cast<SmootherCreator<DOFMatrix, SparseVector<double>, ::std::set<DegreeOfFreedom> >*>( - CreatorMap<SmootherBase<DOFMatrix, SparseVector<double>, ::std::set<DegreeOfFreedom> > >::getCreator(smootherType)); - - if (smootherCreator && !smootherCreator->isNullCreator()) { - smootherCreator->setName(name_ + "->smoother"); - smoother_ = smootherCreator->create(); - } else { - smoother_ = NULL; - ERROR_EXIT("no smoother specified\n"); - } - } - - void MultiGridSolverScal::initMaxLevel() - { - FiniteElemSpace *feSpace = - const_cast<FiniteElemSpace*>(systemMatrix_->getFESpace()); - - TraverseStack st; - ElInfo *elInfo = st.traverseFirst(feSpace->getMesh(), -1, - Mesh::CALL_LEAF_EL); - maxLevel_ = -1; - while (elInfo) { - maxLevel_ = max(elInfo->getLevel(), maxLevel_); - elInfo = st.traverseNext(elInfo); - } - } - - void MultiGridSolverScal::initMultiGrid(bool initMG) - { - FUNCNAME("MultiGridSolverScal::initMultiGrid()"); - - iteration_ = 0; - - lastRes_ = 1.0; - - if (initMG) { - FiniteElemSpace *feSpace = - const_cast<FiniteElemSpace*>(systemMatrix_->getFESpace()); - - TEST_EXIT(!galerkin_ || feSpace->getBasisFcts()->getDegree() == 1) - ("galerkin coarse grid operator only for linear finite elements\n"); - - Mesh *mesh = feSpace->getMesh(); - - int dim = mesh->getDim(); - int degree = feSpace->getBasisFcts()->getDegree(); - - // Get the interpolation and restriction matrices that correspond to - // the element dim and to the degree of the basis functions. - interpolMatrix_ = interpolMatrices[dim - 1][degree - 1]; - restrictMatrix_ = restrictMatrices[dim - 1][degree - 1]; - - sparseResidual_ = NEW SparseVector<double>(feSpace, "sparse residual"); - denseResidual_ = NEW DOFVector<double>(feSpace, "dense residual"); - - int numLevels = maxLevel_ + 1; - - isMGLevel_.resize(numLevels, false); - isMGLevel_[minLevel_] = true; - isMGLevel_[maxLevel_] = true; - if (numLevels > 2) { - double step = (static_cast<double>(maxMGLevels_) - 2.0) / (numLevels - 2.0); - double sum = 0.0; - int gap = 0; - for (int i = maxLevel_ - 1; i > minLevel_; i--) { - sum += step; - //MSG("%d %f\n", i, sum); - ++gap; - if(gap > minLevelGap_ && sum >= 1.0) { - gap = 0; - isMGLevel_[i] = true; - sum -= 1.0; - } else { - MSG("level %d skipped\n", i); - } - } - } - - TEST_EXIT(mesh->queryCoarseDOFs())("preserve coarse dofs not set in mesh\n"); - - const BasisFunction *basFcts = feSpace->getBasisFcts(); - int numDOFs = basFcts->getNumber(); - - // Allocate memory for the multigrid levels. - levels_.resize(numLevels); - - // Fill all multigrid levels with initial data. - for (int i = 0; i < numLevels; i++) { - if (isMGLevel_[i]) { - levels_[i].solution_ = NEW SparseVector<double>(feSpace, "sparse level solution"); - levels_[i].oldSolution_ = NEW SparseVector<double>("old level solution", levels_[i].solution_); - levels_[i].rhs_ = NEW SparseVector<double>("sparse level rhs", levels_[i].solution_); - levels_[i].matrix_ = NEW DOFMatrix(feSpace, feSpace, "level matrix"); - levels_[i].matrix_->setBoundaryManager(systemMatrix_->getBoundaryManager()); - } - } - - // Here, for each DOF we save the highest mesh level on which it occurs. - DOFVector<int> maxDOFLevels(feSpace, "max dof levels"); - maxDOFLevels.set(minLevel_); - - DegreeOfFreedom *dofs = GET_MEMORY(DegreeOfFreedom, numDOFs); - Element *element; - DOFAdmin *admin = feSpace->getAdmin(); - int level; - - // Iterators for all operators of the system matrix. - ::std::vector<Operator*>::iterator it; - ::std::vector<Operator*>::iterator opBegin = systemMatrix_->getOperatorsBegin(); - ::std::vector<Operator*>::iterator opEnd = systemMatrix_->getOperatorsEnd(); - - ::std::vector<double*>::iterator factorIt; - ::std::vector<double*>::iterator factorBegin = systemMatrix_->getOperatorFactorBegin(); - ElementMatrix *elementMatrix = NULL; - const BoundaryType *bound; - - TraverseStack stack; - - // Fill level elements and max-dof-level for each DOF. - ElInfo *elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_EVERY_EL_PREORDER); - while (elInfo) { - element = elInfo->getElement(); - level = elInfo->getLevel(); - levels_[level].elements_.push_back(element); - if (dim == 3) { - levels_[level].elementTypes_.push_back(dynamic_cast<ElInfo3d*>(elInfo)->getType()); - } - basFcts->getLocalIndices(element, admin, dofs); - for (int i = 0; i < numDOFs; i++) { - maxDOFLevels[dofs[i]] = max(maxDOFLevels[dofs[i]], mgLevel(level)); - } - elInfo = stack.traverseNext(elInfo); - } - - - // Assemble level matrices and create DOF sets. - elInfo = stack.traverseFirst(mesh, -1, - Mesh::CALL_EVERY_EL_PREORDER | - Mesh::FILL_BOUND | - Mesh::FILL_DET | - Mesh::FILL_GRD_LAMBDA | - Mesh::FILL_COORDS | - Mesh::FILL_NEIGH); - while (elInfo) { - element = elInfo->getElement(); - level = elInfo->getLevel(); - basFcts->getLocalIndices(element, admin, dofs); - bound = basFcts->getBound(elInfo, NULL); - elementMatrix = (*opBegin)->getAssembler()->initElementMatrix(elementMatrix, elInfo); - - bool levelUsed = isMGLevel_[level]; - - // If the element is in a level that is a multigrid level, add all element - // matrices of this element to the level matrix. - if ((levelUsed) && (!galerkin_)) { - for (it = opBegin, factorIt = factorBegin; - it != opEnd; - ++it, ++factorIt) - { - (*it)->getElementMatrix(elInfo, - elementMatrix, - *factorIt ? **factorIt : 1.0); - } - - levels_[level].matrix_->addElementMatrix(1.0, *elementMatrix, bound); - } - - if (element->isLeaf()) { - // If the element is a leaf element, but this level is not a multigrid level, - // the element matrices are added to the next possible multigrid level. - if (!levelUsed) { - level = mgLevel(level); - if(!galerkin_) { - for(it = opBegin, factorIt = factorBegin; - it != opEnd; - ++it, ++factorIt) - { - (*it)->getElementMatrix(elInfo, - elementMatrix, - *factorIt ? **factorIt : 1.0); - } - levels_[level].matrix_->addElementMatrix(1.0, *elementMatrix, bound); - } - } - - // Add nearest neighbour element matrices and dofs - int maxDOFLevel = -1; - for (int i = 0; i < dim + 1; i++) { - maxDOFLevel = max(maxDOFLevel, maxDOFLevels[dofs[i]]); - } - - // There is a DOF of the element that is included in finer levels. - if (maxDOFLevel > level) { - if (!galerkin_) { - for (int j = level + 1; j < maxDOFLevel + 1; j++) { - if (isMGLevel_[j]) { - levels_[j].matrix_->addElementMatrix(1.0, *elementMatrix, bound); - } - } - } - for (int j = 0; j < numDOFs; j++) { - for (int k = level + 1; k < maxDOFLevel + 1; k++) { - if (isMGLevel_[k]) { - if (maxDOFLevels[dofs[j]] < k) { - levels_[k].nearestNeighbourDOFs_.insert(dofs[j]); - } - } - } - } - } - - for (int i = 0; i < numDOFs; i++) { - // If the element is a leaf element and the maximum level of one of - // its DOFs is equal to the current level, the DOF is not included - // in finer levels. - if (maxDOFLevels[dofs[i]] == level) { - levels_[level].coarseDOFs_.insert(dofs[i]); - } - } - } else { - // element is not leaf - if ((level >= minLevel_) && (levelUsed)) { - // The element is not a leaf element, therefore its DOFs are also - // included in finer levels. - for (int i = 0; i < numDOFs; i++) { - levels_[level].fineDOFs_.insert(dofs[i]); - } - } - } // if-else element is leaf - elInfo = stack.traverseNext(elInfo); - } // while elInfo - - if (!galerkin_) { - // Fill boundary conditions - if (systemMatrix_->getBoundaryManager()) { - systemMatrix_->getBoundaryManager()->initMatrix(systemMatrix_); - } - - TraverseStack stack; - ElInfo *elInfo = stack.traverseFirst(mesh, -1, - Mesh::CALL_LEAF_EL | - Mesh::FILL_BOUND | - Mesh::FILL_COORDS | - Mesh::FILL_DET | - Mesh::FILL_GRD_LAMBDA | - Mesh::FILL_NEIGH); - while (elInfo) { - if (systemMatrix_->getBoundaryManager()) { - systemMatrix_->getBoundaryManager()->fillBoundaryConditions(elInfo, - systemMatrix_); - } - - elInfo = stack.traverseNext(elInfo); - } - - if (systemMatrix_->getBoundaryManager()) { - systemMatrix_->getBoundaryManager()->exitMatrix(systemMatrix_); - } - } else { - // Galerkin operator - - DegreeOfFreedom *child0DOFs = GET_MEMORY(DegreeOfFreedom, dim + 1); - DegreeOfFreedom *parentDOFs = GET_MEMORY(DegreeOfFreedom, dim + 1); - - Vector<DegreeOfFreedom> fineDOFs(dim + 2); - Matrix<double> a(dim + 2, dim + 2); - - levels_[maxLevel_].matrix_->copy(*systemMatrix_); - - DOFMatrix tmp1(feSpace, feSpace, "tmp1"); - DOFMatrix tmp2(feSpace, feSpace, "tmp2"); - - DOFMatrix *coarseMatrix = NULL; - DOFMatrix *fineMatrix = levels_[maxLevel_].matrix_; - - for (level = maxLevel_ - 1; level >= minLevel_; level--) { - ::std::map< ::std::pair<int, int>, bool> visited; - - coarseMatrix = - isMGLevel_[level] ? - levels_[level].matrix_ : - (fineMatrix == &tmp1 ? &tmp2 : &tmp1); - - coarseMatrix->clear(); - - elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_EVERY_EL_PREORDER); - while(elInfo) { - Element *element = elInfo->getElement(); - - basFcts->getLocalIndices(element, admin, parentDOFs); - - for (int i = 0; i < dim + 1; i++) { - fineDOFs[i] = parentDOFs[i]; - } - - if(elInfo->getLevel() == level && !element->isLeaf()) { - - basFcts->getLocalIndices(element->getChild(0), admin, child0DOFs); - - fineDOFs[dim + 1] = child0DOFs[dim]; - - double *ptr; - - for (int i = 0; i < dim + 2; i++) { - for (int j = 0; j < dim + 2; j++) { - ptr = fineMatrix->hasSparseDOFEntry(fineDOFs[i], fineDOFs[j]); - a[i][j] = ptr ? *ptr : 0.0; - } - } - - for (int i = 0; i < dim + 1; i++) { - for (int j = 0; j < dim + 1; j++) { - if(visited[::std::pair<int, int>(fineDOFs[i], fineDOFs[j])] == false) - coarseMatrix->addSparseDOFEntry(1.0, - parentDOFs[i], - parentDOFs[j], - 0.0, - false); - } - } - - for (int i = 0; i < dim + 1; i++) { - for (int j = 0; j < dim + 1; j++) { - if(visited[::std::pair<int, int>(fineDOFs[i], fineDOFs[j])] == false) - coarseMatrix->addSparseDOFEntry(1.0, - parentDOFs[i], - parentDOFs[j], - a[i][j], - true); - } - } - - for (int i = 0; i < dim + 1; i++) { - for (int j = 0; j < 2; j++) { - if(visited[::std::pair<int, int>(fineDOFs[i], fineDOFs[dim + 1])] == false) { - coarseMatrix->addSparseDOFEntry(0.5, - parentDOFs[i], - parentDOFs[j], - a[i][dim + 1], - true); - - coarseMatrix->addSparseDOFEntry(0.5, - parentDOFs[j], - parentDOFs[i], - a[dim + 1][i], - true); - } - } - } - - if (visited[::std::pair<int, int>(fineDOFs[dim + 1], fineDOFs[dim + 1])] == false) { - for (int i = 0; i < 2; i++) { - for (int j = 0; j < 2; j++) { - coarseMatrix->addSparseDOFEntry(0.25, - parentDOFs[i], - parentDOFs[j], - a[dim + 1][dim + 1], - true); - } - } - } - - for (int i = 0; i < dim + 2; i++) { - for (int j = 0; j < dim + 2; j++) { - visited[::std::pair<int, int>(fineDOFs[i], fineDOFs[j])] = true; - visited[::std::pair<int, int>(fineDOFs[j], fineDOFs[i])] = true; - } - } - } - if (element->isLeaf() && elInfo->getLevel() <= level) { - double *ptr; - - for (int i = 0; i < dim + 1; i++) { - for (int j = 0; j < dim + 1; j++) { - ptr = fineMatrix->hasSparseDOFEntry(fineDOFs[i], fineDOFs[j]); - a[i][j] = ptr ? *ptr : 0.0; - } - } - - for (int i = 0; i < dim + 1; i++) { - for (int j = 0; j < dim + 1; j++) { - if (!visited[::std::pair<int, int>(parentDOFs[i], parentDOFs[j])]) { - coarseMatrix->addSparseDOFEntry(1.0, - parentDOFs[i], - parentDOFs[j], - a[i][j], - false); - } - } - } - } - elInfo = stack.traverseNext(elInfo); - } - fineMatrix = coarseMatrix; - } // for level - - FREE_MEMORY(child0DOFs, DegreeOfFreedom, dim + 1); - FREE_MEMORY(parentDOFs, DegreeOfFreedom, dim + 1); - } // if-else galerkin_ - - FREE_MEMORY(dofs, DegreeOfFreedom, numDOFs); - - // Copy in each level the to sets coarseDOFs and fineDOFs to one - // set levelDOFs containing all DOFs of the level. - for (int i = minLevel_; i < numLevels; i++) { - if (isMGLevel_[i]) { - levels_[i].levelDOFs_.insert(levels_[i].coarseDOFs_.begin(), - levels_[i].coarseDOFs_.end()); - levels_[i].levelDOFs_.insert(levels_[i].fineDOFs_.begin(), - levels_[i].fineDOFs_.end()); - } - } - } // if initMG - - // Compute start residual - mv(NoTranspose, *systemMatrix_, *solution_, *denseResidual_); - axpy(-1.0, *rhs_, *denseResidual_); - - // Compute 2-norm of the residual - double res = denseResidual_->nrm2(); - MSG("residual: %e\n", res); - lastRes_ = res; - - for (int i = 0; i <= maxLevel_; i++) { - if (isMGLevel_[i]) { - levels_[i].solution_->copyFromDOFVector(*solution_, - levels_[i].coarseDOFs_); - levels_[i].solution_->copyFromDOFVector(*solution_, - levels_[i].nearestNeighbourDOFs_); - } - } - - // Copy the rhs of the equation to the finest multigrid level - // restricted to its DOFs. - levels_[maxLevel_].rhs_->copyFromDOFVector(*rhs_, - levels_[maxLevel_].coarseDOFs_); - } - - - void MultiGridSolverScal::exitMultiGrid() - { - DELETE sparseResidual_; - DELETE denseResidual_; - - // Free memory - for (int i = 0; i < maxLevel_ + 1; i++) { - if (isMGLevel_[i]) { - DELETE levels_[i].matrix_; - DELETE levels_[i].rhs_; - DELETE levels_[i].oldSolution_; - DELETE levels_[i].solution_; - } - } - - levels_.resize(0); - isMGLevel_.resize(0); - } - - - void MultiGridSolverScal::smooth(int level, int steps) - { - smoother_->smooth(levels_[level].matrix_, - levels_[level].solution_, - levels_[level].rhs_, - steps, - levels_[level].levelDOFs_); - // DOFVector<double> sol(systemMatrix_->getFESpace(), "solution"); - // levels_[level].solution_->copyToDOFVector(sol); - // MacroWriter::writeMacro(systemMatrix_->getFESpace(), "sol.mesh", 0.0, level, Mesh::CALL_EL_LEVEL); - // ValueWriter::writeValues(&sol, "sol.dat", 0.0, level, Mesh::CALL_EL_LEVEL); - // MSG("smoothed %d\n", level); - // WAIT; - } - - - void MultiGridSolverScal::prolongate(int level, int coarseLevel) - { - for (int i = coarseLevel; i < level; i++) { - interpolMatrix_->mv(sparseResidual_, - sparseResidual_, - i); - } - // DOFVector<double> cor(systemMatrix_->getFESpace(), "correction"); - // sparseResidual_->copyToDOFVector(cor); - // MacroWriter::writeMacro(systemMatrix_->getFESpace(), "cor.mesh", 0.0, coarseLevel, Mesh::CALL_EL_LEVEL); - // ValueWriter::writeValues(&cor, "cor.dat", 0.0, coarseLevel, Mesh::CALL_EL_LEVEL); - // MSG("prolongated %d\n", level); - // WAIT; - } - - - void MultiGridSolverScal::restrict(int level, int coarseLevel) - { - // MSG("%d\n", level); - // if(isMGLevel_[level]) levels_[level].rhs_->print(); - - // Copy the old solution to the coarser grid. - levels_[coarseLevel].oldSolution_->copy(*(levels_[level].solution_), - levels_[level].levelDOFs_); - levels_[coarseLevel].oldSolution_->copy(*(levels_[level].solution_), - levels_[level].nearestNeighbourDOFs_); - - ::std::vector<Element*>::iterator elIt, elBegin, elEnd; - ::std::vector<int>::iterator typeIt; - - for (int i = level; i > coarseLevel; i--) { - elBegin = levels_[i-1].elements_.begin(); - elEnd = levels_[i-1].elements_.end(); - typeIt = levels_[i-1].elementTypes_.begin(); - - // Restrict the old solution to the DOFs of the coarser gird. - for (elIt = elBegin; elIt != elEnd; ++elIt) { - Element *element = *elIt; - if (!element->isLeaf()) { - RCNeighbourList list(1); - list.setElement(0, element); - if (element->getMesh()->getDim() == 3) { - list.setType(0, levels_[i-1].elementTypes_[*typeIt]); - ++typeIt; - } - levels_[coarseLevel].oldSolution_->coarseRestrict(list, 1); - } - } - - // Restrict the residual - restrictMatrix_->mv(sparseResidual_, - sparseResidual_, - i - 1); - - // Alternative: use restriction matrix to restrict the old solution. - // restrictMatrix_->mv(levels_[coarseLevel].oldSolution_, - // levels_[coarseLevel].oldSolution_, - // i-1); - } - - - levels_[coarseLevel].solution_->copy(*(levels_[coarseLevel].oldSolution_), - levels_[coarseLevel].fineDOFs_); - - // DOFVector<double> res(systemMatrix_->getFESpace(), "residual"); - // sparseResidual_->copyToDOFVector(res); - // MacroWriter::writeMacro(systemMatrix_->getFESpace(), "res.mesh", 0.0, coarseLevel, Mesh::CALL_EL_LEVEL); - // ValueWriter::writeValues(&res, "res.dat", 0.0, coarseLevel, Mesh::CALL_EL_LEVEL); - // DOFVector<double> sol(systemMatrix_->getFESpace(), "solution"); - // levels_[coarseLevel].oldSolution_->copyToDOFVector(sol); - // MacroWriter::writeMacro(systemMatrix_->getFESpace(), "sol.mesh", 0.0, coarseLevel, Mesh::CALL_EL_LEVEL); - // ValueWriter::writeValues(&sol, "sol.dat", 0.0, coarseLevel, Mesh::CALL_EL_LEVEL); - // MSG("residual and solution restricted %d\n", level); - // WAIT; - } - - - void MultiGridSolverScal::computeResidual(int level, int coarseLevel) - { - mv(*(levels_[level].matrix_), - *(levels_[level].solution_), - *sparseResidual_, - levels_[level].levelDOFs_); - - axpy(-1.0, - *(levels_[level].rhs_), - *sparseResidual_, - levels_[level].levelDOFs_); - - // DOFVector<double> res(systemMatrix_->getFESpace(), "residual"); - // sparseResidual_->copyToDOFVector(res); - // MacroWriter::writeMacro(systemMatrix_->getFESpace(), "res.mesh", 0.0, level, Mesh::CALL_EL_LEVEL); - // ValueWriter::writeValues(&res, "res.dat", 0.0, level, Mesh::CALL_EL_LEVEL); - // MSG("residual computed %d\n", level); - // WAIT; - } - - - void MultiGridSolverScal::computeRHS(int level, int coarseLevel) - { - // First compute rhs without considering boundary conditions. - mv(*(levels_[coarseLevel].matrix_), - *(levels_[coarseLevel].oldSolution_), - *(levels_[coarseLevel].rhs_), - levels_[coarseLevel].fineDOFs_); - - axpy(-1.0, - *sparseResidual_, - *(levels_[coarseLevel].rhs_), - levels_[coarseLevel].fineDOFs_); - - levels_[coarseLevel].rhs_->copyFromDOFVector(*rhs_, - levels_[coarseLevel].coarseDOFs_); - - - // Then add boundary conditions to the solution. - if (!galerkin_) { - Mesh *mesh = rhs_->getFESpace()->getMesh(); - - if(rhs_->getBoundaryManager()) { - rhs_->getBoundaryManager()->initVector(levels_[coarseLevel].rhs_); - } - - TraverseStack stack; - ElInfo *elInfo = stack.traverseFirst(mesh, -1, - Mesh::CALL_EVERY_EL_PREORDER | - Mesh::FILL_BOUND | - Mesh::FILL_DET | - Mesh::FILL_GRD_LAMBDA | - Mesh::FILL_COORDS); - - while (elInfo) { - if (rhs_->getBoundaryManager()) - rhs_->getBoundaryManager()->fillBoundaryConditions(elInfo, - levels_[coarseLevel].rhs_); - elInfo = stack.traverseNext(elInfo); - } - - if (rhs_->getBoundaryManager()) { - rhs_->getBoundaryManager()->exitVector(levels_[coarseLevel].rhs_); - } - } - - // MSG("%d\n", level); - // levels_[level].matrix_->print(); - // levels_[level].solution_->print(); - // levels_[level].rhs_->print(); - // MSG("%d\n", coarseLevel); - // levels_[coarseLevel].matrix_->print(); - // levels_[coarseLevel].solution_->print(); - // levels_[coarseLevel].rhs_->print(); - - // DOFVector<double> rhs(systemMatrix_->getFESpace(), "rhs"); - // levels_[coarseLevel].rhs_->copyToDOFVector(rhs); - // MacroWriter::writeMacro(systemMatrix_->getFESpace(), "rhs.mesh", 0.0, coarseLevel, Mesh::CALL_EL_LEVEL); - // ValueWriter::writeValues(&rhs, "rhs.dat", 0.0, coarseLevel, Mesh::CALL_EL_LEVEL); - // MacroWriter::writeMacro(systemMatrix_->getFESpace(), "realrhs.mesh"); - // ValueWriter::writeValues(rhs_, "realrhs.dat"); - // MSG("rhs computed %d\n", level); - // WAIT; - } - - - void MultiGridSolverScal::computeCorrection(int level, int coarseLevel) - { - sparseResidual_->copy(*(levels_[coarseLevel].solution_), - levels_[coarseLevel].fineDOFs_); - axpy(-1.0, - *(levels_[coarseLevel].oldSolution_), - *sparseResidual_, - levels_[coarseLevel].fineDOFs_); - - // DOFVector<double> cor(systemMatrix_->getFESpace(), "correction"); - // sparseResidual_->copyToDOFVector(cor); - // MacroWriter::writeMacro(systemMatrix_->getFESpace(), "cor.mesh", 0.0, coarseLevel, Mesh::CALL_EL_LEVEL); - // ValueWriter::writeValues(&cor, "cor.dat", 0.0, coarseLevel, Mesh::CALL_EL_LEVEL); - // MSG("correction computed %d\n", level); - // WAIT; - } - - - void MultiGridSolverScal::fixSolution(int level, int coarseLevel) - { - levels_[level].solution_->copy(*(levels_[coarseLevel].solution_), - levels_[level].nearestNeighbourDOFs_); - - axpy(1.0, - *sparseResidual_, - *(levels_[level].solution_), - levels_[level].levelDOFs_); - - // DOFVector<double> sol(systemMatrix_->getFESpace(), "solution"); - // levels_[level].solution_->copyToDOFVector(sol); - // MacroWriter::writeMacro(systemMatrix_->getFESpace(), "sol.mesh", 0.0, level, Mesh::CALL_EL_LEVEL); - // ValueWriter::writeValues(&sol, "sol.dat", 0.0, level, Mesh::CALL_EL_LEVEL); - // MSG("solution fixed %d\n", level); - // WAIT; - } - - - void MultiGridSolverScal::exactSolve(int level) - { - smooth(level, coarseSmoothingSteps_); - } - - - bool MultiGridSolverScal::toleranceReached(double tol) - { - FUNCNAME("MultiGridSolver::toleranceReached()"); - - for (int level = minLevel_; level < maxLevel_ + 1; level++) { - if (isMGLevel_[level]) { - levels_[level].solution_->copyToDOFVector(*solution_, - levels_[level].coarseDOFs_); - } - } - - mv(NoTranspose, *systemMatrix_, *solution_, *denseResidual_); - axpy(-1.0, *rhs_, *denseResidual_); - - ++iteration_; - - double res = denseResidual_->nrm2(); - MSG("iteration %d - residual: %e (res / lastRes : %e)\n", - iteration_, res, res/lastRes_); - - lastRes_ = res; - - // levelMatrices_[maxLevel_]->print(); - - // systemMatrix_->print(); - - // MacroWriter::writeMacro(systemMatrix_->getFESpace(), "sol_iter.mesh"); - // ValueWriter::writeValues(solution_, "sol_iter.dat"); - // MacroWriter::writeMacro(systemMatrix_->getFESpace(), "res_iter.mesh"); - // ValueWriter::writeValues(denseResidual_, "res_iter.dat"); - // WAIT; - - return (res < tol); - } - - - void MultiGridSolverScal::initFullMultiGrid() - { - int coarseLevel = -1; - - for (int i = maxLevel_; i > minLevel_; i--) { - if (isMGLevel_[i]) { - coarseLevel = coarserLevel(i); - levels_[coarseLevel].rhs_->copy(*(levels_[i].rhs_), - levels_[coarseLevel].fineDOFs_); - } - - TraverseStack stack; - ElInfo *elInfo = stack.traverseFirst(sparseResidual_->getFESpace()->getMesh(), - -1, Mesh::CALL_EVERY_EL_PREORDER); - while (elInfo) { - Element *element = elInfo->getElement(); - if (elInfo->getLevel() == (i-1) && !element->isLeaf()) { - RCNeighbourList list(1); - list.setElement(0, element); - if (element->getMesh()->getDim() == 3) { - list.setType(0, dynamic_cast<ElInfo3d*>(elInfo)->getType()); - } - levels_[coarseLevel].rhs_->coarseRestrict(list, 1); - } - elInfo = stack.traverseNext(elInfo); - } - } - } - - - void MultiGridSolverScal::fmgInterpol(int level) - { - int coarseLevel = level-1; - - levels_[level].solution_->copy(*(levels_[coarseLevel].solution_), - levels_[coarseLevel].fineDOFs_); - - for (int i = coarseLevel; i < level; i++) { - - TraverseStack stack; - ElInfo *elInfo = stack.traverseFirst(sparseResidual_->getFESpace()->getMesh(), - -1, Mesh::CALL_EVERY_EL_PREORDER); - while(elInfo) { - Element *element = elInfo->getElement(); - if(elInfo->getLevel() == (i) && !element->isLeaf()) { - RCNeighbourList list(1); - list.setElement(0, element); - if(element->getMesh()->getDim() == 3) { - list.setType(0, dynamic_cast<ElInfo3d*>(elInfo)->getType()); - } - levels_[level].solution_->refineInterpol(list, 1); - } - elInfo = stack.traverseNext(elInfo); - } - } - } - - // =============================================================================== - // =============================================================================== - // =============================================================================== - // =============================================================================== - - MultiGridSolverVec::MultiGridSolverVec(const ::std::string &name) - : MultiGridSolverBase<Matrix<DOFMatrix*>, SystemVector>(name), - sparseResidual_(NULL), - denseResidual_(NULL), - lastRes_(1.0), - iteration_(0), - coarseSmoothingSteps_(3), - minLevelGap_(0), - maxMGLevels_(100), - numComponents_(0), - boxSmoothing_(false), - boxDOFs_(0), - galerkin_(0) - { - FUNCNAME("MultiGridSolverVec::MultiGridSolverVec()"); - - GET_PARAMETER(0, name_ + "->coarse level smoothing steps", "%d", - &coarseSmoothingSteps_); - GET_PARAMETER(0, name_ + "->min level gap", "%d", &minLevelGap_); - GET_PARAMETER(0, name_ + "->max mg levels", "%d", &maxMGLevels_); - GET_PARAMETER(0, name_ + "->use galerkin operator", "%d", &galerkin_); - - // Create smoother - ::std::string smootherType("gs"); - GET_PARAMETER(0, name_ + "->smoother", &smootherType); - if(smootherType == "box") { - boxSmoothing_ = true; - } - SmootherCreator<Matrix<DOFMatrix*>, Vector<SparseVector<double>*>, Vector< ::std::set<DegreeOfFreedom>*> > *smootherCreator = - dynamic_cast<SmootherCreator<Matrix<DOFMatrix*>, Vector<SparseVector<double>*>, Vector< ::std::set<DegreeOfFreedom>*> >*>( - CreatorMap<SmootherBase<Matrix<DOFMatrix*>, Vector<SparseVector<double>*>, Vector< ::std::set<DegreeOfFreedom>*> > >::getCreator(smootherType) - ); - if(smootherCreator && !smootherCreator->isNullCreator()) { - smootherCreator->setName(name_ + "->smoother"); - smoother_ = smootherCreator->create(); - } else { - smoother_ = NULL; - ERROR_EXIT("no smoother specified\n"); - } - } - - void MultiGridSolverVec::initMaxLevel() - { - int comp, numComps = solution_->getNumVectors(); - ::std::set<Mesh*> meshes; - for(comp = 0; comp < numComps; comp++) { - Mesh *mesh = solution_->getDOFVector(comp)->getFESpace()->getMesh(); - if(find(meshes.begin(), meshes.end(), mesh) == meshes.end()) { - meshes.insert(mesh); - TraverseStack st; - ElInfo *elInfo = st.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL); - maxLevel_ = -1; - while(elInfo) { - maxLevel_ = max(elInfo->getLevel(), maxLevel_); - elInfo = st.traverseNext(elInfo); - } - } - } - } - - void MultiGridSolverVec::initMultiGrid(bool initMG) - { - int numLevels = maxLevel_ + 1; - - if (initMG) { - // Get number of components - numComponents_ = solution_->getNumVectors(); - - TEST_EXIT(rhs_->getNumVectors() == numComponents_) - ("invalid number of components\n"); - TEST_EXIT(systemMatrix_->getNumRows() == numComponents_) - ("invalid number of components\n"); - TEST_EXIT(systemMatrix_->getNumCols() == numComponents_) - ("invalid number of components\n"); - - // Get fe spaces and create residual vectors - sparseResidual_ = NEW Vector<SparseVector<double>*>(numComponents_); - ::std::vector<FiniteElemSpace*> feSpaces(numComponents_); - for (int i = 0; i < numComponents_; i++) { - feSpaces[i] = const_cast<FiniteElemSpace*> - (solution_->getDOFVector(i)->getFESpace()); - (*sparseResidual_)[i] = NEW SparseVector<double>(feSpaces[i], - "sparse residual"); - } - - // Create dens residual vectors - denseResidual_ = NEW SystemVector("dense residual", - feSpaces, - numComponents_); - for (int i = 0; i < numComponents_; i++) { - denseResidual_->setDOFVector(i, NEW DOFVector<double>(feSpaces[i], - "dense residual")); - } - - Mesh *mesh = feSpaces[0]->getMesh(); - int dim = mesh->getDim(); - - TEST_EXIT(mesh->queryCoarseDOFs()) - ("preserve coarse dofs not set in mesh\n"); - - - // Check which level is a multigrid level and set the corresponding field - // to true. - isMGLevel_.resize(numLevels, false); - isMGLevel_[minLevel_] = true; - isMGLevel_[maxLevel_] = true; - if (numLevels > 2) { - double step = (static_cast<double>(maxMGLevels_) - 2.0) / (numLevels - 2.0); - double sum = 0.0; - int gap = 0; - for (int i = maxLevel_ - 1; i > minLevel_; i--) { - sum += step; - //MSG("%d %f\n", i, sum); - ++gap; - if (gap > minLevelGap_ && sum >= 1.0) { - gap = 0; - isMGLevel_[i] = true; - sum -= 1.0; - } else { - MSG("level %d skipped\n", i); - } - } - } - - levels_.resize(numLevels); - - // Create multigrid level data. - for (int i = 0; i < numLevels; i++) { - if (isMGLevel_[i]) { - levels_[i].components_.resize(numComponents_); - levels_[i].levelDOFs_.resize(numComponents_); - - ::std::map<FiniteElemSpace*, FESpaceData*> feSpaceData; - MeshData *meshData = NEW MeshData; - - levels_[i].solution_ = NEW Vector<SparseVector<double>*>(numComponents_); - levels_[i].oldSolution_ = NEW Vector<SparseVector<double>*>(numComponents_); - levels_[i].rhs_ = NEW Vector<SparseVector<double>*>(numComponents_); - levels_[i].matrix_ = NEW Matrix<DOFMatrix*>(numComponents_, - numComponents_); - - // Set component dependend data. - for (int j = 0; j < numComponents_; j++) { - if (!feSpaceData[feSpaces[j]]) { - feSpaceData[feSpaces[j]] = NEW FESpaceData; - } - levels_[i].components_[j].meshData_ = meshData; - levels_[i].components_[j].feSpaceData_ = feSpaceData[feSpaces[j]]; - - levels_[i].levelDOFs_[j] = &(feSpaceData[feSpaces[j]]->levelDOFs_); - - (*(levels_[i].solution_))[j] = - NEW SparseVector<double>(feSpaces[j], "sparse level solution"); - (*(levels_[i].oldSolution_))[j] = - NEW SparseVector<double>("old level solution", - (*(levels_[i].solution_))[j]); - (*(levels_[i].rhs_))[j] = - NEW SparseVector<double>("sparse level rhs", - (*(levels_[i].solution_))[j]); - - for (int k = 0; k < numComponents_; k++) { - if ((*systemMatrix_)[j][k]) { - (*(levels_[i].matrix_))[j][k] = NEW DOFMatrix(feSpaces[j], - feSpaces[k], - "level matrix"); - (*(levels_[i].matrix_))[j][k]-> - setBoundaryManager((*(systemMatrix_))[j][k]-> - getBoundaryManager()); - if (j != k) { - (*(levels_[i].matrix_))[j][k]->setCoupleMatrix(true); - } - } else { - (*(levels_[i].matrix_))[j][k] = NULL; - } - } - } - } // if isMGLevel_[i] - } // for numLevels - - - int degree; - - interpolMatrix_.resize(numComponents_); - restrictMatrix_.resize(numComponents_); - - // Assemble matrices - for (int row = 0; row < numComponents_; row++) { - const BasisFunction* basFcts = feSpaces[row]->getBasisFcts(); - int numDOFs = basFcts->getNumber(); - - degree = basFcts->getDegree(); - - interpolMatrix_[row] = interpolMatrices[dim-1][degree-1]; - restrictMatrix_[row] = restrictMatrices[dim-1][degree-1]; - - DegreeOfFreedom *dofs = GET_MEMORY(DegreeOfFreedom, numDOFs); - Element *element; - DOFAdmin *admin = feSpaces[row]->getAdmin(); - int level; - - TraverseStack stack; - - // fill max dof level for each dof - DOFVector<int> maxDOFLevels(feSpaces[row], "maxDOFLevel"); - maxDOFLevels.set(minLevel_); - ElInfo *elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_EVERY_EL_PREORDER); - while (elInfo) { - element = elInfo->getElement(); - level = elInfo->getLevel(); - - if (row == 0) { - levels_[level].elements_.push_back(element); - } - if (dim == 3) { - levels_[level].elementTypes_. - push_back(dynamic_cast<ElInfo3d*>(elInfo)->getType()); - } - - - basFcts->getLocalIndices(element, admin, dofs); - for (int i = 0; i < numDOFs; i++) { - maxDOFLevels[dofs[i]] = max(maxDOFLevels[dofs[i]], - level); - } - elInfo = stack.traverseNext(elInfo); - } - - for (int col = 0; col < numComponents_; col++) { - DOFMatrix *dofMatrix = (*systemMatrix_)[row][col]; - if(dofMatrix) { - ::std::vector<Operator*>::iterator it; - ::std::vector<Operator*>::iterator opBegin = dofMatrix->getOperatorsBegin(); - ::std::vector<Operator*>::iterator opEnd = dofMatrix->getOperatorsEnd(); - ::std::vector<double*>::iterator factorIt; - ::std::vector<double*>::iterator factorBegin = dofMatrix->getOperatorFactorBegin(); - ElementMatrix *elementMatrix = NULL; - const BoundaryType *bound; - - // assemble level matrices and create dof sets - elInfo = stack.traverseFirst(mesh, -1, - Mesh::CALL_EVERY_EL_PREORDER | - Mesh::FILL_BOUND | - Mesh::FILL_DET | - Mesh::FILL_GRD_LAMBDA | - Mesh::FILL_COORDS); - - while (elInfo) { - element = elInfo->getElement(); - level = elInfo->getLevel(); - basFcts->getLocalIndices(element, admin, dofs); - bound = basFcts->getBound(elInfo, NULL); - elementMatrix = (*opBegin)->getAssembler()->initElementMatrix(elementMatrix, elInfo); - - bool levelUsed = isMGLevel_[level]; - if (levelUsed) { - for (it = opBegin, factorIt = factorBegin; - it != opEnd; - ++it, ++factorIt) - { - (*it)->getElementMatrix(elInfo, - elementMatrix, - *factorIt ? **factorIt : 1.0); - } - - (*(levels_[level].matrix_))[row][col]-> - addElementMatrix(1.0, *elementMatrix, bound); - } - - if (element->isLeaf()) { - if (!levelUsed) { - level = mgLevel(level); - for (it = opBegin, factorIt = factorBegin; - it != opEnd; - ++it, ++factorIt) - { - (*it)->getElementMatrix(elInfo, - elementMatrix, - *factorIt ? **factorIt : 1.0); - } - //MSG("element %d added to level %d\n", element->getIndex(), level); - (*(levels_[level].matrix_))[row][col]-> - addElementMatrix(1.0, *elementMatrix, bound); - } - - // add nearest neighbour element matrices and dofs - int maxDOFLevel = -1; - for (int i = 0; i < dim + 1; i++) { - maxDOFLevel = max(maxDOFLevel, mgLevel(maxDOFLevels[dofs[i]])); - } - - if (maxDOFLevel > level) { - for (int j = level + 1; j < maxDOFLevel + 1; j++) { - if (isMGLevel_[j]) { - (*(levels_[j].matrix_))[row][col]-> - addElementMatrix(1.0, *elementMatrix, bound); - } - } - if (row == col) { - for (int j = 0; j < numDOFs; j++) { - for (int k = level + 1; k < maxDOFLevel + 1; k++) { - if (isMGLevel_[k]) { - if (mgLevel(maxDOFLevels[dofs[j]]) < k) { - levels_[k].components_[row].feSpaceData_-> - nearestNeighbourDOFs_.insert(dofs[j]); - //MSG("level %d comp %d nn: %d\n", k, row, dofs[j]); - } - } - } - } - } - } - if (row == col) { - for (int i = 0; i < numDOFs; i++) { - if (mgLevel(maxDOFLevels[dofs[i]]) == level) { - levels_[level].components_[row].feSpaceData_-> - coarseDOFs_.insert(dofs[i]); - levels_[level].components_[row].feSpaceData_-> - levelDOFs_.insert(dofs[i]); - //MSG("level %d comp %d coarse: %d\n", level, row, dofs[i]); - } - } - } - } else { // element is not leaf - if (row == col) { - if (level >= minLevel_) { - if (levelUsed) { - for (int i = 0; i < numDOFs; i++) { - levels_[level].components_[row].feSpaceData_-> - fineDOFs_.insert(dofs[i]); - levels_[level].components_[row].feSpaceData_-> - levelDOFs_.insert(dofs[i]); - //MSG("level %d comp %d fine: %d\n", level, row, dofs[i]); - } - } - } - } - } - elInfo = stack.traverseNext(elInfo); - } - } - } - - FREE_MEMORY(dofs, DegreeOfFreedom, numDOFs); - } - - if (galerkin_) { - int level; - TraverseStack stack; - ElInfo *elInfo; - const FiniteElemSpace *feSpace = feSpaces[0]; - const BasisFunction *basFcts = feSpace->getBasisFcts(); - DOFAdmin *admin = feSpace->getAdmin(); - Mesh *mesh = feSpace->getMesh(); - - for (int row = 0; row < numComponents_; row++) { - for (int col = 0; col < numComponents_; col++) { - if ((*(levels_[maxLevel_].matrix_))[row][col]) { - (*(levels_[maxLevel_].matrix_))[row][col]->copy(*((*systemMatrix_)[row][col])); - } - } - } - - DegreeOfFreedom *child0DOFs = GET_MEMORY(DegreeOfFreedom, dim + 1); - DegreeOfFreedom *parentDOFs = GET_MEMORY(DegreeOfFreedom, dim + 1); - - Vector<DegreeOfFreedom> fineDOFs(dim + 2); - Matrix<double> a(dim + 2, dim + 2); - - DOFMatrix tmp1(feSpace, feSpace, "tmp1"); - DOFMatrix tmp2(feSpace, feSpace, "tmp2"); - - DOFMatrix *coarseMatrix = NULL; - DOFMatrix *fineMatrix = NULL; - - for (int row = 0; row < numComponents_; row++) { - for (int col = 0; col < numComponents_; col++) { - if ((*systemMatrix_)[row][col]) { - fineMatrix = (*(levels_[maxLevel_].matrix_))[row][col]; - - for (level = maxLevel_ - 1; level >= 0; level--) { - if (level >= minLevel_) { - - ::std::map< ::std::pair<int, int>, bool> visited; - coarseMatrix = - isMGLevel_[level] ? - (*(levels_[level].matrix_))[row][col] : - (fineMatrix == &tmp1 ? &tmp2 : &tmp1); - - coarseMatrix->clear(); - - elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_EVERY_EL_PREORDER); - while (elInfo) { - Element *element = elInfo->getElement(); - - basFcts->getLocalIndices(element, admin, parentDOFs); - - for (int i = 0; i < dim + 1; i++) { - fineDOFs[i] = parentDOFs[i]; - } - - if (elInfo->getLevel() == level && !element->isLeaf()) { - basFcts->getLocalIndices(element->getChild(0), admin, child0DOFs); - - fineDOFs[dim + 1] = child0DOFs[dim]; - - double *ptr; - - for (int i = 0; i < dim + 2; i++) { - for (int j = 0; j < dim + 2; j++) { - ptr = fineMatrix->hasSparseDOFEntry(fineDOFs[i], fineDOFs[j]); - a[i][j] = ptr ? *ptr : 0.0; - } - } - - for (int i = 0; i < dim + 1; i++) { - for(int j = 0; j < dim + 1; j++) { - if (visited[::std::pair<int, int>(fineDOFs[i], fineDOFs[j])] == false) { - coarseMatrix->addSparseDOFEntry(1.0, - parentDOFs[i], - parentDOFs[j], - 0.0, - false); - } - } - } - - for (int i = 0; i < dim + 1; i++) { - for (int j = 0; j < dim + 1; j++) { - if (visited[::std::pair<int, int>(fineDOFs[i], fineDOFs[j])] == false) { - coarseMatrix->addSparseDOFEntry(1.0, - parentDOFs[i], - parentDOFs[j], - a[i][j], - true); - } - } - } - - for (int i = 0; i < dim + 1; i++) { - for (int j = 0; j < 2; j++) { - if (visited[::std::pair<int, int>(fineDOFs[i], fineDOFs[dim + 1])] == false) { - coarseMatrix->addSparseDOFEntry(0.5, - parentDOFs[i], - parentDOFs[j], - a[i][dim + 1], - true); - - coarseMatrix->addSparseDOFEntry(0.5, - parentDOFs[j], - parentDOFs[i], - a[dim + 1][i], - true); - } - } - } - - if (visited[::std::pair<int, int>(fineDOFs[dim + 1], fineDOFs[dim + 1])] == false) { - for (int i = 0; i < 2; i++) { - for (int j = 0; j < 2; j++) { - coarseMatrix->addSparseDOFEntry(0.25, - parentDOFs[i], - parentDOFs[j], - a[dim + 1][dim + 1], - true); - } - } - } - - for (int i = 0; i < dim + 2; i++) { - for (int j = 0; j < dim + 2; j++) { - visited[::std::pair<int, int>(fineDOFs[i], fineDOFs[j])] = true; - visited[::std::pair<int, int>(fineDOFs[j], fineDOFs[i])] = true; - } - } - } - - if (element->isLeaf() && elInfo->getLevel() <= level) { - double *ptr; - - for (int i = 0; i < dim + 1; i++) { - for (int j = 0; j < dim + 1; j++) { - ptr = fineMatrix->hasSparseDOFEntry(fineDOFs[i], fineDOFs[j]); - a[i][j] = ptr ? *ptr : 0.0; - } - } - - for (int i = 0; i < dim + 1; i++) { - for (int j = 0; j < dim + 1; j++) { - if (!visited[::std::pair<int, int>(parentDOFs[i], parentDOFs[j])]) { - coarseMatrix->addSparseDOFEntry(1.0, - parentDOFs[i], - parentDOFs[j], - a[i][j], - false); - } - } - } - } - elInfo = stack.traverseNext(elInfo); - } - fineMatrix = coarseMatrix; - } - } - } - } - } - - FREE_MEMORY(child0DOFs, DegreeOfFreedom, dim + 1); - FREE_MEMORY(parentDOFs, DegreeOfFreedom, dim + 1); - } - - if (boxSmoothing_) { - boxDOFs_.resize(numComponents_); - for (int i = 0; i < numComponents_; i++) { - boxDOFs_[i] = new ::std::set<DegreeOfFreedom>; - } - } - - } - - - iteration_ = 0; - - lastRes_ = 1.0; - - // compute start residual - mv(*systemMatrix_, *solution_, *denseResidual_); - axpy(-1.0, *rhs_, *denseResidual_); - - double res = norm(denseResidual_); - MSG("residual: %e\n", res); - lastRes_ = res; - - for (int row = 0; row < numComponents_; row++) { - for (int i = 0; i < numLevels; i++) { - if (isMGLevel_[i]) { - (*(levels_[i].solution_))[row]-> - copyFromDOFVector(*(solution_->getDOFVector(row)), - levels_[i].components_[row].feSpaceData_->coarseDOFs_); - (*(levels_[i].solution_))[row]-> - copyFromDOFVector(*(solution_->getDOFVector(row)), - levels_[i].components_[row].feSpaceData_->nearestNeighbourDOFs_); - } - } - - - (*(levels_[maxLevel_].rhs_))[row]-> - copyFromDOFVector(*(rhs_->getDOFVector(row)), - levels_[maxLevel_].components_[row].feSpaceData_->coarseDOFs_); - } - } - - - void MultiGridSolverVec::exitMultiGrid() - { - int numLevels = maxLevel_ + 1; - - ::std::set<FESpaceData*> deletedFESpaceData; - ::std::set<MeshData*> deletedMeshData; - - for (int i = 0; i < numLevels; i++) { - if (isMGLevel_[i]) { - for (int j = 0; j < numComponents_; j++) { - if (levels_[i].components_[j].meshData_) { - ::std::set<MeshData*>::iterator it; - it = ::std::find(deletedMeshData.begin(), - deletedMeshData.end(), - levels_[i].components_[j].meshData_); - if (it == deletedMeshData.end()) { - deletedMeshData.insert(levels_[i].components_[j].meshData_); - DELETE levels_[i].components_[j].meshData_; - levels_[i].components_[j].meshData_ = NULL; - } - } - if (levels_[i].components_[j].feSpaceData_) { - ::std::set<FESpaceData*>::iterator it; - it = ::std::find(deletedFESpaceData.begin(), - deletedFESpaceData.end(), - levels_[i].components_[j].feSpaceData_); - if (it == deletedFESpaceData.end()) { - deletedFESpaceData.insert(levels_[i].components_[j].feSpaceData_); - DELETE levels_[i].components_[j].feSpaceData_; - levels_[i].components_[j].feSpaceData_ = NULL; - } - } - DELETE (*(levels_[i].oldSolution_))[j]; - DELETE (*(levels_[i].rhs_))[j]; - DELETE (*(levels_[i].solution_))[j]; - - for (int k = 0; k < numComponents_; k++) { - if ((*(levels_[i].matrix_))[j][k]) { - DELETE (*(levels_[i].matrix_))[j][k]; - } - } - } - DELETE levels_[i].oldSolution_; - DELETE levels_[i].solution_; - DELETE levels_[i].rhs_; - DELETE levels_[i].matrix_; - } - } - levels_.resize(0); - isMGLevel_.resize(0); - - if (boxSmoothing_) { - for (int i = 0; i < numComponents_; i++) { - delete boxDOFs_[i]; - } - boxDOFs_.resize(0); - } - - for (int i = 0; i < numComponents_; i++) { - DELETE (*sparseResidual_)[i]; - DELETE denseResidual_->getDOFVector(i); - } - DELETE sparseResidual_; - DELETE denseResidual_; - - numComponents_ = 0; - } - - - void MultiGridSolverVec::smooth(int level, int steps) - { - if (boxSmoothing_) { - for (int iteration = 0; iteration < steps; iteration++) { - ::std::vector<Element*>::iterator elIt, elBegin, elEnd; - elBegin = levels_[level].elements_.begin(); - elEnd = levels_[level].elements_.end(); - for (elIt = elBegin; elIt != elEnd; ++elIt) { - Element *element = *elIt; - for (int i = 0; i < numComponents_; i++) { - boxDOFs_[i]->clear(); - const FiniteElemSpace *feSpace = - (*(levels_[level].solution_))[i]->getFESpace(); - int numDOFs = feSpace->getBasisFcts()->getNumber(); - DOFAdmin *admin = feSpace->getAdmin(); - DegreeOfFreedom *dofs = GET_MEMORY(DegreeOfFreedom, numDOFs); - feSpace->getBasisFcts()->getLocalIndices(element, - admin, - dofs); - for (int j = 0; j < numDOFs; j++) { - boxDOFs_[i]->insert(dofs[j]); - } - FREE_MEMORY(dofs, DegreeOfFreedom, numDOFs); - } - - smoother_->smooth(levels_[level].matrix_, - levels_[level].solution_, - levels_[level].rhs_, - 1, - boxDOFs_); - } - } - } else { - smoother_->smooth(levels_[level].matrix_, - levels_[level].solution_, - levels_[level].rhs_, - steps, - levels_[level].levelDOFs_); - - } - - // DOFVector<double> sol0((*(systemMatrix_))[0][0]->getFESpace(), "sol0"); - // (*(levels_[level].solution_))[0]->copyToDOFVector(sol0); - // MacroWriter::writeMacro((*(systemMatrix_))[0][0]->getFESpace(), "sol0.mesh", 0.0, level, Mesh::CALL_EL_LEVEL); - // ValueWriter::writeValues(&sol0, "sol0.dat", 0.0, level, Mesh::CALL_EL_LEVEL); - // DOFVector<double> sol1((*(systemMatrix_))[1][1]->getFESpace(), "sol1"); - // (*(levels_[level].solution_))[1]->copyToDOFVector(sol1); - // MacroWriter::writeMacro((*(systemMatrix_))[1][1]->getFESpace(), "sol1.mesh", 0.0, level, Mesh::CALL_EL_LEVEL); - // ValueWriter::writeValues(&sol1, "sol1.dat", 0.0, level, Mesh::CALL_EL_LEVEL); - // MSG("smoothed %d\n", level); - // WAIT; - } - - - void MultiGridSolverVec::prolongate(int level, int coarseLevel) - { - for (int comp = 0; comp < numComponents_; comp++) { - for (int i = coarseLevel; i < level; i++) { - interpolMatrix_[comp]->mv((*sparseResidual_)[comp], - (*sparseResidual_)[comp], - i); - } - } - } - - - void MultiGridSolverVec::restrict(int level, int coarseLevel) - { - ::std::vector<Element*>::iterator elIt, elBegin, elEnd; - ::std::vector<int>::iterator typeIt; - - for (int comp = 0; comp < numComponents_; comp++) { - (*(levels_[coarseLevel].oldSolution_))[comp]-> - copy(*((*(levels_[level].solution_))[comp]), - levels_[level].components_[comp].feSpaceData_->levelDOFs_); - (*(levels_[coarseLevel].oldSolution_))[comp]-> - copy(*((*(levels_[level].solution_))[comp]), - levels_[level].components_[comp].feSpaceData_->nearestNeighbourDOFs_); - - for (int i = level; i > coarseLevel; i--) { - SparseVector<double> visited("visited", (*sparseResidual_)[comp]); - - elBegin = levels_[i-1].elements_.begin(); - elEnd = levels_[i-1].elements_.end(); - - typeIt = levels_[i-1].elementTypes_.begin(); - for (elIt = elBegin; elIt != elEnd; ++elIt) { - Element *element = *elIt; - if (!element->isLeaf()) { - RCNeighbourList list(1); - list.setElement(0, element); - if (element->getMesh()->getDim() == 3) { - list.setType(0, *typeIt); - } - (*(levels_[coarseLevel].oldSolution_))[comp]->coarseRestrict(list, 1); - //sparseResidual_->coarseRestrict(list, 1); - } - } - - // restrictMatrix_[comp]->mv((*(levels_[coarseLevel].oldSolution_))[comp], - // (*(levels_[coarseLevel].oldSolution_))[comp], - // i-1); - restrictMatrix_[comp]->mv((*sparseResidual_)[comp], - (*sparseResidual_)[comp], - i-1); - } - - (*(levels_[coarseLevel].solution_))[comp]-> - copy(*((*(levels_[coarseLevel].oldSolution_))[comp]), - levels_[coarseLevel].components_[comp].feSpaceData_->fineDOFs_); - } - } - - - void MultiGridSolverVec::computeResidual(int level, int coarseLevel) - { - DOFMatrix *matrix; - SparseVector<double> *res, *sol, *rhs; - ::std::set<DegreeOfFreedom> *dofSet; - for (int i = 0; i < numComponents_; i++) { - res = (*sparseResidual_)[i]; - res->clear(); - rhs = (*(levels_[level].rhs_))[i]; - dofSet = levels_[level].levelDOFs_[i]; - for (int j = 0; j < numComponents_; j++) { - matrix = (*(levels_[level].matrix_))[i][j]; - if (matrix) { - sol = (*(levels_[level].solution_))[j]; - mv(*matrix, *sol, *res, *dofSet, true); - } - } - axpy(-1.0, *rhs, *res, *dofSet); - } - } - - - void MultiGridSolverVec::computeRHS(int level, int coarseLevel) - { - DOFMatrix *matrix; - SparseVector<double> *oldSol, *rhs, *res; - ::std::set<DegreeOfFreedom> *dofSet; - for (int i = 0; i < numComponents_; i++) { - rhs = (*(levels_[coarseLevel].rhs_))[i]; - rhs->clear(); - res = (*sparseResidual_)[i]; - dofSet = &(levels_[coarseLevel].components_[i].feSpaceData_->fineDOFs_); - for (int j = 0; j < numComponents_; j++) { - matrix = (*(levels_[coarseLevel].matrix_))[i][j]; - if (matrix) { - oldSol = (*(levels_[coarseLevel].oldSolution_))[j]; - mv(*matrix, *oldSol, *rhs, *dofSet, true); - } - } - axpy(-1.0, *res, *rhs, *dofSet); - dofSet = &(levels_[coarseLevel].components_[i].feSpaceData_->coarseDOFs_); - rhs->copyFromDOFVector(*(rhs_->getDOFVector(i)), *dofSet); - } - } - - - void MultiGridSolverVec::computeCorrection(int level, int coarseLevel) - { - SparseVector<double> *res, *sol, *oldSol; - ::std::set<DegreeOfFreedom> *dofSet; - for (int comp = 0; comp < numComponents_; comp++) { - dofSet = &(levels_[coarseLevel].components_[comp].feSpaceData_->fineDOFs_); - sol = (*(levels_[coarseLevel].solution_))[comp]; - oldSol = (*(levels_[coarseLevel].oldSolution_))[comp]; - res = (*sparseResidual_)[comp]; - res->copy(*sol, *dofSet); - axpy(-1.0, *oldSol, *res, *dofSet); - } - } - - - void MultiGridSolverVec::fixSolution(int level, int coarseLevel) - { - SparseVector<double> *fineSol, *coarseSol, *res; - ::std::set<DegreeOfFreedom> *dofSet; - for (int comp = 0; comp < numComponents_; comp++) { - fineSol = (*(levels_[level].solution_))[comp]; - coarseSol = (*(levels_[coarseLevel].solution_))[comp]; - res = (*sparseResidual_)[comp]; - dofSet = - &(levels_[level].components_[comp].feSpaceData_->nearestNeighbourDOFs_); - fineSol->copy(*coarseSol, *dofSet); - dofSet = - &(levels_[level].components_[comp].feSpaceData_->levelDOFs_); - axpy(1.0, *res, *fineSol, *dofSet); - } - } - - - void MultiGridSolverVec::exactSolve(int level) - { - smooth(level, coarseSmoothingSteps_); - } - - - bool MultiGridSolverVec::toleranceReached(double tol) - { - FUNCNAME("MultiGridSolverVec::toleranceReached()"); - - SparseVector<double> *sol; - ::std::set<DegreeOfFreedom> *dofSet; - for (int level = minLevel_; level < maxLevel_ + 1; level++) { - if (isMGLevel_[level]) { - for (int i = 0; i < numComponents_; i++) { - sol = (*(levels_[level].solution_))[i]; - dofSet = &(levels_[level].components_[i].feSpaceData_->coarseDOFs_); - sol->copyToDOFVector(*(solution_->getDOFVector(i)), *dofSet); - } - } - } - - mv(*systemMatrix_, *solution_, *denseResidual_); - axpy(-1.0, *rhs_, *denseResidual_); - - ++iteration_; - - double res = norm(denseResidual_); - - MSG("iteration %d - residual: %e (res/lastRes: %e)\n", - iteration_, res, res/lastRes_); - lastRes_ = res; - - return (res < tol); - } - - - void MultiGridSolverVec::initFullMultiGrid() - { - FUNCNAME("MultiGridSolverVec::initFullMultiGrid()"); - ERROR_EXIT("not yet\n"); - } - - - void MultiGridSolverVec::fmgInterpol(int level) - { - FUNCNAME("MultiGridSolverVec::fmgInterpol()"); - ERROR_EXIT("not yet\n"); - } - -#endif - -} - -#endif diff --git a/AMDiS/src/MultiGridSolver.h b/AMDiS/src/MultiGridSolver.h deleted file mode 100644 index 2e2de061..00000000 --- a/AMDiS/src/MultiGridSolver.h +++ /dev/null @@ -1,631 +0,0 @@ -// ============================================================================ -// == == -// == AMDiS - Adaptive multidimensional simulations == -// == == -// ============================================================================ -// == == -// == crystal growth group == -// == == -// == Stiftung caesar == -// == Ludwig-Erhard-Allee 2 == -// == 53175 Bonn == -// == germany == -// == == -// ============================================================================ -// == == -// == http://www.caesar.de/cg/AMDiS == -// == == -// ============================================================================ - -/** \file MultiGridSolver.h */ - -#ifndef AMDIS_MULTIGRIDSOLVER_H -#define AMDIS_MULTIGRIDSOLVER_H - -#if 0 - -#include "AMDiS_fwd.h" -#include "MultiGridSolverBase.h" -#include <vector> -#include "Global.h" -#include "SmootherBase.h" -#include <set> -#include <map> -#include "MatrixVector.h" -#include "SystemVector.h" - -namespace AMDiS { - - /** \brief - * Implementation of the multigrid solver base class for scalar problems. - */ - class MultiGridSolverScal : public MultiGridSolverBase<DOFMatrix, DOFVector<double> > - { - protected: - /** \brief - * Class to assemble all data of one multigrid level. - */ - class LevelData - { - public: - LevelData() - : matrix_(NULL), - solution_(NULL), - oldSolution_(NULL), - rhs_(NULL) - {}; - - /** \brief - * The level DOFMatrix. - */ - DOFMatrix *matrix_; - - /** \brief - * The solution stored in sparse format. - */ - SparseVector<double> *solution_; - - /** \brief - * The old solution stored in sparse format. - */ - SparseVector<double> *oldSolution_; - - /** \brief - * The right hand side of the level stored in sparse format. - */ - SparseVector<double> *rhs_; - - /** \brief - * Set of DOFs of all elements of the level. - */ - std::set<DegreeOfFreedom> levelDOFs_; - - /** \brief - * Set of DOFs of all elements of the level, which are also - * included in finer levels. - */ - std::set<DegreeOfFreedom> fineDOFs_; - - /** \brief - * Set of DOFs of all elements of the level, which are not - * included in finer levels. - */ - std::set<DegreeOfFreedom> coarseDOFs_; - - /** \brief - */ - std::set<DegreeOfFreedom> nearestNeighbourDOFs_; - - /** \brief - * List of all elements in the mesh on the current level. - */ - std::vector<Element*> elements_; - - /** \brief - * This array is only used if the elements are of dim=3. Than there - * are different element types possible. All different element types - * of the mesh are stored here. - */ - std::vector<int> elementTypes_; - }; - - public: - /** \brief - * Constructor of the scalar multigrid solver. - */ - MultiGridSolverScal(const std::string &name); - - /** \brief - * Computes the residual and checks if its norm is less than the tolerance. - */ - bool toleranceReached(double tol); - - /** \brief - * Traverses all elements and searchs for the highest level of an - * elements DOF. The result is stored in variable maxLevel_. - */ - void initMaxLevel(); - - /** \brief - * Initialize the multigrid solver. - */ - void initMultiGrid(bool initMG); - - /** \brief - * Frees all allocated memory. - */ - void exitMultiGrid(); - - /** \brief - * Solve the given level exactly. - * TODO: Implement a real exact solver. At the moment we use the smoother. - */ - void exactSolve(int level); - - /** \brief - * Call the smoother on the given level. steps is the maximum number of - * smoothing steps. - */ - void smooth(int level, int steps); - - /** \brief - * Restricts the residual and the solution from a fine multigrid level to - * a coarser multigrid level. - */ - void restrict(int level, int coarseLevel); - - /** \brief - * Prolongates the residual from a coarse multigrid level to a finer - * multigrid level. - */ - void prolongate(int level, int coarseLevel); - - /** \brief - * Computes the residual of a given leve. CoarseLevel parameter will be - * not considered. - */ - void computeResidual(int level, int coarseLevel); - - /** \brief - * Computes the rhs of the coarse level. Level parameter will be not - * considered. - */ - void computeRHS(int level, int coarseLevel); - - /** \brief - * Computes the correction of the coarse level. Level parameter will be - * not considered. - */ - void computeCorrection(int level, int coarseLevel); - - /** \brief - * Add the correction, which has been computed on the coarse grid, to the - * solution of the fine grid. - */ - void fixSolution(int level, int coarseLevel); - - /** \brief - * Returns for a given level the next coarser multigrid level. - */ - int coarserLevel(int level) { - FUNCNAME("MultiGridSolverScal::coarserLevel()"); - TEST_EXIT(level > minLevel_)("invalid level\n"); - do { - --level; - } while(!isMGLevel(level)); - return level; - }; - - /** \brief - * Returns true, if the level is a multigrid level, otherwise false. - */ - inline bool isMGLevel(int level) { - return isMGLevel_[level]; - }; - - /** \brief - * Returns for a given level the next multigrid level. - */ - inline int mgLevel(int level) { - while (!isMGLevel(level)) { - level++; - } - return level; - }; - - /** \brief - * Initialize the full multigrid cycle. - */ - void initFullMultiGrid(); - - /** \brief - * - */ - void fmgInterpol(int level); - - public: - /** \brief - * Data of all multigrid levels. - */ - std::vector<LevelData> levels_; - - /** \brief - * Residual stored in sparse format. - */ - SparseVector<double> *sparseResidual_; - - /** \brief - * Residual stored in dense format. - */ - DOFVector<double> *denseResidual_; - - /** \brief - * 2-Norm of the last residual. - */ - double lastRes_; - - /** \brief - * Defines for all mesh levels, if the level is a multigrid level. - * isMGLevel[0] is the coarsest grid level. - */ - std::vector<bool> isMGLevel_; - - /** \brief - * Counts the number of multigrid iterations. - */ - int iteration_; - - /** \brief - * Number of smoothing steps on the coarsest level. - */ - int coarseSmoothingSteps_; - - /** \brief - * Number of mesh levels that at leatst are skipped between two multigrid - * levels. - */ - int minLevelGap_; - - /** \brief - * Maximum number of allowed multigrid levels. - */ - int maxMGLevels_; - - /** \brief - * Smoother - */ - SmootherBase<DOFMatrix, - SparseVector<double>, - std::set<DegreeOfFreedom> > *smoother_; - - /** \brief - * Interpolation matrix for interpolating the residual between two meshes. - */ - InterpolRestrictMatrix *interpolMatrix_; - - /** \brief - * Restriction matrix for restricting the residual between two meshes. - */ - InterpolRestrictMatrix *restrictMatrix_; - - /** \brief - * - */ - int galerkin_; - }; - - - // ============================================================================ - // ============================================================================ - // ============================================================================ - // ============================================================================ - - - /** \brief - * Implementation of the multigrid solver base class for scalar problems. - */ - class MultiGridSolverVec : public MultiGridSolverBase<Matrix<DOFMatrix*>, - SystemVector> - { - public: - /** \brief - * Multigrid data that depends on the fe space. - */ - class FESpaceData - { - public: - MEMORY_MANAGED(FESpaceData); - - /** \brief - * Set of DOFs of all elements of the level. - */ - std::set<DegreeOfFreedom> levelDOFs_; - - /** \brief - * Set of DOFs of all elements of the level, which are also - * included in finer levels. - */ - std::set<DegreeOfFreedom> fineDOFs_; - - /** \brief - * Set of DOFs of all elements of the level, which are not - * included in finer levels. - */ - std::set<DegreeOfFreedom> coarseDOFs_; - - /** \brief - */ - std::set<DegreeOfFreedom> nearestNeighbourDOFs_; - }; - - /** \brief - * Multigrid data that depend on the mesh. - */ - class MeshData - { - public: - MEMORY_MANAGED(MeshData); - - MeshData() : maxLevel(0) {}; - - int maxLevel; - }; - - /** \brief - * Data for one component within one level. - */ - class ComponentData - { - public: - MEMORY_MANAGED(ComponentData); - - ComponentData() - : feSpaceData_(NULL), - meshData_(NULL) - {}; - - FESpaceData *feSpaceData_; - MeshData *meshData_; - }; - - /** \brief - * Data for one multigrid level. - */ - class LevelData - { - public: - MEMORY_MANAGED(LevelData); - - LevelData() - : matrix_(NULL), - oldSolution_(NULL), - solution_(NULL), - rhs_(NULL) - {}; - - /** \brief - * The DOF matrices. - */ - Matrix<DOFMatrix*> *matrix_; - - /** \brief - * Vector of old solutions, each stored in sparse format. - */ - Vector<SparseVector<double>*> *oldSolution_; - - /** \brief - * Vector of solutions, each stored in sparse format. - */ - Vector<SparseVector<double>*> *solution_; - - /** \brief - * Vector of rhs', each stored in sparse format. - */ - Vector<SparseVector<double>*> *rhs_; - - /** \brief - * Mesh and FE space dependend data for each component. - */ - std::vector<ComponentData> components_; - - /** \brief - * Stores for each component all DOFs at this level. - */ - Vector< std::set<DegreeOfFreedom>*> levelDOFs_; - - /** \brief - * List of all elements in the mesh on the current level. - */ - std::vector<Element*> elements_; - - /** \brief - * This array is only used if the elements are of dim=3. Than there - * are different element types possible. All different element types - * of the mesh are stored here. - */ - std::vector<int> elementTypes_; - }; - - public: - /** \brief - * Constructor of the vector multigrid solver. - */ - MultiGridSolverVec(const std::string &name); - - /** \brief - * Computes the residual and checks if its norm is less than the tolerance. - */ - bool toleranceReached(double tol); - - /** \brief - * Traverses all elements and searchs for the highest level of an - * elements DOF. The result is stored in variable maxLevel_. - */ - void initMaxLevel(); - - /** \brief - * Initialize the multigrid solver. - */ - void initMultiGrid(bool initMG); - - /** \brief - * Frees all allocated memory. - */ - void exitMultiGrid(); - - /** \brief - * Solve the given level exactly. - * TODO: Implement a real exact solver. At the moment we use the smoother. - */ - void exactSolve(int level); - - /** \brief - * Call the smoother on the given level. steps is the maximum number of - * smoothing steps. - */ - void smooth(int level, int steps); - - /** \brief - * Restricts the residual and the solution from a fine multigrid level to - * a coarser multigrid level. - */ - void restrict(int level, int coarseLevel); - - /** \brief - * Prolongates the residual from a coarse multigrid level to a finer - * multigrid level. - */ - void prolongate(int level, int coarseLevel); - - /** \brief - * Computes the residual of a given leve. CoarseLevel parameter will be - * not considered. - */ - void computeResidual(int level, int coarseLevel); - - /** \brief - * Computes the rhs of the coarse level. Level parameter will be not - * considered. - */ - void computeRHS(int level, int coarseLevel); - - /** \brief - * Computes the correction of the coarse level. Level parameter will be - * not considered. - */ - void computeCorrection(int level, int coarseLevel); - - /** \brief - * Add the correction, which has been computed on the coarse grid, to the - * solution of the fine grid. - */ - void fixSolution(int level, int coarseLevel); - - /** \brief - * Returns for a given level the next coarser multigrid level. - */ - int coarserLevel(int level) { - FUNCNAME("MultiGridSolverVec::coarserLevel()"); - TEST_EXIT(level > minLevel_)("invalid level\n"); - do { - --level; - } while(!isMGLevel(level)); - return level; - }; - - /** \brief - * Returns true if the level is a multigrid level, otherwise false. - */ - inline bool isMGLevel(int level) { - return isMGLevel_[level]; - }; - - void initFullMultiGrid(); - - void fmgInterpol(int level); - - inline int mgLevel(int level) { - while(!isMGLevel_[level]) { - ++level; - } - return level; - }; - - protected: - /** \brief - * Defines for all mesh levels, if the level is a multigrid level. - * isMGLevel[0] is the coarsest grid level. - */ - std::vector<bool> isMGLevel_; - - /** \brief - * Data of all multigrid levels. - */ - std::vector<LevelData> levels_; - - /** \brief - * Sparse vectors containing the residuals. - */ - Vector<SparseVector<double>*> *sparseResidual_; - - /** \brief - * Dense vectors containing the residuals. - */ - SystemVector *denseResidual_; - - /** \brief - * 2-Norm of the last residual. - */ - double lastRes_; - - /** \brief - * Counts the number of multigrid iterations. - */ - int iteration_; - - /** \brief - * Number of smoothing steps on the coarsest level. - */ - int coarseSmoothingSteps_; - - /** \brief - * Is the number of mesh levels that at least are skipped between two - * multigrid levels. - */ - int minLevelGap_; - - /** \brief - * Maximum number of multigrid levels. - */ - int maxMGLevels_; - - /** \brief - * Number of components in the vector problem. - */ - int numComponents_; - - /** \brief - * Smoother - */ - SmootherBase<Matrix<DOFMatrix*>, - Vector<SparseVector<double>*>, - Vector< std::set<DegreeOfFreedom>*> > *smoother_; - - /** \brief - * Vector of interpolation matrices for interpolating the residual between - * two meshes. - */ - std::vector<InterpolRestrictMatrix*> interpolMatrix_; - - /** \brief - * Vector of restriction matrices for restricting the residual between - * two meshes. - */ - std::vector<InterpolRestrictMatrix*> restrictMatrix_; - - /** \brief - * Diagonal entries in the system matrix. - */ - SystemVector *diagEntries_; - - /** \brief - * - */ - bool boxSmoothing_; - - /** \brief - * - */ - Vector< std::set<DegreeOfFreedom>*> boxDOFs_; - - /** \brief - * - */ - int galerkin_; - }; - -} - -#endif - -#endif diff --git a/AMDiS/src/MultiGridSolverBase.h b/AMDiS/src/MultiGridSolverBase.h deleted file mode 100755 index 5294b3f4..00000000 --- a/AMDiS/src/MultiGridSolverBase.h +++ /dev/null @@ -1,157 +0,0 @@ -// ============================================================================ -// == == -// == AMDiS - Adaptive multidimensional simulations == -// == == -// ============================================================================ -// == == -// == crystal growth group == -// == == -// == Stiftung caesar == -// == Ludwig-Erhard-Allee 2 == -// == 53175 Bonn == -// == germany == -// == == -// ============================================================================ -// == == -// == http://www.caesar.de/cg/AMDiS == -// == == -// ============================================================================ - -/** \file MultiGridSolverBase.h */ - -#ifndef AMDIS_MULTIGRIDSOLVERBASE_H -#define AMDIS_MULTIGRIDSOLVERBASE_H - -#if 0 - -#include <string> - -namespace AMDiS { - - template<typename MatrixType, typename VectorType> - class MultiGridSolverBase - { - public: - /** \brief - * Constructor, reads all multigrid parameters from the init file. - */ - MultiGridSolverBase(const ::std::string &name) ; - - /** \brief - * Destructor - */ - virtual ~MultiGridSolverBase() {}; - - /** \brief - * Abstract function for solving an equation using multigrid method. - * This function does not need to be reimplemented by a derived class. - */ - virtual int solve(MatrixType &a, - VectorType &x, - VectorType &b, - bool initMG = true, - bool exitMG = true); - - /** \brief - * Implements one multigrid iteration. This function does not need to be - * reimplemented by a derived class. - */ - virtual void multiGridIteration(int level); - - virtual bool toleranceReached(double tol) = 0; - - virtual void initMaxLevel() = 0; - - virtual void initMultiGrid(bool createLevels) = 0; - - virtual void exitMultiGrid() = 0; - - virtual void smooth(int level, int steps) = 0; - - virtual void restrict(int level, int coarseLevel) = 0; - - virtual void prolongate(int level, int coarseLevel) = 0; - - virtual void computeResidual(int level, int coarseLevel) = 0; - - virtual void computeRHS(int level, int coarseLevel) = 0; - - virtual void computeCorrection(int level, int coarseLevel) = 0; - - virtual void fixSolution(int level, int coarseLevel) = 0; - - virtual void exactSolve(int level) = 0; - - virtual int coarserLevel(int level) = 0; - - virtual void initFullMultiGrid() {}; - - virtual void fmgInterpol(int level) {}; - - protected: - /** \brief - * Coefficent matrix - */ - MatrixType *systemMatrix_; - - /** \brief - * Vector for the computed solution. - */ - VectorType *solution_; - - /** \brief - * Right hand side of the equation. - */ - VectorType *rhs_; - - /** \brief - * Name of the problem, corresponding to the name in the init file. - */ - ::std::string name_; - - /** \brief - * Tolerance for the computation. The multigrid method finished, if the - * norm of the residual is less than the tolerance. - */ - double tolerance_; - - /** \brief - * Maximum number of multigrid iterations. - */ - int maxIterations_; - - /** \brief - * The coarsest multigrid level. - */ - int minLevel_; - - /** \brief - * The finest multigrid level. - */ - int maxLevel_; - - int numCycles_; - - /** \brief - * Number of smoothing steps on the solution before the recursive multigrid call. - */ - int preSmoothingSteps_; - - /** \brief - * Number of smoothing steps on the solution after the recursive multigrid call. - */ - int postSmoothingSteps_; - - /** \brief - * If the method of full multigrid should be used, this variable has a non - * zero value. - */ - int fmg_; - }; - -} - -#include "MultiGridSolverBase.hh" -#endif - -#endif diff --git a/AMDiS/src/MultiGridSolverBase.hh b/AMDiS/src/MultiGridSolverBase.hh deleted file mode 100644 index 77b9d9aa..00000000 --- a/AMDiS/src/MultiGridSolverBase.hh +++ /dev/null @@ -1,142 +0,0 @@ -#if 0 - -#include "Global.h" -#include "Parameters.h" - -namespace AMDiS { - - template<typename MatrixType, typename VectorType> - MultiGridSolverBase<MatrixType, VectorType>::MultiGridSolverBase(const std::string &name) - : name_(name), - tolerance_(1e-8), - maxIterations_(100), - minLevel_(0), - maxLevel_(-1), - numCycles_(1), - preSmoothingSteps_(1), - postSmoothingSteps_(1), - fmg_(0) - { - GET_PARAMETER(0, name_ + "->tolerance", "%e", &tolerance_); - GET_PARAMETER(0, name_ + "->max iteration", "%d", &maxIterations_); - GET_PARAMETER(0, name_ + "->mg cycle type", "%d", &numCycles_); - GET_PARAMETER(0, name_ + "->pre smoothing steps", "%d", &preSmoothingSteps_); - GET_PARAMETER(0, name_ + "->post smoothing steps", "%d", &postSmoothingSteps_); - GET_PARAMETER(0, name_ + "->min level", "%d", &minLevel_); - GET_PARAMETER(0, name_ + "->full mg", "%d", &fmg_); - - interpolMatrices[0][0] = new IM_1d_1; - interpolMatrices[0][1] = new IM_1d_2; - interpolMatrices[0][2] = NULL; - interpolMatrices[0][3] = NULL; - - interpolMatrices[1][0] = new IM_2d_1; - interpolMatrices[1][1] = new IM_2d_2; - interpolMatrices[1][2] = new IM_2d_3; - interpolMatrices[1][3] = new IM_2d_4; - - interpolMatrices[2][0] = new IM_3d_1; - interpolMatrices[2][1] = new IM_3d_2; - interpolMatrices[2][2] = new IM_3d_3; - interpolMatrices[2][3] = new IM_3d_4; - - restrictMatrices[0][0] = new InterpolRestrictMatrix(*(interpolMatrices[0][0]), true); - restrictMatrices[0][1] = new InterpolRestrictMatrix(*(interpolMatrices[0][1]), true); - restrictMatrices[0][2] = NULL; - restrictMatrices[0][3] = NULL; - - restrictMatrices[1][0] = new InterpolRestrictMatrix(*(interpolMatrices[1][0]), true); - restrictMatrices[1][1] = new InterpolRestrictMatrix(*(interpolMatrices[1][1]), true); - restrictMatrices[1][2] = new InterpolRestrictMatrix(*(interpolMatrices[1][2]), true); - restrictMatrices[1][3] = new InterpolRestrictMatrix(*(interpolMatrices[1][3]), true); - - restrictMatrices[2][0] = new InterpolRestrictMatrix(*(interpolMatrices[2][0]), true); - restrictMatrices[2][1] = new InterpolRestrictMatrix(*(interpolMatrices[2][1]), true); - restrictMatrices[2][2] = new InterpolRestrictMatrix(*(interpolMatrices[2][2]), true); - restrictMatrices[2][3] = new InterpolRestrictMatrix(*(interpolMatrices[2][3]), true); - } - - template<typename MatrixType, typename VectorType> - int MultiGridSolverBase<MatrixType, VectorType>::solve(MatrixType &a, - VectorType &x, - VectorType &b, - bool initMG, - bool exitMG) - { - int i = 0; - systemMatrix_ = &a; - solution_ = &x; - rhs_ = &b; - - initMaxLevel(); - if (minLevel_ > maxLevel_) - minLevel_ = maxLevel_; - - initMultiGrid(initMG); - - if (fmg_) { - initFullMultiGrid(); - for (int i = 1; i < maxLevel_ + 1; i++) { - fmgInterpol(i); - multiGridIteration(i); - } - } - - for (int i = 0; i < maxIterations_; i++) { - if (toleranceReached(tolerance_)) - break; - multiGridIteration(maxLevel_); - } - - if (exitMG) { - exitMultiGrid(); - } - - return i + 1; - } - - template<typename MatrixType, typename VectorType> - void MultiGridSolverBase<MatrixType, VectorType>::multiGridIteration(int level) - { - if (level <= minLevel_) { - // If we are on the coarsest possible grid, use exact solver. - exactSolve(minLevel_); - } else { - // Get the next coarser level. - int coarseLevel = coarserLevel(level); - - // Smooth the solution on the fine grid. - smooth(level, preSmoothingSteps_); - - // Compute the residual on the fine grid. - computeResidual(level, coarseLevel); - - // Restrict the residual to the coarser grid. - restrict(level, coarseLevel); - - // Compute defect equation on the coarser grid. - computeRHS(level, coarseLevel); - - // Apply multigrid on the coarser grid. - for (int i = 0; i < numCycles_; i++) { - multiGridIteration(coarseLevel); - } - - // Compute correction of the solution. - computeCorrection(level, coarseLevel); - - // Prolongate the solution to the finer grid. - prolongate(level, coarseLevel); - - // Add the correction, computed on the coarse grid, to the solution - // on the fine grid. - fixSolution(level, coarseLevel); - - // Apply smoothing on the solution on the fine grid. - smooth(level, postSmoothingSteps_); - } - } - -} - -#endif diff --git a/AMDiS/src/MultiGridWrapper.h b/AMDiS/src/MultiGridWrapper.h deleted file mode 100644 index 272cc2e1..00000000 --- a/AMDiS/src/MultiGridWrapper.h +++ /dev/null @@ -1,151 +0,0 @@ -// ============================================================================ -// == == -// == AMDiS - Adaptive multidimensional simulations == -// == == -// ============================================================================ -// == == -// == crystal growth group == -// == == -// == Stiftung caesar == -// == Ludwig-Erhard-Allee 2 == -// == 53175 Bonn == -// == germany == -// == == -// ============================================================================ -// == == -// == http://www.caesar.de/cg/AMDiS == -// == == -// ============================================================================ - -/** \file MultiGridWrapper.h */ - -#ifndef AMDIS_MULTIGRIDWRAPPER_H -#define AMDIS_MULTIGRIDWRAPPER_H - -#if 0 - -#include "MultiGridSolver.h" -#include "MatVecMultiplier.h" -#include "OEMSolver.h" -#include "MemoryManager.h" - -namespace AMDiS { - - - /** \brief - * Wrapper to make the multigrid solver accessible as a normal scal solver. - */ - class MultiGridWrapperScal : public OEMSolver<DOFVector<double> > - { - public: - MEMORY_MANAGED(MultiGridWrapperScal); - - /** \brief - * Creator class used in the OEMSolverMap. - */ - class Creator : public OEMSolverCreator<DOFVector<double> > - { - public: - MEMORY_MANAGED(Creator); - - virtual ~Creator() {}; - - /** \brief - * Returns a new object. - */ - OEMSolver<DOFVector<double> >* create() { - return - NEW MultiGridWrapperScal(name); - }; - }; - - MultiGridWrapperScal(std::string name) - : OEMSolver<DOFVector<double> >(name) - { - mgSolver_ = - NEW MultiGridSolverScal(name); - }; - - ~MultiGridWrapperScal() { - DELETE mgSolver_; - }; - - void init() {}; - - void exit() {}; - - int solveSystem(MatVecMultiplier<DOFVector<double> > *mv, - DOFVector<double> *x, - DOFVector<double> *b, - bool reuseMatrix) - { - DOFMatrix *matrix = - dynamic_cast<StandardMatVec<DOFMatrix, DOFVector<double> >*>(mv)->getMatrix(); - return mgSolver_->solve(*matrix, *x, *b, reuseMatrix); - }; - - protected: - MultiGridSolverBase<DOFMatrix, DOFVector<double> > *mgSolver_; - }; - - - /** \brief - * Wrapper to make the multigrid solver accessible as a normal vector solver. - */ - class MultiGridWrapperVec : public OEMSolver<SystemVector> - { - public: - MEMORY_MANAGED(MultiGridWrapperVec); - - /** \brief - * Creator class used in the OEMSolverMap. - */ - class Creator : public OEMSolverCreator<SystemVector> - { - public: - MEMORY_MANAGED(Creator); - - virtual ~Creator() {}; - - /** \brief - * Returns a new object. - */ - OEMSolver<SystemVector>* create() { - return NEW MultiGridWrapperVec(name); - }; - }; - - MultiGridWrapperVec(std::string name) - : OEMSolver<SystemVector>(name) - { - mgSolver_ = - NEW MultiGridSolverVec(name); - }; - - ~MultiGridWrapperVec() { - DELETE mgSolver_; - }; - - void init() {}; - - void exit() {}; - - int solveSystem(MatVecMultiplier<SystemVector> *mv, - SystemVector *x, - SystemVector *b, - bool reuseMatrix) - { - Matrix<DOFMatrix*> *matrix = - dynamic_cast<StandardMatVec<Matrix<DOFMatrix*>, SystemVector>*>(mv)->getMatrix(); - return mgSolver_->solve(*matrix, *x, *b, reuseMatrix); - }; - - protected: - MultiGridSolverBase<Matrix<DOFMatrix*>, SystemVector> *mgSolver_; - }; - -} - -#endif - -#endif diff --git a/AMDiS/src/ProblemScal.cc b/AMDiS/src/ProblemScal.cc index 84fdbb30..6eed0b19 100644 --- a/AMDiS/src/ProblemScal.cc +++ b/AMDiS/src/ProblemScal.cc @@ -11,7 +11,6 @@ #include "FiniteElemSpace.h" #include "Estimator.h" #include "OEMSolver.h" -#include "MatVecMultiplier.h" #include "DOFVector.h" #include "Marker.h" #include "AdaptInfo.h" @@ -452,9 +451,6 @@ namespace AMDiS { solution->setCoarsenOperation(COARSE_INTERPOL); solution->set(0.0); /* initialize u_h ! */ - - // === create matVec === - matVec = NEW StandardMatVec<DOFMatrix, DOFVector<double> >(systemMatrix); } void ProblemScal::createSolver() diff --git a/AMDiS/src/ProblemScal.h b/AMDiS/src/ProblemScal.h index 4efc76a2..87d54dd9 100644 --- a/AMDiS/src/ProblemScal.h +++ b/AMDiS/src/ProblemScal.h @@ -59,7 +59,6 @@ namespace AMDiS { solution(NULL), rhs(NULL), systemMatrix(NULL), - matVec(NULL), useGetBound(true), refinementManager(NULL), coarseningManager(NULL), @@ -352,9 +351,6 @@ namespace AMDiS { /// System matrix DOFMatrix *systemMatrix; - /// Matrix-vector multiplication - MatVecMultiplier<DOFVector<double> > *matVec; - /// Determines whether domain boundaries should be considered at assembling. bool useGetBound; diff --git a/AMDiS/src/ProblemVec.cc b/AMDiS/src/ProblemVec.cc index 0467afe8..28d5d3a0 100644 --- a/AMDiS/src/ProblemVec.cc +++ b/AMDiS/src/ProblemVec.cc @@ -1,5 +1,4 @@ #include <sstream> - #include "ProblemVec.h" #include "RecoveryEstimator.h" #include "Serializer.h" @@ -17,7 +16,6 @@ #include "DualTraverse.h" #include "Mesh.h" #include "OEMSolver.h" -#include "MatVecMultiplier.h" #include "DirichletBC.h" #include "RobinBC.h" #include "PeriodicBC.h" @@ -340,9 +338,6 @@ namespace AMDiS { solution->getDOFVector(i)->setCoarsenOperation(COARSE_INTERPOL); solution->getDOFVector(i)->set(0.0); } - - // === create matVec === - matVec = NEW StandardMatVec<Matrix<DOFMatrix*>, SystemVector>(systemMatrix); } void ProblemVec::createSolver() @@ -989,8 +984,7 @@ namespace AMDiS { (*systemMatrix)[row][col]->getBoundaryManager()->addBoundaryCondition(periodic); if (rhs) - rhs->getDOFVector(row)->getBoundaryManager()-> - addBoundaryCondition(periodic); + rhs->getDOFVector(row)->getBoundaryManager()->addBoundaryCondition(periodic); } void ProblemVec::assembleOnOneMesh(FiniteElemSpace *feSpace, @@ -1010,7 +1004,8 @@ 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. diff --git a/AMDiS/src/ProblemVec.h b/AMDiS/src/ProblemVec.h index e1cae1eb..03a64450 100644 --- a/AMDiS/src/ProblemVec.h +++ b/AMDiS/src/ProblemVec.h @@ -42,9 +42,7 @@ namespace AMDiS { public StandardProblemIteration { public: - /** \brief - * constructor - */ + /// Constructor ProblemVec(const std::string &nameStr, ProblemIterationInterface *problemIteration = NULL) : StandardProblemIteration(this), @@ -56,7 +54,6 @@ namespace AMDiS { solution(NULL), rhs(NULL), systemMatrix(NULL), - matVec(NULL), useGetBound(true), info(10), allowFirstRef(false), @@ -517,9 +514,6 @@ namespace AMDiS { */ std::vector< std::vector< bool > > assembledMatrix; - /// Matrix-vector multiplication - MatVecMultiplier<SystemVector> *matVec; - /// Determines whether domain boundaries should be considered at assembling. bool useGetBound; diff --git a/AMDiS/src/ResidualEstimator.cc b/AMDiS/src/ResidualEstimator.cc index 000786d6..bf8ae05b 100644 --- a/AMDiS/src/ResidualEstimator.cc +++ b/AMDiS/src/ResidualEstimator.cc @@ -176,7 +176,6 @@ namespace AMDiS { DELETE neighInfo; } -#if 1 void ResidualEstimator::estimateElement(ElInfo *elInfo) { FUNCNAME("ResidualEstimator::estimateElement()"); @@ -467,195 +466,6 @@ 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 nPoints, const double *uhIq, diff --git a/AMDiS/src/SmootherBase.h b/AMDiS/src/SmootherBase.h deleted file mode 100644 index ecd89481..00000000 --- a/AMDiS/src/SmootherBase.h +++ /dev/null @@ -1,67 +0,0 @@ -// ============================================================================ -// == == -// == AMDiS - Adaptive multidimensional simulations == -// == == -// ============================================================================ -// == == -// == crystal growth group == -// == == -// == Stiftung caesar == -// == Ludwig-Erhard-Allee 2 == -// == 53175 Bonn == -// == germany == -// == == -// ============================================================================ -// == == -// == http://www.caesar.de/cg/AMDiS == -// == == -// ============================================================================ - -/** \file SmootherBase.h */ - -#include "Global.h" -#include <set> -#include <string> -#include "CreatorInterface.h" - -#ifndef AMDIS_SMOOTHERBASE_H -#define AMDIS_SMOOTHERBASE_H - -namespace AMDiS { - - template<typename MatrixType, typename VectorType, typename DOFSetType> - class SmootherBase - { - public: - SmootherBase(std::string name) : name_(name) {}; - - virtual ~SmootherBase() {}; - - virtual void smooth(MatrixType *matrix, - VectorType *solution, - VectorType *rhs, - int iterations, - const DOFSetType &dofSet) = 0; - - protected: - const std::string name_; - }; - - - template<typename MatrixType, typename VectorType, typename DOFSetType> - class SmootherCreator : public CreatorInterface<SmootherBase<MatrixType, - VectorType, - DOFSetType> > - { - public: - virtual ~SmootherCreator() {}; - - void setName(std::string name_) { name = name_; }; - - protected: - std::string name; - }; - -} - -#endif diff --git a/AMDiS/src/SparseVector.cc b/AMDiS/src/SparseVector.cc deleted file mode 100644 index 5e144280..00000000 --- a/AMDiS/src/SparseVector.cc +++ /dev/null @@ -1,103 +0,0 @@ -#include "SparseVector.h" -#include "DOFVector.h" -#include "FiniteElemSpace.h" - -#include <boost/numeric/mtl/mtl.hpp> - -namespace AMDiS { - - template<> - void SparseVector<double>::refineInterpol(RCNeighbourList& list, int n) - { - (const_cast<BasisFunction*>(this->getFESpace()->getBasisFcts()))->refineInter(this, &list, n); - } - - template<> - void SparseVector<double>::coarseRestrict(RCNeighbourList& list, int n) - { - (const_cast<BasisFunction*>(this->getFESpace()->getBasisFcts()))->coarseInter(this, &list, n); - } - - template<> - void SparseVector<double>::print() - { - FUNCNAME("SparseVector::print()"); - int i, size = static_cast<int>(vec_.size()); - for(i = 0; i < size; i++) { - MSG("dof %d - %e\n", (*physToLog_)[i], vec_[i]); - } - } - - template<> - void axpy<double>(double a, SparseVector<double>& x, SparseVector<double>& y, - std::set<DegreeOfFreedom> &dofSet) - { - std::set<DegreeOfFreedom>::iterator dofIt, dofEnd = dofSet.end(); - for(dofIt = dofSet.begin(); dofIt != dofEnd; ++dofIt) { - y[*dofIt] += a * x[*dofIt]; - } - } - - template<> - void mv<double>(DOFMatrix &a, - SparseVector<double> &x, - SparseVector<double> &result, - std::set<DegreeOfFreedom> &dofSet, - bool add) - { - using namespace mtl; - using mtl::tag::nz; using mtl::begin; using mtl::end; - namespace traits= mtl::traits; - typedef DOFMatrix::base_matrix_type Matrix; - Matrix &matrix= a.getBaseMatrix(); - - traits::row<Matrix>::type row(matrix); - traits::col<Matrix>::type col(matrix); - traits::const_value<Matrix>::type value(matrix); - - typedef traits::range_generator<tag::row, Matrix>::type cursor_type; - typedef traits::range_generator<nz, cursor_type>::type icursor_type; - - for (cursor_type cursor = begin<tag::row>(matrix), cend = end<tag::row>(matrix); cursor != cend; ++cursor) { - icursor_type icursor = begin<nz>(cursor), icend = end<nz>(cursor); - double sum= add ? result[row(*icursor)] : 0.0; - for (; icursor != icend; ++icursor) - sum+= value(*icursor) * const_cast<SparseVector<double>&>(x)[col(*icursor)]; - result[row(*icursor)]= sum; - } - -#if 0 - //DOFMatrix::Iterator matIt(const_cast<DOFMatrix*>(&a), USED_DOFS); - std::vector<MatEntry>::iterator rowIt, rowEnd; - - DegreeOfFreedom row, col; - - if(!add) result.clear(); - - // for(matIt.reset(); !matIt.end(); ++matIt) { - std::set<DegreeOfFreedom>::iterator dofIt, dofEnd = dofSet.end(); - for(dofIt = dofSet.begin(); dofIt != dofEnd; ++dofIt) { - row = *dofIt; - rowEnd = a[row].end(); - for(rowIt = a[row].begin(); rowIt != rowEnd; ++rowIt) { - col = rowIt->col; - if(col == DOFMatrix::UNUSED_ENTRY) continue; - if(col == DOFMatrix::NO_MORE_ENTRIES) break; - result[row] += rowIt->entry * const_cast<SparseVector<double>&>(x)[col]; - } - } -#endif - } - - template<> - double SparseVector<double>::norm() - { - double norm = 0.0; - std::vector<double>::iterator it, end = vec_.end(); - for(it = vec_.begin(); it != end; ++it) { - norm += *it * *it; - } - return sqrt(norm); - } - -} diff --git a/AMDiS/src/SparseVector.h b/AMDiS/src/SparseVector.h deleted file mode 100644 index d560030c..00000000 --- a/AMDiS/src/SparseVector.h +++ /dev/null @@ -1,174 +0,0 @@ -// ============================================================================ -// == == -// == AMDiS - Adaptive multidimensional simulations == -// == == -// ============================================================================ -// == == -// == crystal growth group == -// == == -// == Stiftung caesar == -// == Ludwig-Erhard-Allee 2 == -// == 53175 Bonn == -// == germany == -// == == -// ============================================================================ -// == == -// == http://www.caesar.de/cg/AMDiS == -// == == -// ============================================================================ - -/** \file SparseVector.h */ - -#ifndef AMDIS_SPARSEVECTOR_H -#define AMDIS_SPARSEVECTOR_H - -#include "MemoryManager.h" -#include "DOFVector.h" -#include <set> -#include <string> -#include <vector> - -namespace AMDiS -{ - - template<typename T> class SparseVector; - - template<typename T> - void axpy(double a, SparseVector<T>& x, SparseVector<T>& y, - std::set<DegreeOfFreedom> &dofSet); - - template<typename T> - void mv(DOFMatrix &a, - SparseVector<T> &x, - SparseVector<T> &result, - std::set<DegreeOfFreedom> &dofSet, - bool add = false); - - class FiniteElemSpace; - - template<typename T> - class SparseVector : public DOFVectorBase<T> - { - public: - MEMORY_MANAGED(SparseVector); - - SparseVector(const FiniteElemSpace *feSpace, const char *name) - : DOFVectorBase<T>(feSpace, name), - master_(NULL) - { - logToPhys_ = new std::map<DegreeOfFreedom, int>; - physToLog_ = new std::vector<DegreeOfFreedom>; - }; - - SparseVector(const char *name, SparseVector *master) - : DOFVectorBase<T>(master->getFESpace(), name), - logToPhys_(master->logToPhys_), - physToLog_(master->physToLog_), - master_(master) - { - master_->clients_.push_back(this); - vec_.resize(physToLog_->size(), 0.0); - }; - - virtual ~SparseVector() { - if(master_) { - typename std::vector<SparseVector<T>*>::iterator clientIt, clientEnd = master_->clients_.end(); - for(clientIt = master_->clients_.begin(); clientIt != clientEnd; ++clientIt) { - if(*clientIt == this) { - master_->clients_.erase(clientIt); - break; - } - } - } else { - TEST_EXIT_DBG(clients_.empty())("delete clients first\n"); - delete logToPhys_; - delete physToLog_; - } - }; - - //void createSparseIndices(std::set<DegreeOfFreedom> &dofs); - - void copyToDOFVector(DOFVector<T> &dofVec); - - void copyToDOFVector(DOFVector<T> &dofVec, - std::set<DegreeOfFreedom> &dofs); - - void copyFromDOFVector(DOFVector<T> &dofVec, - std::set<DegreeOfFreedom> &dofs); - - void clear(bool eraseEntries = true); - - T norm(); - - void copy(SparseVector &x, const std::set<DegreeOfFreedom> &dofSet); - - void copy(SparseVector &x, const std::vector<DegreeOfFreedom> &dofSet); - - void print(); - - inline void synchronize() { - vec_.resize(physToLog_->size(), 0.0); - }; - - virtual int getSize() const { - return static_cast<int>(physToLog_->size()); - }; - - virtual void resize(int size) {}; - - virtual void compressDOFIndexed(int first, int last, - std::vector<DegreeOfFreedom> &newDOF) - { - ERROR_EXIT("compress called\n"); - }; - - virtual void freeDOFContent(int) {}; - - virtual void refineInterpol(RCNeighbourList&, int); - - virtual void coarseRestrict(RCNeighbourList&, int); - - virtual typename std::vector<T>::iterator begin() { - static typename std::vector<T>::iterator dummy; - return dummy; - }; - - virtual typename std::vector<T>::iterator end() { - static typename std::vector<T>::iterator dummy; - return dummy; - }; - - virtual T& operator[](DegreeOfFreedom i); - - virtual const T& operator[](DegreeOfFreedom i) const; - - inline bool isSparseIndex(int i) { - return (*logToPhys_)[i] != 0; - }; - - protected: - std::map<DegreeOfFreedom, int> *logToPhys_; - - std::vector<DegreeOfFreedom> *physToLog_; - - std::vector<T> vec_; - - SparseVector *master_; - - std::vector<SparseVector*> clients_; - - friend void axpy<>(double a, SparseVector<T>& x, SparseVector<T>& y, - std::set<DegreeOfFreedom> &dofSet); - - friend void mv<>(DOFMatrix &a, - SparseVector<T> &x, - SparseVector<T> &result, - std::set<DegreeOfFreedom> &dofSet, - bool add); - - }; - -} - -#include "SparseVector.hh" -#endif diff --git a/AMDiS/src/SparseVector.hh b/AMDiS/src/SparseVector.hh deleted file mode 100644 index e9489f9b..00000000 --- a/AMDiS/src/SparseVector.hh +++ /dev/null @@ -1,126 +0,0 @@ -#include "DOFVector.h" -#include "FiniteElemSpace.h" - -namespace AMDiS { - -template<typename T> -void SparseVector<T>::refineInterpol(RCNeighbourList& list, int n) -{} - -template<typename T> -void SparseVector<T>::coarseRestrict(RCNeighbourList& list, int n) -{} - -template<typename T> -void SparseVector<T>::copyToDOFVector(DOFVector<T> &dofVec, - std::set<DegreeOfFreedom> &dofs) -{ - std::set<DegreeOfFreedom>::iterator dofsIt; - std::set<DegreeOfFreedom>::iterator dofsEnd = dofs.end(); - - for(dofsIt = dofs.begin(); dofsIt != dofsEnd; ++dofsIt) { - dofVec[*dofsIt] = operator[](*dofsIt); - } -} - -template<typename T> -void SparseVector<T>::copyToDOFVector(DOFVector<T> &dofVec) -{ - int i, size = static_cast<int>((*physToLog_).size()); - -// vec_.resize(size, 0.0); - - for(i = 0; i < size; i++) { - dofVec[(*physToLog_)[i]] = vec_[i]; - } -} - -template<typename T> -void SparseVector<T>::copyFromDOFVector(DOFVector<T> &dofVec, - std::set<DegreeOfFreedom> &dofs) -{ - std::set<DegreeOfFreedom>::iterator dofsIt; - std::set<DegreeOfFreedom>::iterator dofsEnd = dofs.end(); - - for(dofsIt = dofs.begin(); dofsIt != dofsEnd; ++dofsIt) { - operator[](*dofsIt) = dofVec[*dofsIt]; - } -} - -template<typename T> -T& SparseVector<T>::operator[](DegreeOfFreedom i) -{ - int physIndex = (*logToPhys_)[i]; - -// vec_.resize(physToLog_->size(), 0.0); - - if(physIndex == 0) { - vec_.push_back(0.0); - (*physToLog_).push_back(i); - physIndex = (*logToPhys_)[i] = static_cast<int>(vec_.size()); - - typename std::vector<SparseVector<T>*>::iterator clientIt, clientEnd; - if(master_) { - clientEnd = master_->clients_.end(); - master_->vec_.resize(physToLog_->size(), 0.0); - for(clientIt = master_->clients_.begin(); clientIt != clientEnd; ++clientIt) { - (*clientIt)->vec_.resize(physToLog_->size(), 0.0); - } - } else { - clientEnd = clients_.end(); - for(clientIt = clients_.begin(); clientIt != clientEnd; ++clientIt) { - (*clientIt)->vec_.resize(physToLog_->size(), 0.0); - } - } - } - - return vec_[physIndex-1]; -} - -template<typename T> -const T& SparseVector<T>::operator[](DegreeOfFreedom i) const -{ - return (*const_cast<SparseVector*>(this))[i]; -} - -template<typename T> -void SparseVector<T>::clear(bool eraseEntries) -{ -// if(master_ && eraseEntries) { -// (*logToPhys_).clear(); -// (*physToLog_).resize(0); -// vec_.resize(0); -// } else { -// vec_.resize(physToLog_->size(), 0.0); - typename std::vector<T>::iterator vecIt, vecEnd = vec_.end(); - for(vecIt = vec_.begin(); vecIt != vecEnd; ++vecIt) { - *vecIt = 0; - } -// } -} - -template<typename T> -void SparseVector<T>::copy(SparseVector<T> &x, - const std::set<DegreeOfFreedom> &dofSet) -{ - std::set<DegreeOfFreedom>::iterator dofIt, dofEnd = dofSet.end(); - for(dofIt = dofSet.begin(); dofIt != dofEnd; ++dofIt) { - operator[](*dofIt) = x[*dofIt]; - } -} - -template<typename T> -void SparseVector<T>::copy(SparseVector<T> &x, - const std::vector<DegreeOfFreedom> &dofSet) -{ - std::vector<DegreeOfFreedom>::iterator dofIt, - dofEnd = const_cast< std::vector<DegreeOfFreedom>&>(dofSet).end(); - for(dofIt = const_cast< std::vector<DegreeOfFreedom>&>(dofSet).begin(); - dofIt != dofEnd; - ++dofIt) - { - operator[](*dofIt) = x[*dofIt]; - } -} - -} -- GitLab