Commit a125580e authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

New code style for the first demos.

parent bebadadf
...@@ -43,23 +43,20 @@ namespace AMDiS { ...@@ -43,23 +43,20 @@ namespace AMDiS {
ProblemInstatScal::ProblemInstatScal(std::string name_, ProblemInstatScal::ProblemInstatScal(std::string name_,
ProblemScal *prob, ProblemScal *prob, ProblemStatBase *initialProb)
ProblemStatBase *initialProb)
: ProblemInstat(name_, initialProb), : ProblemInstat(name_, initialProb),
problemStat(prob), problemStat(prob),
oldSolution(NULL) oldSolution(NULL)
{} {}
ProblemInstatScal::ProblemInstatScal(std::string name_, ProblemInstatScal::ProblemInstatScal(std::string name_, ProblemScal& prob)
ProblemScal& prob)
: ProblemInstat(name_, NULL), : ProblemInstat(name_, NULL),
problemStat(&prob), problemStat(&prob),
oldSolution(NULL) oldSolution(NULL)
{} {}
ProblemInstatScal::ProblemInstatScal(std::string name_, ProblemInstatScal::ProblemInstatScal(std::string name_,
ProblemScal& prob, ProblemScal& prob, ProblemStatBase& initialProb)
ProblemStatBase& initialProb)
: ProblemInstat(name_, &initialProb), : ProblemInstat(name_, &initialProb),
problemStat(&prob), problemStat(&prob),
oldSolution(NULL) oldSolution(NULL)
...@@ -127,13 +124,25 @@ namespace AMDiS { ...@@ -127,13 +124,25 @@ namespace AMDiS {
} }
ProblemInstatVec::ProblemInstatVec(std::string name_, ProblemInstatVec::ProblemInstatVec(std::string name_,
ProblemVec *prob, ProblemVec *prob, ProblemStatBase *initialProb)
ProblemStatBase *initialProb)
: ProblemInstat(name_, initialProb), : ProblemInstat(name_, initialProb),
problemStat(prob), problemStat(prob),
oldSolution(NULL) oldSolution(NULL)
{} {}
ProblemInstatVec::ProblemInstatVec(std::string name_, ProblemVec &prob)
: ProblemInstat(name_, NULL),
problemStat(&prob),
oldSolution(NULL)
{}
ProblemInstatVec::ProblemInstatVec(std::string name_,
ProblemVec &prob, ProblemStatBase &initialProb)
: ProblemInstat(name_, &initialProb),
problemStat(&prob),
oldSolution(NULL)
{}
ProblemInstatVec::~ProblemInstatVec() ProblemInstatVec::~ProblemInstatVec()
{ {
delete oldSolution; delete oldSolution;
......
...@@ -183,6 +183,10 @@ namespace AMDiS { ...@@ -183,6 +183,10 @@ namespace AMDiS {
ProblemVec *prob, ProblemVec *prob,
ProblemStatBase *initialProb = NULL); ProblemStatBase *initialProb = NULL);
ProblemInstatVec(std::string name, ProblemVec &prob);
ProblemInstatVec(std::string name, ProblemVec &prob, ProblemStatBase &initialProb);
/// Destructor. /// Destructor.
virtual ~ProblemInstatVec(); virtual ~ProblemInstatVec();
......
...@@ -68,19 +68,25 @@ namespace AMDiS { ...@@ -68,19 +68,25 @@ namespace AMDiS {
solution->interpol(fct); solution->interpol(fct);
} }
void ProblemScal::addMatrixOperator(Operator *op, void ProblemScal::addMatrixOperator(Operator *op, double *factor, double *estFactor)
double *factor,
double *estFactor)
{ {
systemMatrix->addOperator(op, factor, estFactor); systemMatrix->addOperator(op, factor, estFactor);
} }
void ProblemScal::addVectorOperator(Operator *op, void ProblemScal::addMatrixOperator(Operator &op, double *factor, double *estFactor)
double *factor, {
double *estFactor) systemMatrix->addOperator(&op, factor, estFactor);
}
void ProblemScal::addVectorOperator(Operator *op, double *factor, double *estFactor)
{ {
rhs->addOperator(op, factor, estFactor); rhs->addOperator(op, factor, estFactor);
} }
void ProblemScal::addVectorOperator(Operator &op, double *factor, double *estFactor)
{
rhs->addOperator(&op, factor, estFactor);
}
void ProblemScal::addDirichletBC(BoundaryType type, void ProblemScal::addDirichletBC(BoundaryType type,
AbstractFunction<double, WorldVector<double> >* b) AbstractFunction<double, WorldVector<double> >* b)
...@@ -94,8 +100,7 @@ namespace AMDiS { ...@@ -94,8 +100,7 @@ namespace AMDiS {
solution->getBoundaryManager()->addBoundaryCondition(dirichlet); solution->getBoundaryManager()->addBoundaryCondition(dirichlet);
} }
void ProblemScal::addDirichletBC(BoundaryType type, void ProblemScal::addDirichletBC(BoundaryType type, DOFVector<double> *vec)
DOFVector<double> *vec)
{ {
DirichletBC *dirichlet = new DirichletBC(type, vec); DirichletBC *dirichlet = new DirichletBC(type, vec);
if (systemMatrix) if (systemMatrix)
...@@ -126,8 +131,7 @@ namespace AMDiS { ...@@ -126,8 +131,7 @@ namespace AMDiS {
} }
void ProblemScal::addRobinBC(BoundaryType type, void ProblemScal::addRobinBC(BoundaryType type,
DOFVector<double> *n, DOFVector<double> *n, DOFVector<double> *r)
DOFVector<double> *r)
{ {
RobinBC *robin = new RobinBC(type, n, r, feSpace); RobinBC *robin = new RobinBC(type, n, r, feSpace);
if (rhs) if (rhs)
......
...@@ -170,10 +170,18 @@ namespace AMDiS { ...@@ -170,10 +170,18 @@ namespace AMDiS {
void addMatrixOperator(Operator *op, void addMatrixOperator(Operator *op,
double *factor = NULL, double *estFactor = NULL); double *factor = NULL, double *estFactor = NULL);
/// Adds an Operator to \ref systemMatrix.
void addMatrixOperator(Operator &op,
double *factor = NULL, double *estFactor = NULL);
/// Adds an Operator to \ref rhs. /// Adds an Operator to \ref rhs.
void addVectorOperator(Operator *op, void addVectorOperator(Operator *op,
double *factor = NULL, double *estFactor = NULL); double *factor = NULL, double *estFactor = NULL);
/// Adds an Operator to \ref rhs.
void addVectorOperator(Operator &op,
double *factor = NULL, double *estFactor = NULL);
/// Adds dirichlet boundary conditions. /// Adds dirichlet boundary conditions.
virtual void addDirichletBC(BoundaryType type, virtual void addDirichletBC(BoundaryType type,
AbstractFunction<double, WorldVector<double> >* b); AbstractFunction<double, WorldVector<double> >* b);
......
...@@ -1043,10 +1043,8 @@ namespace AMDiS { ...@@ -1043,10 +1043,8 @@ namespace AMDiS {
solution->interpol(fct); solution->interpol(fct);
} }
void ProblemVec::addMatrixOperator(Operator *op, void ProblemVec::addMatrixOperator(Operator *op, int i, int j,
int i, int j, double *factor, double *estFactor)
double *factor,
double *estFactor)
{ {
FUNCNAME("ProblemVec::addMatrixOperator()"); FUNCNAME("ProblemVec::addMatrixOperator()");
...@@ -1079,9 +1077,14 @@ namespace AMDiS { ...@@ -1079,9 +1077,14 @@ namespace AMDiS {
opFlags[op].setFlag(Operator::MATRIX_OPERATOR); opFlags[op].setFlag(Operator::MATRIX_OPERATOR);
} }
void ProblemVec::addVectorOperator(Operator *op, int i, void ProblemVec::addMatrixOperator(Operator &op, int i, int j,
double *factor, double *factor, double *estFactor)
double *estFactor) {
addMatrixOperator(&op, i, j, factor, estFactor);
}
void ProblemVec::addVectorOperator(Operator *op, int i,
double *factor, double *estFactor)
{ {
FUNCNAME("ProblemVec::addVectorOperator()"); FUNCNAME("ProblemVec::addVectorOperator()");
...@@ -1101,6 +1104,12 @@ namespace AMDiS { ...@@ -1101,6 +1104,12 @@ namespace AMDiS {
opFlags[op].setFlag(Operator::VECTOR_OPERATOR); opFlags[op].setFlag(Operator::VECTOR_OPERATOR);
} }
void ProblemVec::addVectorOperator(Operator &op, int i,
double *factor, double *estFactor)
{
addVectorOperator(&op, i, factor, estFactor);
}
void ProblemVec::addDirichletBC(BoundaryType type, int row, int col, void ProblemVec::addDirichletBC(BoundaryType type, int row, int col,
AbstractFunction<double, WorldVector<double> >* b) AbstractFunction<double, WorldVector<double> >* b)
{ {
......
...@@ -222,13 +222,19 @@ namespace AMDiS { ...@@ -222,13 +222,19 @@ namespace AMDiS {
/// Adds an Operator to \ref A. /// Adds an Operator to \ref A.
void addMatrixOperator(Operator *op, int i, int j, void addMatrixOperator(Operator *op, int i, int j,
double *factor = NULL, double *factor = NULL, double *estFactor = NULL);
double *estFactor = NULL);
/// Adds an Operator to \ref A.
void addMatrixOperator(Operator &op, int i, int j,
double *factor = NULL, double *estFactor = NULL);
/// Adds an Operator to \ref rhs. /// Adds an Operator to \ref rhs.
void addVectorOperator(Operator *op, int i, void addVectorOperator(Operator *op, int i,
double *factor = NULL, double *factor = NULL, double *estFactor = NULL);
double *estFactor = NULL);
/// Adds an Operator to \ref rhs.
void addVectorOperator(Operator &op, int i,
double *factor = NULL, double *estFactor = NULL);
/// Adds dirichlet boundary conditions. /// Adds dirichlet boundary conditions.
virtual void addDirichletBC(BoundaryType type, int row, int col, virtual void addDirichletBC(BoundaryType type, int row, int col,
......
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