Commit 68fe64e3 authored by Naumann, Andreas's avatar Naumann, Andreas
Browse files

tried extending the meshtest

parent 3e8be011
...@@ -3,9 +3,33 @@ ...@@ -3,9 +3,33 @@
#include "ProblemScal.h" #include "ProblemScal.h"
#include <sstream> #include <sstream>
#include <string>
#include <stdexcept>
typedef std::vector< std::string > StringVector ;
template< typename Test >
void require(Test l, Test r, int line, std::string message) {
if(l != r) {
std::stringstream ss;
ss<< "Condition for "<<message<<" is wrong\n";
ss<< "l: "<<l<<"\n"<<"r: "<<r<<"\n";
throw std::runtime_error(ss.str());
}
}
template< typename Test >
void require(Test l, Test r, std::string message, StringVector& res) {
if(l != r) {
std::stringstream ss;
ss<< "Condition for "<<message<<" is wrong\n";
ss<< "l: "<<l<<"\n"<<"r: "<<r<<"\n";
res.push_back(ss.str());
}
}
using namespace AMDiS; using namespace AMDiS;
void testMesh(int dim) { void testMesh(int dim, int nrEls, int nrVert , StringVector& res) {
std::stringstream ss; std::stringstream ss;
ss<< dim; ss<< dim;
Parameters::addGlobalParameter(0, "dimension of world", ss.str()); Parameters::addGlobalParameter(0, "dimension of world", ss.str());
...@@ -15,6 +39,11 @@ void testMesh(int dim) { ...@@ -15,6 +39,11 @@ void testMesh(int dim) {
ln_dof[VERTEX]=1; ln_dof[VERTEX]=1;
mesh.createDOFAdmin("vertex_dofs", ln_dof); mesh.createDOFAdmin("vertex_dofs", ln_dof);
mesh.initialize(); mesh.initialize();
require(mesh.getDim(), dim, __LINE__, "mesh dimension");
std::stringstream ss2;
ss2<<"\ncurrent dimension: "<<dim<<"\n";
require(mesh.getNumberOfElements() , nrEls, ss2.str() + "number of elements",res);
require(mesh.getNumberOfVertices(), nrVert, ss2.str() + "number of vertices",res);
} }
int main(int argc, char** argv) { int main(int argc, char** argv) {
...@@ -23,10 +52,17 @@ int main(int argc, char** argv) { ...@@ -23,10 +52,17 @@ int main(int argc, char** argv) {
Parameters::addGlobalParameter(0,"testMesh2->macro file name","macro/macro.stand.2d"); Parameters::addGlobalParameter(0,"testMesh2->macro file name","macro/macro.stand.2d");
Parameters::addGlobalParameter(0,"testMesh3->macro file name","macro/macro.stand.3d"); Parameters::addGlobalParameter(0,"testMesh3->macro file name","macro/macro.stand.3d");
testMesh(1); StringVector errorMessages;
testMesh(2); testMesh(1,1,2, errorMessages);
testMesh(3); testMesh(2,4,5, errorMessages);
testMesh(3,6,8, errorMessages);
if(errorMessages.size() > 0)
std::cout<<" got errors: \n";
for(StringVector::size_type i=0; i< errorMessages.size();++i)
std::cout<<errorMessages[i]<<"\n";
if (errorMessages.size() != 0)
return 1;
return 0; return 0;
} }
...@@ -54,7 +54,7 @@ public: ...@@ -54,7 +54,7 @@ public:
void buildBeforeCoarsen(AdaptInfo *adaptInfo, Flag flag) { void buildBeforeCoarsen(AdaptInfo *adaptInfo, Flag flag) {
FUNCNAME("ParametricSphere::buildAfterCoarsen()"); FUNCNAME("ParametricSphere::buildAfterCoarsen()");
MSG("calculation of parametric coordinates\n"); MSG("calculation of parametric coordinates\n");
int preDOFs = this->getFeSpace()->getAdmin()->getNumberOfPreDOFs(VERTEX); int preDOFs = this->getFeSpace()->getAdmin()->getNumberOfPreDofs(VERTEX);
int dim = this->getMesh()->getDim(); int dim = this->getMesh()->getDim();
int dow = Global::getGeo(WORLD); int dow = Global::getGeo(WORLD);
WorldVector<double> vertexCoords; WorldVector<double> vertexCoords;
......
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