Commit 7c35d72d authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Some optimizations.

parent 03a3f621
...@@ -77,12 +77,11 @@ class ElementLevelSet ...@@ -77,12 +77,11 @@ class ElementLevelSet
mesh = mesh_; mesh = mesh_;
dim = mesh->getDim(); dim = mesh->getDim();
elIntersecPoints = elIntersecPoints = new VectorOfFixVecs<DimVec<double> >(dim,
NEW VectorOfFixVecs<DimVec<double> >(dim,
MAX_INTERSECTION_POINTS, MAX_INTERSECTION_POINTS,
NO_INIT); NO_INIT);
elVertexStatusVec = new int[dim+1]; elVertexStatusVec = new int[dim + 1];
elVertexLevelSetVec = new double[dim+1]; elVertexLevelSetVec = new double[dim + 1];
int setElementLevelSetTol = 0; int setElementLevelSetTol = 0;
GET_PARAMETER(0, name + "->set ElementLevelSet tolerances", "%d", GET_PARAMETER(0, name + "->set ElementLevelSet tolerances", "%d",
...@@ -106,7 +105,7 @@ class ElementLevelSet ...@@ -106,7 +105,7 @@ class ElementLevelSet
if(elVertexLevelSetVec) if(elVertexLevelSetVec)
delete [] elVertexLevelSetVec; delete [] elVertexLevelSetVec;
if (elIntersecPoints) if (elIntersecPoints)
DELETE elIntersecPoints; delete elIntersecPoints;
} }
/** /**
...@@ -138,18 +137,15 @@ class ElementLevelSet ...@@ -138,18 +137,15 @@ class ElementLevelSet
int createElementLevelSet(const ElInfo *elInfo_, int createElementLevelSet(const ElInfo *elInfo_,
const bool doCalcIntersecPts_ = true); const bool doCalcIntersecPts_ = true);
/** /// Gets value of level set function at point given in barycentric coordinates.
* Gets value of level set function at point given in inline double calcLevelSetFct(const DimVec<double>& bary)
* barycentric coordinates. {
*/
inline double calcLevelSetFct(const DimVec<double>& bary) {
return (*lSFct)(bary); return (*lSFct)(bary);
}; }
/** /// Resets level set information on element.
* Resets level set information on element. inline void resetElement()
*/ {
inline void resetElement() {
FUNCNAME("ElementLevelSet::resetElement"); FUNCNAME("ElementLevelSet::resetElement");
numElVertexInterior = 0; numElVertexInterior = 0;
...@@ -157,116 +153,109 @@ class ElementLevelSet ...@@ -157,116 +153,109 @@ class ElementLevelSet
numElVertexExterior = 0; numElVertexExterior = 0;
numIntersecPoints = 0; numIntersecPoints = 0;
elStatus = LEVEL_SET_UNDEFINED; elStatus = LEVEL_SET_UNDEFINED;
}; }
/** /// Defines current element (elInfo).
* Defines current element (elInfo). inline void setElement(const ElInfo *elInfo_)
*/ {
inline void setElement(const ElInfo *elInfo_) {
elInfo = elInfo_; elInfo = elInfo_;
resetElement(); resetElement();
}; }
/**
* Set level_set_domain.
*/
inline void setLevelSetDomain(int status_) {
/// Set level_set_domain.
inline void setLevelSetDomain(int status_)
{
TEST_EXIT(status_ == LEVEL_SET_INTERIOR || TEST_EXIT(status_ == LEVEL_SET_INTERIOR ||
status_ == LEVEL_SET_EXTERIOR || status_ == LEVEL_SET_EXTERIOR ||
status_ == LEVEL_SET_BOUNDARY)("illegal level set status !\n"); status_ == LEVEL_SET_BOUNDARY)("illegal level set status !\n");
level_set_domain = status_; level_set_domain = status_;
}; }
/** /// Functions to set tolerances for intersection point calculation.
* Functions to set tolerances for intersection point calculation. inline void setLsValTol(double tol)
*/ {
inline void setLsValTol(double tol) {LS_VAL_TOL = tol;}; LS_VAL_TOL = tol;
inline void setLsValMin(double min) {LS_VAL_MIN = min;}; }
inline void setSpBaryTol(double tol) {SP_BARY_TOL = tol;};
/** inline void setLsValMin(double min)
* Get level_set_domain. {
*/ LS_VAL_MIN = min;
inline const int& getLevelSetDomain() const { }
inline void setSpBaryTol(double tol)
{
SP_BARY_TOL = tol;
}
/// Get level_set_domain.
inline const int& getLevelSetDomain() const
{
return level_set_domain; return level_set_domain;
}; }
/** /// Get LevelSet-Status of element.
* Get LevelSet-Status of element. inline const int& getElementLevelSetStatus() const
*/ {
inline const int& getElementLevelSetStatus() const {
return elStatus; return elStatus;
}; }
/** /// Get number of vertices which are intersection points.
* Get number of vertices which are intersection points. inline const int& getNumVertIntPoints() const
*/ {
inline const int& getNumVertIntPoints() const {
FUNCNAME("ElementLevelSet::getNumVertIntPoints"); FUNCNAME("ElementLevelSet::getNumVertIntPoints");
TEST_EXIT(numElVertexBoundary == 0)("numElVertexBoundary should be zero!\n"); TEST_EXIT(numElVertexBoundary == 0)("numElVertexBoundary should be zero!\n");
return numElVertexBoundary; return numElVertexBoundary;
}; };
/** /// Get vector elVertexStatusVec.
* Get vector elVertexStatusVec. inline const int *getElVertStatusVec() const
*/ {
inline const int *getElVertStatusVec() const {
return elVertexStatusVec; return elVertexStatusVec;
}; }
/** /// Get i-th component of vector elVertexLevelSetVec.
* Get i-th component of vector elVertexLevelSetVec. inline const double getElVertLevelSetVec(const int i) const
*/ {
inline const double getElVertLevelSetVec(const int i) const {
return elVertexLevelSetVec[i]; return elVertexLevelSetVec[i];
}; }
/** /// Get vector elVertexLevelSetVec.
* Get vector elVertexLevelSetVec. inline const double *getElVertLevelSetVec() const
*/ {
inline const double *getElVertLevelSetVec() const {
return elVertexLevelSetVec; return elVertexLevelSetVec;
}; }
/** /// Get levelSetFct.
* Get levelSetFct. inline ElementFunction<double> *getLevelSetFct() const
*/ {
inline ElementFunction<double> *getLevelSetFct() const {
return lSFct; return lSFct;
}; }
/** /// Get mesh.
* Get mesh. inline Mesh *getMesh() const
*/ {
inline Mesh *getMesh() const {
return mesh; return mesh;
}; }
/** /// Get dim.
* Get dim. inline int getDim() const
*/ {
inline int getDim() const {
return dim; return dim;
}; }
/** /// Get the intersection points.
* Get the intersection points. inline VectorOfFixVecs<DimVec<double> > *getElIntersecPoints() const
*/ {
inline VectorOfFixVecs<DimVec<double> > *getElIntersecPoints() const {
return elIntersecPoints; return elIntersecPoints;
}; }
/** /// Get number of intersection points.
* Get number of intersection points. inline int getNumElIntersecPoints() const
*/ {
inline int getNumElIntersecPoints() const {
return numIntersecPoints; return numIntersecPoints;
}; }
/** /// Calculate exterior normal to intersection plane.
* Calculate exterior normal to intersection plane.
*/
void calcIntersecNormal(WorldVector<double> &normal); void calcIntersecNormal(WorldVector<double> &normal);
/** /**
...@@ -287,9 +276,7 @@ class ElementLevelSet ...@@ -287,9 +276,7 @@ class ElementLevelSet
int getVertexPos(const DimVec<double> barCoords); int getVertexPos(const DimVec<double> barCoords);
protected: protected:
/** /// Calculates level set value of each vertex of element.
* Calculates level set value of each vertex of element.
*/
void calculateElementLevelSetVal(); void calculateElementLevelSetVal();
/** /**
......
This diff is collapsed.
This diff is collapsed.
Supports Markdown
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