From 5b2d46475c3f262414ccf04e317d2e83986b757f Mon Sep 17 00:00:00 2001 From: Andreas Naumann <andreas.naumann@tu-dresden.de> Date: Fri, 28 May 2010 13:02:08 +0000 Subject: [PATCH] prepared function hooks and codestyle in ProblemImplicit-files --- AMDiS/src/ProblemImplicit.cc | 33 ++++++++++++++++++++++----------- AMDiS/src/ProblemImplicit.h | 12 ++++++++---- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/AMDiS/src/ProblemImplicit.cc b/AMDiS/src/ProblemImplicit.cc index fb11fd9e..580b4116 100644 --- a/AMDiS/src/ProblemImplicit.cc +++ b/AMDiS/src/ProblemImplicit.cc @@ -25,8 +25,9 @@ namespace AMDiS { std::vector< double >& vecPhi1 = phi1->getVector(); std::vector< double >& vecPhi2 = phi2->getVector(); std::vector< double >& vecLevelSet = levelSet->getVector(); - - TEST_EXIT(vecR.size() != vecPhi1.size() && vecPhi2.size() != vecR.size())("something went wrong\n"); + bool checkSize = vecR.size() != vecPhi1.size() && + vecPhi2.size() != vecR.size(); + TEST_EXIT(checkSize)("something went wrong\n"); for (int i = vecR.size()-1; i >= 0; --i) { vecPhi1[i] = Phi1(vecR[i], eps); @@ -45,8 +46,10 @@ namespace AMDiS { std::vector< double >& vecPhi1 = phi1->getVector(); std::vector< double >& vecPhi2 = phi2->getVector(); std::vector< double >& vecLevelSet = levelSet->getVector(); - - TEST_EXIT(vecR.size() != vecPhi1.size() && vecPhi2.size() != vecR.size())("something went wrong\n"); + + bool checkSize = vecR.size() != vecPhi1.size() && + vecPhi2.size() != vecR.size(); + TEST_EXIT(checkSize)("something went wrong\n"); for (int i = vecR.size()-1; i>= 0; --i) { vecR[i] = Phi1ToR(vecPhi1[i], eps); @@ -67,7 +70,9 @@ namespace AMDiS { std::vector< double >& vecPhi2 = phi2->getVector(); std::vector< double >& vecLevelSet = levelSet->getVector(); - TEST_EXIT(vecR.size() != vecPhi1.size() && vecPhi2.size() != vecR.size())("something went wrong\n"); + bool checkSize = vecR.size() != vecPhi1.size() && + vecPhi2.size() != vecR.size(); + TEST_EXIT(checkSize)("something went wrong\n"); for (int i = vecR.size()-1; i >= 0; --i) { vecR[i] = Phi2ToR(vecPhi2[i], eps); @@ -134,7 +139,8 @@ namespace AMDiS { return true; } - void ProblemImplicitScal::initialize(Flag initFlag, ProblemScal* adaptProblem, Flag adoptFlag) + void ProblemImplicitScal::initialize(Flag initFlag, + ProblemScal* adaptProblem, Flag adoptFlag) { FUNCNAME("ImplicitScal::initialize()"); ProblemScal::initialize(CREATE_MESH); @@ -157,7 +163,8 @@ namespace AMDiS { bool ProblemImplicitVec::createImplicitMesh(int p) { - std::string path=name + "->implicit mesh[" + boost::lexical_cast< std::string >(p) + "]->"; + std::string path=name + "->implicit mesh[" + + boost::lexical_cast< std::string >(p) + "]->"; std::string meshFilename(""); GET_PARAMETER(0, path + "mesh file", &meshFilename); //if no file name is given, there's no implicit mesh @@ -190,13 +197,16 @@ namespace AMDiS { switch (serType) { case 0: - calcspace::readR(inStream, eps,r[p], phi1[p], phi2[p], levelSet[p], meshes[p]); + calcspace::readR(inStream, eps,r[p], phi1[p], phi2[p], + levelSet[p], meshes[p]); break; case 1: - calcspace::readPhi1(inStream, eps, r[p], phi1[p], phi2[p], levelSet[p], meshes[p]); + calcspace::readPhi1(inStream, eps, r[p], phi1[p], phi2[p], + levelSet[p], meshes[p]); break; case 2: - calcspace::readPhi2(inStream,eps, r[p], phi1[p], phi2[p], levelSet[p], meshes[p]); + calcspace::readPhi2(inStream,eps, r[p], phi1[p], phi2[p], + levelSet[p], meshes[p]); break; default: WARNING("unknown implicit mesh type\n"); @@ -205,7 +215,8 @@ namespace AMDiS { return true; } - void ProblemImplicitVec::initialize(Flag initFlag, ProblemScal* adaptProblem, Flag adoptFlag) + void ProblemImplicitVec::initialize(Flag initFlag, + ProblemScal* adaptProblem, Flag adoptFlag) { FUNCNAME("ImplicitScal::initialize()"); ProblemVec::initialize(CREATE_MESH); diff --git a/AMDiS/src/ProblemImplicit.h b/AMDiS/src/ProblemImplicit.h index 3ee6e7a1..5ad9fd38 100644 --- a/AMDiS/src/ProblemImplicit.h +++ b/AMDiS/src/ProblemImplicit.h @@ -18,7 +18,8 @@ namespace AMDiS { levelSet(NULL) {} - /// @return: true if implicit mesh type is ok (see below) and false in all other cases + /// @return: true if implicit mesh type is ok (see below) and false in + /// all other cases /// initfile entries: /// name+"->implicit mesh->mesh file": name of serialized mesh /// name+"->implicit mesh->dof file": name of serialized dofvector @@ -44,7 +45,8 @@ namespace AMDiS { /// DOFVector for the phasefield function 0.5*(1+tanh(3*r/eps)) DOFVector< double > *phi2; - /// DOFVector for the levelset function (levelSet(x): x \in \Omega: 1, x \not \in Omega: -1, x \in \Gamma: 0) + /// DOFVector for the levelset function + /// (levelSet(x): x \in \Omega: 1, x \not \in Omega: -1, x \in \Gamma: 0) DOFVector< double > *levelSet; }; @@ -52,7 +54,8 @@ namespace AMDiS { class ProblemImplicitVec : public ProblemVec { public: - ProblemImplicitVec(std::string name, ProblemIterationInterface* problem = NULL) + ProblemImplicitVec(std::string name, + ProblemIterationInterface* problem = NULL) : ProblemVec(name, problem), r(0), phi1(0), @@ -76,7 +79,8 @@ namespace AMDiS { /// DOFVector for the phasefield function 0.5*(1+tanh(3*r/eps)) std::vector< DOFVector< double >* > phi2; - /// DOFVector for the levelset function (levelSet(x): x \in \Omega: 1, x \not \in Omega: -1, x \in \Gamma: 0) + /// DOFVector for the levelset function + /// (levelSet(x): x \in \Omega: 1, x \not \in Omega: -1, x \in \Gamma: 0) std::vector< DOFVector< double >* > levelSet; }; -- GitLab