Commit fec8463a authored by Thomas Witkowski's avatar Thomas Witkowski

Removed some incorrect usage of c++ in DOFVector.

parent d7ab2718
......@@ -333,7 +333,6 @@ namespace AMDiS {
/// Empty constructor. No initialization!
DOFVector()
: DOFVectorBase<T>(),
feSpace(NULL),
coarsenOperation(NO_OPERATION)
{}
......@@ -347,9 +346,9 @@ namespace AMDiS {
DOFVector(const DOFVector& rhs)
{
*this = rhs;
name = rhs.name + "copy";
if (feSpace && feSpace->getAdmin())
(dynamic_cast<DOFAdmin*>(feSpace->getAdmin()))->addDOFIndexed(this);
this->name = rhs.name + "copy";
if (this->feSpace && this->feSpace->getAdmin())
(dynamic_cast<DOFAdmin*>(this->feSpace->getAdmin()))->addDOFIndexed(this);
}
/// Destructor
......@@ -407,7 +406,7 @@ namespace AMDiS {
/// Returns used size of the vector.
inline int getUsedSize() const
{
return feSpace->getAdmin()->getUsedSize();
return this->feSpace->getAdmin()->getUsedSize();
}
/// Resizes \ref vec to n
......@@ -577,12 +576,6 @@ namespace AMDiS {
static int DoubleWell_fct(ElInfo* elinfo);
protected:
/// Name of this DOFVector
std::string name;
/// FiniteElemSpace of the vector
const FiniteElemSpace *feSpace;
/// Data container
std::vector<T> vec;
......
......@@ -109,25 +109,25 @@ namespace AMDiS {
: DOFVectorBase<T>(f, n),
coarsenOperation(NO_OPERATION)
{
vec.resize(0);
init(f, n);
}
template<typename T>
void DOFVector<T>::init(const FiniteElemSpace* f, std::string n)
{
name = n;
feSpace = f;
if (feSpace && feSpace->getAdmin())
(feSpace->getAdmin())->addDOFIndexed(this);
this->name = n;
this->feSpace = f;
if (this->feSpace && this->feSpace->getAdmin())
(this->feSpace->getAdmin())->addDOFIndexed(this);
this->boundaryManager = new BoundaryManager(f);
}
template<typename T>
DOFVector<T>::~DOFVector()
{
if (feSpace && feSpace->getAdmin())
(feSpace->getAdmin())->removeDOFIndexed(this);
if (this->feSpace && this->feSpace->getAdmin())
(this->feSpace->getAdmin())->removeDOFIndexed(this);
if (this->boundaryManager)
delete this->boundaryManager;
......@@ -179,7 +179,7 @@ namespace AMDiS {
{
FUNCNAME("DOFVector<T>::nrm2()");
checkFeSpace(feSpace, vec);
checkFeSpace(this->feSpace, vec);
double nrm = 0.0;
Iterator vecIterator(dynamic_cast<DOFIndexed<T>*>(const_cast<DOFVector<T>*>(this)),
......@@ -195,7 +195,7 @@ namespace AMDiS {
{
FUNCNAME("DOFVector<T>::nrm2()");
checkFeSpace(feSpace, vec);
checkFeSpace(this->feSpace, vec);
double nrm = 0.0;
Iterator vecIterator(dynamic_cast<DOFIndexed<T>*>(const_cast<DOFVector<T>*>(this)),
......@@ -211,7 +211,7 @@ namespace AMDiS {
{
FUNCNAME("DOFVector<T>::asum()");
checkFeSpace(feSpace, vec);
checkFeSpace(this->feSpace, vec);
double nrm = 0.0;
Iterator vecIterator(dynamic_cast<DOFIndexed<T>*>(const_cast<DOFVector<T>*>(this)),
......@@ -227,7 +227,7 @@ namespace AMDiS {
{
FUNCNAME("DOFVector<T>::sum()");
checkFeSpace(feSpace, vec);
checkFeSpace(this->feSpace, vec);
double nrm = 0.0;
Iterator vecIterator(dynamic_cast<DOFIndexed<T>*>(const_cast<DOFVector<T>*>(this)),
......@@ -243,7 +243,7 @@ namespace AMDiS {
{
FUNCNAME("DOFVector<T>::set()");
checkFeSpace(feSpace, vec);
checkFeSpace(this->feSpace, vec);
Iterator vecIterator(dynamic_cast<DOFIndexed<T>*>(this), USED_DOFS);
for (vecIterator.reset(); !vecIterator.end(); ++vecIterator)
......@@ -256,11 +256,12 @@ namespace AMDiS {
{
FUNCNAME("DOFVector<T>::copy()");
checkFeSpace(feSpace, vec);
checkFeSpace(this->feSpace, vec);
TEST_EXIT_DBG(static_cast<int>(x.vec.size()) >= feSpace->getAdmin()->getUsedSize())
TEST_EXIT_DBG(static_cast<int>(x.vec.size()) >=
this->feSpace->getAdmin()->getUsedSize())
("x.size = %d too small: admin->sizeUsed = %d\n", x.vec.size(),
feSpace->getAdmin()->getUsedSize());
this->feSpace->getAdmin()->getUsedSize());
Iterator vecIterator(dynamic_cast<DOFIndexed<T>*>(this), USED_DOFS);
Iterator xIterator(dynamic_cast<DOFVector<T>*>(const_cast<DOFVector<T>*>(&x)),
......@@ -276,7 +277,7 @@ namespace AMDiS {
{
FUNCNAME("DOFVector<T>::min()");
checkFeSpace(feSpace, vec);
checkFeSpace(this->feSpace, vec);
T m;
Iterator vecIterator(const_cast<DOFIndexed<T>*>(dynamic_cast<const DOFIndexed<T>*>(this)), USED_DOFS);
......@@ -291,7 +292,7 @@ namespace AMDiS {
{
FUNCNAME("DOFVector<T>::max()");
checkFeSpace(feSpace, vec);
checkFeSpace(this->feSpace, vec);
T m;
Iterator vecIterator(const_cast<DOFIndexed<T>*>(dynamic_cast<const DOFIndexed<T>*>(this)), USED_DOFS);
......@@ -315,10 +316,10 @@ namespace AMDiS {
const DOFAdmin *admin = NULL;
const char *format;
if (feSpace)
admin = feSpace->getAdmin();
if (this->feSpace)
admin = this->feSpace->getAdmin();
MSG("Vec `%s':\n", name.c_str());
MSG("Vec `%s':\n", this->name.c_str());
int j = 0;
if (admin) {
if (admin->getUsedSize() > 100)
......@@ -450,22 +451,19 @@ namespace AMDiS {
{
FUNCNAME("DOFVector::Int()");
Mesh* mesh = feSpace->getMesh();
Mesh* mesh = this->feSpace->getMesh();
if (!q) {
int deg = 2 * feSpace->getBasisFcts()->getDegree();
int deg = 2 * this->feSpace->getBasisFcts()->getDegree();
q = Quadrature::provideQuadrature(this->dim, deg);
}
quad_fast = FastQuadrature::provideFastQuadrature(feSpace->getBasisFcts(), *q, INIT_PHI);
quad_fast = FastQuadrature::provideFastQuadrature(this->feSpace->getBasisFcts(),
*q, INIT_PHI);
norm = 0.0;
traverseVector = const_cast<DOFVector<T>*>(this);
mesh->traverse(-1,
Mesh::CALL_LEAF_EL|
Mesh::FILL_COORDS |
Mesh::FILL_DET,
Int_fct);
mesh->traverse(-1, Mesh::CALL_LEAF_EL | Mesh::FILL_COORDS | Mesh::FILL_DET, Int_fct);
return norm;
}
......@@ -492,19 +490,17 @@ namespace AMDiS {
FUNCNAME("DOFVector::L1Norm()");
if (!q) {
int deg = 2 * feSpace->getBasisFcts()->getDegree();
int deg = 2 * this->feSpace->getBasisFcts()->getDegree();
q = Quadrature::provideQuadrature(this->dim, deg);
}
quad_fast = FastQuadrature::provideFastQuadrature(feSpace->getBasisFcts(),*q,INIT_PHI);
quad_fast = FastQuadrature::provideFastQuadrature(this-> feSpace->getBasisFcts(),
*q, INIT_PHI);
norm = 0.0;
traverseVector = const_cast<DOFVector<T>*>(this);
Mesh* mesh = feSpace->getMesh();
Mesh* mesh = this->feSpace->getMesh();
mesh->traverse(-1,
Mesh::CALL_LEAF_EL|
Mesh::FILL_COORDS |
Mesh::FILL_DET,
mesh->traverse(-1, Mesh::CALL_LEAF_EL | Mesh::FILL_COORDS | Mesh::FILL_DET,
L1Norm_fct);
return norm;
......@@ -533,17 +529,16 @@ namespace AMDiS {
FUNCNAME("DOFVector::L2NormSquare()");
if (!q) {
int deg = 2 * feSpace->getBasisFcts()->getDegree();
int deg = 2 * this->feSpace->getBasisFcts()->getDegree();
q = Quadrature::provideQuadrature(this->dim, deg);
}
quad_fast = FastQuadrature::provideFastQuadrature(feSpace->getBasisFcts(),
*q,
INIT_PHI);
quad_fast = FastQuadrature::provideFastQuadrature(this->feSpace->getBasisFcts(),
*q, INIT_PHI);
norm = 0.0;
traverseVector = const_cast<DOFVector<T>*>(this);
Mesh* mesh = feSpace->getMesh();
Mesh* mesh = this->feSpace->getMesh();
mesh->traverse(-1, Mesh::CALL_LEAF_EL | Mesh::FILL_COORDS | Mesh::FILL_DET,
L2Norm_fct);
......@@ -595,20 +590,19 @@ namespace AMDiS {
FUNCNAME("DOFVector::H1NormSquare()");
if (!q) {
int deg = 2 * feSpace->getBasisFcts()->getDegree() - 2;
int deg = 2 * this->feSpace->getBasisFcts()->getDegree() - 2;
q = Quadrature::provideQuadrature(this->dim, deg);
}
quad_fast = FastQuadrature::provideFastQuadrature(feSpace->getBasisFcts(),
quad_fast = FastQuadrature::provideFastQuadrature(this->feSpace->getBasisFcts(),
*q, INIT_GRD_PHI);
norm = 0.0;
traverseVector = const_cast<DOFVector<T>*>(this);
Mesh *mesh = feSpace->getMesh();
Mesh *mesh = this->feSpace->getMesh();
mesh->traverse(-1, Mesh::CALL_LEAF_EL | Mesh::FILL_COORDS |
Mesh::FILL_DET | Mesh::FILL_GRD_LAMBDA,
H1Norm_fct);
mesh->traverse(-1, Mesh::CALL_LEAF_EL | Mesh::FILL_COORDS | Mesh::FILL_DET |
Mesh::FILL_GRD_LAMBDA, H1Norm_fct);
return norm;
}
......@@ -646,8 +640,7 @@ namespace AMDiS {
template<typename T>
DOFVector<T>& DOFVector<T>::operator=(const DOFVector<T>& rhs)
{
feSpace = rhs.feSpace;
DOFVectorBase<T>::feSpace = rhs.feSpace;
this->feSpace = rhs.feSpace;
this->nBasFcts = rhs.nBasFcts;
vec = rhs.vec;
this->elementVector.change_dim(this->nBasFcts);
......@@ -1082,15 +1075,15 @@ namespace AMDiS {
FUNCNAME("DOFVector::DoubleWell()");
if (!q) {
int deg = 2 * feSpace->getBasisFcts()->getDegree();
int deg = 2 * this->feSpace->getBasisFcts()->getDegree();
q = Quadrature::provideQuadrature(this->dim, deg);
}
quad_fast = FastQuadrature::provideFastQuadrature(feSpace->getBasisFcts(),
quad_fast = FastQuadrature::provideFastQuadrature(this->feSpace->getBasisFcts(),
*q, INIT_PHI);
norm = 0.0;
traverseVector = const_cast<DOFVector<T>*>(this);
Mesh* mesh = feSpace->getMesh();
Mesh* mesh = this->feSpace->getMesh();
mesh->traverse(-1, Mesh::CALL_LEAF_EL | Mesh::FILL_COORDS | Mesh::FILL_DET,
DoubleWell_fct);
......
......@@ -9,15 +9,12 @@
namespace AMDiS {
ProblemInstat::~ProblemInstat()
{
}
{}
void ProblemInstat::initialize(Flag initFlag,
ProblemInstat *adoptProblem/* = NULL*/,
Flag adoptFlag /* = INIT_NOTHING*/)
{
FUNCNAME("ProblemInstat::initialize()");
}
{}
void ProblemInstat::solveInitialProblem(AdaptInfo *adaptInfo)
{
......@@ -45,7 +42,7 @@ namespace AMDiS {
}
ProblemInstatScal::ProblemInstatScal(char* name_,
ProblemInstatScal::ProblemInstatScal(std::string name_,
ProblemScal *prob,
ProblemStatBase *initialProb)
: ProblemInstat(name_, initialProb),
......@@ -115,7 +112,7 @@ namespace AMDiS {
problemStat->writeFiles(adaptInfo, force);
}
ProblemInstatVec::ProblemInstatVec(char* name_,
ProblemInstatVec::ProblemInstatVec(std::string name_,
ProblemVec *prob,
ProblemStatBase *initialProb)
: ProblemInstat(name_, initialProb),
......@@ -134,7 +131,7 @@ namespace AMDiS {
{
FUNCNAME("ProblemInstatVec::initialize()");
ProblemInstat::initialize(initFlag,adoptProblem,adoptFlag);
ProblemInstat::initialize(initFlag, adoptProblem, adoptFlag);
// === create vector for old solution ===
if (oldSolution) {
......
......@@ -115,7 +115,7 @@ namespace AMDiS {
{
public:
/// Constructs a ProblemInstatScal with prob as its stationary problem.
ProblemInstatScal(char* name,
ProblemInstatScal(std::string name,
ProblemScal *prob,
ProblemStatBase *initialProb = NULL);
......@@ -175,7 +175,7 @@ namespace AMDiS {
{
public:
/// Constructs a ProblemInstatVec with prob as its stationary problem.
ProblemInstatVec(char *name,
ProblemInstatVec(std::string name,
ProblemVec *prob,
ProblemStatBase *initialProb = NULL);
......
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