Commit f9b3cffd authored by Thomas Witkowski's avatar Thomas Witkowski

And moved Reinit library to src and updated makefiles.

parent 1829f405
SHELL = /bin/sh
COMPILE = g++
DEFS = -DPACKAGE=\"AMDiS\" -DVERSION=\"0.1\" -DHAVE_DLFCN_H=1
DEBUG = 0
AMDIS_DIR = ../
INCLUDES = -I./src -I$(AMDIS_DIR)/src -I$(AMDIS_DIR)/compositeFEM/src -I$(AMDIS_DIR)/lib/mtl4
ifeq ($(strip $(DEBUG)), 0)
CPPFLAGS = -O2
else
CPPFLAGS = -g -O0
endif
CPPFLAGS += -ftemplate-depth-40
VPATH = .:$(AMDIS_DIR)/Reinit/src
LIBOFILES = \
BoundaryElementDist.o \
BoundaryElementNormalDist.o \
BoundaryElementLevelSetDist.o \
BoundaryElementTopDist.o \
BoundaryElementEdgeDist.o \
ElementLevelSet.o \
ElementUpdate_2d.o \
ElementUpdate_3d.o \
HL_SignedDist.o \
HL_SignedDistTraverse.o \
VelocityExt.o \
VelocityExtFromVelocityField.o \
NormEps.o
all: libreinit.a
# statische Bibliothek
libreinit.a: $(LIBOFILES)
rm -f lib/libreinit.a
ar cq lib/libreinit.a $(LIBOFILES)
.cc.o: $*.cc
$(COMPILE) $(DEFS) $(INCLUDES) $(CPPFLAGS) -c -o $*.o $<
clean:
-rm -rf *.o
This diff is collapsed.
// ============================================================================
// == ==
// == AMDiS - Adaptive multidimensional simulations ==
// == ==
// == http://www.amdis-fem.org ==
// == ==
// ============================================================================
//
// Software License for AMDiS
//
// Copyright (c) 2010 Dresden University of Technology
// All rights reserved.
// Authors: Simon Vey, Thomas Witkowski et al.
//
// This file is part of AMDiS
//
// See also license.opensource.txt in the distribution.
#ifndef HL_SIGNEDDISTLEVELS
#define HL_SIGNEDDISTLEVELS
#include <queue>
#include <vector>
#include <time.h>
#include "ElInfo.h"
#include "FixVec.h"
#include "Traverse.h"
#include "ElementLevelSet.h"
#include "BoundaryElementDist.h"
#include "ElementUpdate.h"
#include "ElementUpdate_2d.h"
#include "ElementUpdate_3d.h"
#include "HL_SignedDist.h"
#include "VelocityExt.h"
#include "SMIAdapter.h"
#include "smi.h"
using namespace AMDiS;
typedef struct
{
int ElNum;
int VertNum;
} Vert_Struct;
class HL_SignedDistLevels : public HL_SignedDist
{
public:
HL_SignedDistLevels(const char *name_,
int dim_,
bool doVelocityExt = false,
Flag velExtType_ = VEL_EXT)
: HL_SignedDist(name_, dim_, doVelocityExt, velExtType_),
smiAdapter(NULL)
{
FUNCNAME("HL_SignedDistLevels::HL_SignedDistLevels()");
// ===== Read parameters from init file. =====
GET_PARAMETER(0, name + "->tolerance", "%f", &tol);
GET_PARAMETER(0, name + "->count_how_often_saved_in_list", "%d", &count_in_list);
GET_PARAMETER(0, name + "->save_in_list->the ..th", "%d", &print_in_list);
GET_PARAMETER(0, name + "->save_in_list->after the ..th traversing of the list", "%d", &print_in_list_2);
GET_PARAMETER(0, name + "->print_level", "%d", &chosen_level);
GET_PARAMETER(0, name + "->print_level_yes_no", "%d", &print_level);
TEST_EXIT(tol > 0)("illegal tolerance !\n");
}
protected:
/**
* Initializes the boundary: calculation of the distance of boundary
* vertices to the interface.
* Interface is given by \ref lS_DOF and result is stored in
* \ref sD_DOF.
*/
void initializeBoundary();
/**
* function for transvering Mesh to SMi an Adding the quantities
**/
void Mesh_to_SMI_and_quantity ();
/**
* function for creating the first list, in which elementnumber of
* boundary-elements are saved
*/
void createFirstList(const int elStatus,
const int *elVertStatusVec,
int ElNum,
const int NumVertIntPoints);
/**
* Calculates the distance function and stores result in sD_DOF.
* Requirement: The boundary values are already set in \ref sD_DOF.
*/
void HL_updateIteration();
/**
* function for traversing the list "List_Element"
* returns 1 if min one element is set in the new list
* returns 0 if no element is set in the new list
*/
int traverseListElement();
/**
* function for creating all levels higher than 1 an saving pairs of
* elements and node in the right list
**/
void createLevels ();
/**
* function collects the next neighbours, creates an according list
* and saves the pair in it
* returns true if one or more neighbours exist and false if not
**/
bool collectNeighbours_setLevels (const int Element,
const int currentIndex,
bool *elementInNewListSet);
/**
* function for traversing the list of list, named "Level_"
**/
void traversingListLevel_ ( DOFVector<double> *boundVal_DOF );
/**
* calls the next neighbours and puts them into the right list
* returns true if an element had to be saved in an lower level
* than the current index
* this means the loop over all lists Level_[i] has to be repaeated again
* "Vert" is a local node
**/
bool search_and_include_comb(int ElNum,
int Vert,
int *nodeIndices,
const int Index);
/**
* checking whether the element "ElNum_in" has to be included into
* the second list
* if yes it will be included
* returns true if the level of the element is smaler than he current index
* returns false if the level is greater thean the current index
* "Vert_1_in" and "Vert_2_in" are localvertizes
*/
bool includeIntoList (int ElNum_in,
int VertNum_1_in,
int VertNum_2_in,
const int Index);
/**
* gets the neighbour according to the node "VertNum_in" and two of
* its nodes (in local koordinates)
* returns "false" if the called neighbour exists and "true" if not
* Vert_Up_in is given in global coordinates, the other points are
* given in local coordinates
*/
bool getNextNeighbour (const int ElNum_in,
const int Vert_Up_in,
const int VertNum_in,
int &ElNum_out,
int &VertNum_1_out,
int &VertNum_2_out);
/**
* function needed in the function "traversingListELVert"
**/
int getNext_node_l_r (int elem_l_r_in,
int neighbour_l_r_in,
int node_l_r_in,
const int Vert);
//==================================
void print_quantity_5 (int cntr);
/**
* function for printinq the quantity 6
* attention: we need at least read_transaction in smi for calling
* this function
**/
void print_quantity_6 ();
//====================================
protected:
/**
* Tolerance for Hopf-Lax update iteration loop.
*/
double tol;
/**
* is needed for transfering the mesh to SMI
*/
SMIAdapter *smiAdapter;
/**
* in this list boundary-elements are saved;
* is needed for creating the list "List_El_Vert"
*/
queue<int> List_Element;
/**
* in this list structs filled with element-number and vertex-number
* are saved;
* is needed for traversing the mesh efficiently
*/
queue<Vert_Struct> Level;
queue<Vert_Struct> helpLevel;
queue<Vert_Struct> List_El_Vert; //Listen noch einmal kontrollieren!
/**
* in this vector the lists of different levels are saved
**/
vector<queue<Vert_Struct> > Level_;
/**
* 0 ->do not count updates
* 1 ->count updates
**/
int count_updates;
/**
* 1 -> it will be count how often a node is saved in the second list
* 0 ->it will not be count
**/
int count_in_list;
int print_in_list;
int print_in_list_2;
/**
* level which will be printed in a file
**/
int chosen_level;
/**
* 1->a special level will be printed in a file
* 0->no level is printed in a file
**/
int print_level;
};
#endif // HL_SIGNEDDISTLEVELS
lib_LTLIBRARIES = libamdis.la libcompositeFEM.la
lib_LTLIBRARIES = libamdis.la libcompositeFEM.la libreinit.la
LIB_DIR = ../lib
PARALLEL_DIR = $(SOURCE_DIR)
......@@ -249,6 +249,21 @@ parallel/ParMetisPartitioner.h \
parallel/PetscSolver.h \
parallel/StdMpi.h \
parallel/ZoltanPartitioner.h \
reinit/BoundaryElementDist.h \
reinit/BoundaryElementEdgeDist.h \
reinit/BoundaryElementLevelSetDist.h \
reinit/BoundaryElementNormalDist.h \
reinit/BoundaryElementTopDist.h \
reinit/ElementLevelSet.h \
reinit/ElementUpdate.h \
reinit/ElementUpdate_2d.h \
reinit/ElementUpdate_3d.h \
reinit/HL_SignedDist.h \
reinit/HL_SignedDistBornemann.h \
reinit/HL_SignedDistTraverse.h \
reinit/NormEps.h \
reinit/VelocityExt.h \
reinit/VelocityExtFromVelocityField.h \
time/RosenbrockAdaptInstationary.h \
time/RosenbrockStationary.h \
time/RosenbrockMethod.h
......@@ -377,3 +392,19 @@ compositeFEM/LevelSetAdaptMesh.cc \
compositeFEM/PenaltyOperator.cc \
compositeFEM/SubElementAssembler.cc \
compositeFEM/SubPolytope.cc
libreinit_la_CXXFLAGS = $(libamdis_la_CXXFLAGS)
libreinit_la_SOURCES = \
reinit/BoundaryElementDist.cc \
reinit/BoundaryElementEdgeDist.cc \
reinit/BoundaryElementLevelSetDist.cc \
reinit/BoundaryElementNormalDist.cc \
reinit/BoundaryElementTopDist.cc \
reinit/ElementLevelSet.cc \
reinit/ElementUpdate_2d.cc \
reinit/ElementUpdate_3d.cc \
reinit/HL_SignedDist.cc \
reinit/HL_SignedDistTraverse.cc \
reinit/NormEps.cc \
reinit/VelocityExt.cc \
reinit/VelocityExtFromVelocityField.cc
\ No newline at end of file
This diff is collapsed.
......@@ -26,7 +26,7 @@ void HL_SignedDistTraverse::initializeBoundary()
int elStatus;
const int nBasFcts = feSpace->getBasisFcts()->getNumber();
if (locInd.size() < nBasFcts)
if (static_cast<int>(locInd.size()) < nBasFcts)
locInd.resize(nBasFcts);
ElInfo *elInfo;
......@@ -101,6 +101,7 @@ void HL_SignedDistTraverse::initializeBoundary()
} // end of: mesh traverse
}
void HL_SignedDistTraverse::HL_updateIteration()
{
// ===== Create DOF vector for the last iteration step. =====
......@@ -150,13 +151,14 @@ void HL_SignedDistTraverse::HL_updateIteration()
cout << "\tnumber of iterations needed: " << itCntr << "\n\n";
}
void HL_SignedDistTraverse::HL_elementUpdate(ElInfo *elInfo)
{
FUNCNAME("HL_SignedDistTraverse::HL_elementUpdate()");
// ===== Get global indices of vertices of element. =====
const int nBasFcts = feSpace->getBasisFcts()->getNumber();
if (locInd.size() < nBasFcts)
if (static_cast<int>(locInd.size()) < nBasFcts)
locInd.resize(nBasFcts);
feSpace->getBasisFcts()->getLocalIndices(
......@@ -195,6 +197,7 @@ void HL_SignedDistTraverse::HL_elementUpdate(ElInfo *elInfo)
}
}
double HL_SignedDistTraverse::calcElementUpdate(ElInfo *elInfo,
int nXh,
const DegreeOfFreedom *locInd)
......@@ -241,6 +244,7 @@ double HL_SignedDistTraverse::calcElementUpdate(ElInfo *elInfo,
return elUpdate->calcElementUpdate(elVert, uhVal);
}
bool HL_SignedDistTraverse::checkTol()
{
DOFVector<double>::Iterator it_sD(sD_DOF, USED_DOFS);
......
......@@ -50,7 +50,7 @@ public:
{
FUNCNAME("VelocityExt::printVelDOF()");
TEST_EXIT(i < velDOF.size())("illegal index !\n");
TEST_EXIT(i < static_cast<int>(velDOF.size()))("Illegal index!\n");
FileWriter *fileWriter = new FileWriter(
"VelocityExt->velocity output",
......@@ -66,7 +66,7 @@ public:
{
FUNCNAME("VelocityExt::printOrigVelDOF()");
TEST_EXIT(i < origVelDOF.size())("illegal index !\n");
TEST_EXIT(i < static_cast<int>(origVelDOF.size()))("Illegal index!\n");
FileWriter *fileWriter = new FileWriter(
"VelocityExt->interface velocity output",
......@@ -75,11 +75,9 @@ public:
fileWriter->writeFiles(adaptInfo, false);
delete fileWriter;
};
}
/**
* Set velocity (one velocity vector).
*/
/// Set velocity (one velocity vector).
void setVelocity(DOFVector<double> *origVelDOF_,
DOFVector<double> *velDOF_)
{
......@@ -97,11 +95,9 @@ public:
origVelDOF.push_back(origVelDOF_);
velDOF.push_back(velDOF_);
};
}
/**
* Set velocity (multiple velocity vectors).
*/
/// Set velocity (multiple velocity vectors).
void setVelocity(std::vector<DOFVector<double> *> &origVelDOF_,
std::vector<DOFVector<double> *> &velDOF_)
{
......@@ -109,8 +105,8 @@ public:
nVelDOFs = origVelDOF_.size();
TEST_EXIT(nVelDOFs > 0)("illegal number of velocity vectors !\n");
TEST_EXIT(nVelDOFs == velDOF_.size())("different sizes !\n");
TEST_EXIT(nVelDOFs > 0)("Illegal number of velocity vectors!\n");
TEST_EXIT(nVelDOFs == static_cast<int>(velDOF_.size()))("Different sizes!\n");
for (int i=0; i<nVelDOFs; ++i) {
TEST_EXIT(origVelDOF_[i])("illegal velocity vector origVelDOF !\n");
......@@ -146,18 +142,27 @@ public:
* indexV is the index of the vertex(with respect to the numeration on the element),
* for that the coordinates shall be stored.
*/
void setBarycentricCoords_2D_boundary(const double &l_0, const double &l_1, const double &l_2, const int indexV);
void setBarycentricCoords_2D_boundary(const double &l_0,
const double &l_1,
const double &l_2,
const int indexV);
/**
* Sets barycentric coordinates for 2D for a vertex on a non-boundary element.
* l_0. l_1, l_2 are the coordinates.
*/
void setBarycentricCoords_2D(const double &l_0, const double &l_1, const double &l_2);
void setBarycentricCoords_2D(const double &l_0,
const double &l_1,
const double &l_2);
/**
* Calculates the barycentric coordinates for 2D for a vertex on a non-boundary element.
* Calculates the barycentric coordinates for 2D for a vertex on a
* non-boundary element.
*/
void calcBarycentricCoords_2D(const double &c_delta, const double &c_alpha, const double &norm_zhminusyh, const double &norm_xhminusyh);
void calcBarycentricCoords_2D(const double &c_delta,
const double &c_alpha,
const double &norm_zhminusyh,
const double &norm_xhminusyh);
/**
* Sets barycentric coordinates for 3D for a vertex on a boundary element
......@@ -166,24 +171,33 @@ public:
* indexV is the index of the vertex(with respect to the numeration on the element),
* for that the coordinates shall be stored.
*/
void setBarycentricCoords_3D_boundary(const double &l_0, const double &l_1, const double &l_2, const double &l_3, const int indexV);
void setBarycentricCoords_3D_boundary(const double &l_0,
const double &l_1,
const double &l_2,
const double &l_3,
const int indexV);
/// Calculates the barycentric coordinates for 3D for a boundary vertex.
void calcBarycentricCoords_3D_boundary(const DimVec<double> sp1,
const DimVec<double> sp2,
const double lambda,
int i);
/**
* Calculates the barycentric coordinates for 3D for a boundary vertex.
* Expands 3 coordinates from a face update to 4 coordinates and stores them in
* lamVec[index]. vertNum is the index of the element face the coordinates
* belong to (0, 1 or 2).
*/
void calcBarycentricCoords_3D_boundary(const DimVec<double> sp1, const DimVec<double> sp2, const double lambda, int i);
void copyAndExpandFaceCoords_3D(int vertNum, int index);
/**
* Expands 3 coordinates from a face update to 4 coordinates and stores them in lamVec[index].
* vertNum is the index of the element face the coordinates belong to(0,1,or 2).
*/
void copyAndExpandFaceCoords_3D(int vertNum,int index);
/**
* Sets barycentric coordinates for 3D for a vertex on a non-boundary element.
* l_0, l_1, l-2, l_3 are the coordinates.
*/
void setBarycentricCoords_3D(const double &l_0, const double &l_1, const double &l_2, const double &l_3);
void setBarycentricCoords_3D(const double &l_0,
const double &l_1,
const double &l_2,
const double &l_3);
/**
* Stores the index of element face with the shortest distance to the interface so far.
......@@ -201,45 +215,29 @@ public:
*/
void setPermutation(int vertNum, int mTrav);
/**
* Sets the permutation.
*/
/// Sets the permutation.
void setPermutation(int vertNum);
/**
* Sets the permutation of the vertices in 2D.
*/
/// Sets the permutation of the vertices in 2D.
void setPermutation_2D(int i_0, int i_1, int i_2);
/**
* Sets the permutation of the vertices in 3D.
*/
/// Sets the permutation of the vertices in 3D.
void setPermutation_3D(int i_0, int i_1, int i_2, int i_3);
/**
* Swaps two vertices in the permutation.
*/
/// Swaps two vertices in the permutation.
void swapVertices(int i1, int i2);
protected:
/**
* Original velocity vector.
*/
/// Original velocity vector.
std::vector<DOFVector<double> *> origVelDOF;
/**
* Dimension of mesh.
*/
/// Dimension of mesh.
int dim;
/**
* Dof vector with extended velocity.
*/
/// DOF vector with extended velocity.
std::vector<DOFVector<double> *> velDOF;
/**
* Number of velocity vectors to be extended.
*/
/// Number of velocity vectors to be extended.