Commit 386a66c2 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Simplification of assembling on different meshes.

parent c3474ca2
...@@ -101,7 +101,6 @@ $(SOURCE_DIR)/Assembler.h $(SOURCE_DIR)/Assembler.cc \ ...@@ -101,7 +101,6 @@ $(SOURCE_DIR)/Assembler.h $(SOURCE_DIR)/Assembler.cc \
$(SOURCE_DIR)/AdaptInfo.h $(SOURCE_DIR)/AdaptInfo.cc \ $(SOURCE_DIR)/AdaptInfo.h $(SOURCE_DIR)/AdaptInfo.cc \
$(SOURCE_DIR)/Marker.h $(SOURCE_DIR)/Marker.cc \ $(SOURCE_DIR)/Marker.h $(SOURCE_DIR)/Marker.cc \
$(SOURCE_DIR)/SystemVector.h \ $(SOURCE_DIR)/SystemVector.h \
$(SOURCE_DIR)/MatrixVector.h $(SOURCE_DIR)/MatrixVector.cc \
$(SOURCE_DIR)/SurfaceQuadrature.h $(SOURCE_DIR)/SurfaceQuadrature.cc \ $(SOURCE_DIR)/SurfaceQuadrature.h $(SOURCE_DIR)/SurfaceQuadrature.cc \
$(SOURCE_DIR)/LeafData.h $(SOURCE_DIR)/LeafData.cc \ $(SOURCE_DIR)/LeafData.h $(SOURCE_DIR)/LeafData.cc \
$(SOURCE_DIR)/BoundaryManager.h $(SOURCE_DIR)/BoundaryManager.cc \ $(SOURCE_DIR)/BoundaryManager.h $(SOURCE_DIR)/BoundaryManager.cc \
......
...@@ -125,9 +125,7 @@ am__libamdis_la_SOURCES_DIST = $(PARALLEL_DIR)/ConditionalEstimator.h \ ...@@ -125,9 +125,7 @@ am__libamdis_la_SOURCES_DIST = $(PARALLEL_DIR)/ConditionalEstimator.h \
$(SOURCE_DIR)/Assembler.h $(SOURCE_DIR)/Assembler.cc \ $(SOURCE_DIR)/Assembler.h $(SOURCE_DIR)/Assembler.cc \
$(SOURCE_DIR)/AdaptInfo.h $(SOURCE_DIR)/AdaptInfo.cc \ $(SOURCE_DIR)/AdaptInfo.h $(SOURCE_DIR)/AdaptInfo.cc \
$(SOURCE_DIR)/Marker.h $(SOURCE_DIR)/Marker.cc \ $(SOURCE_DIR)/Marker.h $(SOURCE_DIR)/Marker.cc \
$(SOURCE_DIR)/SystemVector.h $(SOURCE_DIR)/MatrixVector.h \ $(SOURCE_DIR)/SystemVector.h $(SOURCE_DIR)/SurfaceQuadrature.h \
$(SOURCE_DIR)/MatrixVector.cc \
$(SOURCE_DIR)/SurfaceQuadrature.h \
$(SOURCE_DIR)/SurfaceQuadrature.cc $(SOURCE_DIR)/LeafData.h \ $(SOURCE_DIR)/SurfaceQuadrature.cc $(SOURCE_DIR)/LeafData.h \
$(SOURCE_DIR)/LeafData.cc $(SOURCE_DIR)/BoundaryManager.h \ $(SOURCE_DIR)/LeafData.cc $(SOURCE_DIR)/BoundaryManager.h \
$(SOURCE_DIR)/BoundaryManager.cc \ $(SOURCE_DIR)/BoundaryManager.cc \
...@@ -243,13 +241,12 @@ am_libamdis_la_OBJECTS = $(am__objects_1) libamdis_la-DOFIndexed.lo \ ...@@ -243,13 +241,12 @@ am_libamdis_la_OBJECTS = $(am__objects_1) libamdis_la-DOFIndexed.lo \
libamdis_la-FirstOrderAssembler.lo \ libamdis_la-FirstOrderAssembler.lo \
libamdis_la-SecondOrderAssembler.lo libamdis_la-Assembler.lo \ libamdis_la-SecondOrderAssembler.lo libamdis_la-Assembler.lo \
libamdis_la-AdaptInfo.lo libamdis_la-Marker.lo \ libamdis_la-AdaptInfo.lo libamdis_la-Marker.lo \
libamdis_la-MatrixVector.lo libamdis_la-SurfaceQuadrature.lo \ libamdis_la-SurfaceQuadrature.lo libamdis_la-LeafData.lo \
libamdis_la-LeafData.lo libamdis_la-BoundaryManager.lo \ libamdis_la-BoundaryManager.lo libamdis_la-DirichletBC.lo \
libamdis_la-DirichletBC.lo libamdis_la-RobinBC.lo \ libamdis_la-RobinBC.lo libamdis_la-FileWriter.lo \
libamdis_la-FileWriter.lo libamdis_la-ElementFileWriter.lo \ libamdis_la-ElementFileWriter.lo libamdis_la-ElInfo.lo \
libamdis_la-ElInfo.lo libamdis_la-ElInfoStack.lo \ libamdis_la-ElInfoStack.lo libamdis_la-Operator.lo \
libamdis_la-Operator.lo libamdis_la-Mesh.lo \ libamdis_la-Mesh.lo libamdis_la-AdaptStationary.lo \
libamdis_la-AdaptStationary.lo \
libamdis_la-AdaptInstationary.lo libamdis_la-DOFVector.lo \ libamdis_la-AdaptInstationary.lo libamdis_la-DOFVector.lo \
libamdis_la-Estimator.lo libamdis_la-ProblemInstat.lo \ libamdis_la-Estimator.lo libamdis_la-ProblemInstat.lo \
libamdis_la-ProblemNonLin.lo libamdis_la-NonLinUpdater.lo \ libamdis_la-ProblemNonLin.lo libamdis_la-NonLinUpdater.lo \
...@@ -498,7 +495,6 @@ $(SOURCE_DIR)/Assembler.h $(SOURCE_DIR)/Assembler.cc \ ...@@ -498,7 +495,6 @@ $(SOURCE_DIR)/Assembler.h $(SOURCE_DIR)/Assembler.cc \
$(SOURCE_DIR)/AdaptInfo.h $(SOURCE_DIR)/AdaptInfo.cc \ $(SOURCE_DIR)/AdaptInfo.h $(SOURCE_DIR)/AdaptInfo.cc \
$(SOURCE_DIR)/Marker.h $(SOURCE_DIR)/Marker.cc \ $(SOURCE_DIR)/Marker.h $(SOURCE_DIR)/Marker.cc \
$(SOURCE_DIR)/SystemVector.h \ $(SOURCE_DIR)/SystemVector.h \
$(SOURCE_DIR)/MatrixVector.h $(SOURCE_DIR)/MatrixVector.cc \
$(SOURCE_DIR)/SurfaceQuadrature.h $(SOURCE_DIR)/SurfaceQuadrature.cc \ $(SOURCE_DIR)/SurfaceQuadrature.h $(SOURCE_DIR)/SurfaceQuadrature.cc \
$(SOURCE_DIR)/LeafData.h $(SOURCE_DIR)/LeafData.cc \ $(SOURCE_DIR)/LeafData.h $(SOURCE_DIR)/LeafData.cc \
$(SOURCE_DIR)/BoundaryManager.h $(SOURCE_DIR)/BoundaryManager.cc \ $(SOURCE_DIR)/BoundaryManager.h $(SOURCE_DIR)/BoundaryManager.cc \
...@@ -742,7 +738,6 @@ distclean-compile: ...@@ -742,7 +738,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-MacroReader.Plo@am__quote@ @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-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-Marker.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-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-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-Mesh.Plo@am__quote@
...@@ -1052,13 +1047,6 @@ libamdis_la-Marker.lo: $(SOURCE_DIR)/Marker.cc ...@@ -1052,13 +1047,6 @@ libamdis_la-Marker.lo: $(SOURCE_DIR)/Marker.cc
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @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-Marker.lo `test -f '$(SOURCE_DIR)/Marker.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/Marker.cc @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -c -o libamdis_la-Marker.lo `test -f '$(SOURCE_DIR)/Marker.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/Marker.cc
libamdis_la-MatrixVector.lo: $(SOURCE_DIR)/MatrixVector.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-MatrixVector.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-MatrixVector.Tpo" -c -o libamdis_la-MatrixVector.lo `test -f '$(SOURCE_DIR)/MatrixVector.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/MatrixVector.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-MatrixVector.Tpo" "$(DEPDIR)/libamdis_la-MatrixVector.Plo"; else rm -f "$(DEPDIR)/libamdis_la-MatrixVector.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(SOURCE_DIR)/MatrixVector.cc' object='libamdis_la-MatrixVector.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-MatrixVector.lo `test -f '$(SOURCE_DIR)/MatrixVector.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/MatrixVector.cc
libamdis_la-SurfaceQuadrature.lo: $(SOURCE_DIR)/SurfaceQuadrature.cc libamdis_la-SurfaceQuadrature.lo: $(SOURCE_DIR)/SurfaceQuadrature.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-SurfaceQuadrature.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-SurfaceQuadrature.Tpo" -c -o libamdis_la-SurfaceQuadrature.lo `test -f '$(SOURCE_DIR)/SurfaceQuadrature.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/SurfaceQuadrature.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-SurfaceQuadrature.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-SurfaceQuadrature.Tpo" -c -o libamdis_la-SurfaceQuadrature.lo `test -f '$(SOURCE_DIR)/SurfaceQuadrature.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/SurfaceQuadrature.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-SurfaceQuadrature.Tpo" "$(DEPDIR)/libamdis_la-SurfaceQuadrature.Plo"; else rm -f "$(DEPDIR)/libamdis_la-SurfaceQuadrature.Tpo"; exit 1; fi @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-SurfaceQuadrature.Tpo" "$(DEPDIR)/libamdis_la-SurfaceQuadrature.Plo"; else rm -f "$(DEPDIR)/libamdis_la-SurfaceQuadrature.Tpo"; exit 1; fi
......
...@@ -26,6 +26,22 @@ namespace AMDiS { ...@@ -26,6 +26,22 @@ namespace AMDiS {
{0.5, 0.0}}; {0.5, 0.0}};
mtl::dense2D<double> ElInfo1d::mat_d1_right(mat_d1_right_val); mtl::dense2D<double> ElInfo1d::mat_d1_right(mat_d1_right_val);
double ElInfo1d::mat_d2_val[3][3] = {{1.0, 0.0, 0.0},
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0}};
mtl::dense2D<double> ElInfo1d::mat_d2(mat_d2_val);
double ElInfo1d::mat_d2_left_val[3][3] = {{1.0, 0.375, 0.0},
{0.0, 0.75, 1.0},
{0.0, -0.125, 0.0}};
mtl::dense2D<double> ElInfo1d::mat_d2_left(mat_d2_left_val);
double ElInfo1d::mat_d2_right_val[3][3] = {{0.0, -0.125, 0.0},
{1.0, 0.75, 0.0},
{0.0, 0.375, 1.0}};
mtl::dense2D<double> ElInfo1d::mat_d2_right(mat_d2_right_val);
void ElInfo1d::fillMacroInfo(const MacroElement * mel) void ElInfo1d::fillMacroInfo(const MacroElement * mel)
{ {
FUNCNAME("ElInfo1d::fillMacroInfo()"); FUNCNAME("ElInfo1d::fillMacroInfo()");
...@@ -283,9 +299,19 @@ namespace AMDiS { ...@@ -283,9 +299,19 @@ namespace AMDiS {
void ElInfo1d::getRefSimplexCoords(const BasisFunction *basisFcts, void ElInfo1d::getRefSimplexCoords(const BasisFunction *basisFcts,
mtl::dense2D<double>& coords) const mtl::dense2D<double>& coords) const
{ {
TEST_EXIT(basisFcts->getDegree() == 1)("Wrong basis function degree!\n"); FUNCNAME("ElInfo1d::getRefSimplexCoords()");
coords = mat_d1; switch (basisFcts->getDegree()) {
case 1:
coords = mat_d1;
break;
case 2:
coords = mat_d2;
break;
default:
ERROR_EXIT("Not implemented for basis function with degree %d!\n",\
basisFcts->getDegree());
}
} }
void ElInfo1d::getSubElementCoords(const BasisFunction *basisFcts, void ElInfo1d::getSubElementCoords(const BasisFunction *basisFcts,
...@@ -303,6 +329,11 @@ namespace AMDiS { ...@@ -303,6 +329,11 @@ namespace AMDiS {
break; break;
case 2: case 2:
if (iChild == 0)
coords *= mat_d2_left;
else
coords *= mat_d2_right;
break; break;
default: default:
ERROR_EXIT("Not yet implemented!\n"); ERROR_EXIT("Not yet implemented!\n");
......
...@@ -80,6 +80,19 @@ namespace AMDiS { ...@@ -80,6 +80,19 @@ namespace AMDiS {
static double mat_d1_right_val[2][2]; static double mat_d1_right_val[2][2];
static mtl::dense2D<double> mat_d1_right; static mtl::dense2D<double> mat_d1_right;
static double mat_d2_val[3][3];
static mtl::dense2D<double> mat_d2;
static double mat_d2_left_val[3][3];
static mtl::dense2D<double> mat_d2_left;
static double mat_d2_right_val[3][3];
static mtl::dense2D<double> mat_d2_right;
}; };
} }
......
#include "MatrixVector.h"
#include "DOFVector.h"
namespace AMDiS {
template<>
void Matrix<double>::invert2x2()
{
TEST_EXIT(rows == 2)("WRONG\n");
TEST_EXIT(cols == 2)("WRONG\n");
double det = 1 / (valArray[0] * valArray[3] - valArray[1] * valArray[2]);
double tmp = valArray[0];
valArray[0] = det * valArray[3];
valArray[3] = det * tmp;
valArray[1] *= -det;
valArray[2] *= -det;
}
}
...@@ -24,20 +24,16 @@ ...@@ -24,20 +24,16 @@
#include <vector> #include <vector>
#include "Global.h" #include "Global.h"
#include "MemoryManager.h" #include "AMDiS_fwd.h"
#include "Serializable.h" #include "Serializable.h"
namespace AMDiS { namespace AMDiS {
template<typename T> class DOFVector;
/// Class for efficient vector operations of fixed size numerical vectors. /// Class for efficient vector operations of fixed size numerical vectors.
template<typename T> template<typename T>
class Vector : public Serializable class Vector : public Serializable
{ {
public: public:
MEMORY_MANAGED(Vector<T>);
/// Constructor. /// Constructor.
Vector(int i = 0) Vector(int i = 0)
: size(i) : size(i)
...@@ -224,8 +220,6 @@ namespace AMDiS { ...@@ -224,8 +220,6 @@ namespace AMDiS {
class Matrix : public Vector<T> class Matrix : public Vector<T>
{ {
public: public:
MEMORY_MANAGED(Matrix<T>);
/// Constructor. /// Constructor.
Matrix(int r, int c) Matrix(int r, int c)
: Vector<T>(r * c), : Vector<T>(r * c),
...@@ -299,8 +293,6 @@ namespace AMDiS { ...@@ -299,8 +293,6 @@ namespace AMDiS {
} }
} }
void invert2x2();
protected: protected:
/// Number of matrix rows. /// Number of matrix rows.
int rows; int rows;
......
...@@ -51,7 +51,6 @@ namespace AMDiS { ...@@ -51,7 +51,6 @@ namespace AMDiS {
if ((opTerms == assTerms) && if ((opTerms == assTerms) &&
((*subAssemblers)[i]->getQuadrature() == quad)) { ((*subAssemblers)[i]->getQuadrature() == quad)) {
return dynamic_cast<ZeroOrderAssembler*>((*subAssemblers)[i]); return dynamic_cast<ZeroOrderAssembler*>((*subAssemblers)[i]);
} }
} }
...@@ -150,6 +149,29 @@ namespace AMDiS { ...@@ -150,6 +149,29 @@ namespace AMDiS {
TEST_EXIT((nRow <= 3) && (nCol <= 3))("not yet!\n"); TEST_EXIT((nRow <= 3) && (nCol <= 3))("not yet!\n");
calculateElementMatrix(smallElInfo, mat);
const mtl::dense2D<double>& m = smallElInfo->getSubElemCoordsMat();
ElementMatrix tmpMat(nRow, nRow);
for (int i = 0; i < nRow; i++) {
for (int j = 0; j < nRow; j++) {
tmpMat[i][j] = 0.0;
for (int k = 0; k < nRow; k++) {
tmpMat[i][j] += m[i][j] * (*mat)[j][i];
}
}
}
for (int i = 0; i < nRow; i++) {
for (int j = 0; j < nRow; j++) {
(*mat)[i][j] = tmpMat[i][j];
}
}
/*
const BasisFunction *psi = owner->getRowFESpace()->getBasisFcts(); const BasisFunction *psi = owner->getRowFESpace()->getBasisFcts();
const BasisFunction *phi = owner->getColFESpace()->getBasisFcts(); const BasisFunction *phi = owner->getColFESpace()->getBasisFcts();
const mtl::dense2D<double>& m = smallElInfo->getSubElemCoordsMat(); const mtl::dense2D<double>& m = smallElInfo->getSubElemCoordsMat();
...@@ -179,6 +201,8 @@ namespace AMDiS { ...@@ -179,6 +201,8 @@ namespace AMDiS {
} }
} }
} }
*/
} }
void StandardZOA::calculateElementVector(const ElInfo *elInfo, ElementVector *vec) void StandardZOA::calculateElementVector(const ElInfo *elInfo, ElementVector *vec)
...@@ -422,9 +446,8 @@ namespace AMDiS { ...@@ -422,9 +446,8 @@ namespace AMDiS {
int myRank = omp_get_thread_num(); int myRank = omp_get_thread_num();
std::vector<double> c(1, 0.0); std::vector<double> c(1, 0.0);
for (termIt = terms[myRank].begin(); termIt != terms[myRank].end(); ++termIt) { for (termIt = terms[myRank].begin(); termIt != terms[myRank].end(); ++termIt)
(static_cast<ZeroOrderTerm*>( *termIt))->getC(elInfo, 1, c); (static_cast<ZeroOrderTerm*>( *termIt))->getC(elInfo, 1, c);
}
c[0] *= elInfo->getDet(); c[0] *= elInfo->getDet();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment