Commit 793a6125 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

some small errors and warnings corrected

parent c7d79308
......@@ -245,6 +245,8 @@ transformDOF_mm(Term term, DOFVector<T>* result)
*resultIter = (*tempIter);
*resultIter/= (*assignedIter);
}
delete lambda_1;
}
} // end namespace AMDiS
......@@ -1461,6 +1461,7 @@ namespace AMDiS {
else
{
ERROR_EXIT("Parallel model only support dim = 2 or 3.\n");
return;
}
refManager->globalRefine(&testMesh, nParallelPreRefinements);
......
......@@ -178,20 +178,23 @@ namespace AMDiS {
if (adoptProblem &&
(adoptFlag.isSet(INIT_MESH) ||
adoptFlag.isSet(INIT_SYSTEM) ||
adoptFlag.isSet(INIT_FE_SPACE))) {
adoptFlag.isSet(INIT_FE_SPACE)))
{
meshes = adoptProblem->getMeshes();
componentMeshes = adoptProblem->componentMeshes;
TEST_EXIT(adoptProblem->getNumAddComponents() + nAddComponents > 0)
("Not yet implemented.\n");
// If the adopt problem has fewer components than this problem, but only one
// mesh for all component, than scal up the componentMeshes array.
if (adoptProblem->getNumComponents() < nComponents) {
TEST_EXIT(meshes.size() == 1)("Daran muss ich noch arbeiten!\n");
if (meshes.size() == 1)
componentMeshes.resize(nComponents, meshes[0]);
else if (adoptProblem->getNumComponents() >= nComponents) {
componentMeshes.resize(nComponents);
for (int i = adoptProblem->getNumComponents(); i < nComponents; i++)
componentMeshes[i] = componentMeshes[0];
std::copy(adoptProblem->componentMeshes.begin(),
adoptProblem->componentMeshes.begin() + nComponents,
componentMeshes.begin());
} else {
componentMeshes.resize(nComponents, meshes[0]);
WARNING("componentMeshes may not be derived correctly from the adoptProblem. You have to do this manually!\n");
}
if (nAddComponents > 0) {
WARNING("Additional meshed can not be adopted from adoptProblem. You have to initialize these meshes manually!\n");
}
}
}
......@@ -229,24 +232,26 @@ namespace AMDiS {
createFeSpace(NULL);
if (adoptProblem &&
(adoptFlag.isSet(INIT_FE_SPACE) || adoptFlag.isSet(INIT_SYSTEM))) {
(adoptFlag.isSet(INIT_FE_SPACE) || adoptFlag.isSet(INIT_SYSTEM)))
{
feSpaces = adoptProblem->getFeSpaces();
componentSpaces = adoptProblem->componentSpaces;
traverseInfo = adoptProblem->traverseInfo;
TEST_EXIT(adoptProblem->getNumAddComponents() + nAddComponents > 0)
("Not yet implemented.\n");
// If the adopt problem has fewer components than this problem, but only one
// fe space for all component, than scal up the componentSpaces array.
if (adoptProblem->getNumComponents() < nComponents) {
TEST_EXIT(feSpaces.size() == 1)("Daran muss ich noch arbeiten!\n");
if (feSpaces.size() == 1)
componentSpaces.resize(nComponents, feSpaces[0]);
else if (adoptProblem->getNumComponents() >= nComponents) {
componentSpaces.resize(nComponents);
for (int i = adoptProblem->getNumComponents(); i < nComponents; i++)
componentSpaces[i] = componentSpaces[0];
std::copy(adoptProblem->componentSpaces.begin(),
adoptProblem->componentSpaces.begin() + nComponents,
componentSpaces.begin());
} else {
componentSpaces.resize(nComponents, feSpaces[0]);
WARNING("componentSpaces may not be derived correctly from the adoptProblem. You have to do this manually!\n");
}
if (nAddComponents > 0) {
WARNING("Additional feSpaces can not be adopted from adoptProblem. You have to initialize these fespaces manually!\n");
}
}
}
......@@ -276,10 +281,8 @@ namespace AMDiS {
}
}
// #ifndef HAVE_PARALLEL_DOMAIN_AMDIS
if (!solver)
WARNING("no solver created\n");
// #endif
// === create estimator ===
if (initFlag.isSet(INIT_ESTIMATOR))
......
......@@ -147,17 +147,6 @@ namespace AMDiS {
void dualAssemble(AdaptInfo *adaptInfo, Flag flag,
bool asmMatrix = true, bool asmVector = true);
/// Determines the execution order of the single adaption steps. If adapt is
/// true, mesh adaption will be performed. This allows to avoid mesh adaption,
/// e.g. in timestep adaption loops of timestep adaptive strategies.
Flag oneIteration(AdaptInfo *adaptInfo, Flag toDo = FULL_ITERATION) override;
/// Returns number of managed problems
int getNumProblems() override
{
return 1;
}
/// Implementation of ProblemStatBase::getNumComponents(), TODO: Wrong!!
virtual int getNumComponents()
{
......@@ -169,13 +158,6 @@ namespace AMDiS {
return nAddComponents;
}
/// Returns the problem with the given number. If only one problem
/// is managed by this master problem, the number hasn't to be given.
ProblemStatBase *getProblem(int number = 0) override
{
return this;
}
/// Writes output files. TODO: Make obsolete.
void writeFiles(AdaptInfo *adaptInfo, bool force);
......@@ -557,11 +539,13 @@ namespace AMDiS {
return fileWriters;
}
/// Returns \ref solutionTime.
double getSolutionTime()
{
return solutionTime;
}
/// Returns \ref buildTime.
double getBuildTime()
{
return buildTime;
......@@ -687,28 +671,52 @@ namespace AMDiS {
std::map<Operator*, std::vector<OperatorPos> > operators;
/// time needed to solve the linear system
double solutionTime;
/// time needed to assemble the linear system
double buildTime;
template <class> friend class detail::CouplingProblemStat;
};
#ifndef HAVE_PARALLEL_DOMAIN_AMDIS
struct ProblemStat : public ProblemStatSeq,
namespace detail
{
template <class ProblemStatType>
struct ProblemStat : public ProblemStatType,
public StandardProblemIteration
{
typedef ProblemStatSeq super;
using super::getName;
using ProblemStatType::getName;
/// Constructor
ProblemStat(std::string nameStr,
ProblemIterationInterface *problemIteration = NULL)
: super(nameStr, problemIteration),
: ProblemStatType(nameStr, problemIteration),
StandardProblemIteration(this)
{ }
Flag oneIteration(AdaptInfo *adaptInfo, Flag toDo)
/// Returns number of managed problems
// implements StandardProblemIteration::getNumProblems()
virtual int getNumProblems() override
{
return 1;
}
/// Returns the problem with the given number. If only one problem
/// is managed by this master problem, the number hasn't to be given.
// implements StandardProblemIteration::getProblem(int)
virtual ProblemStatBase *getProblem(int number = 0) override
{
return this;
}
/// Determines the execution order of the single adaption steps. If adapt is
/// true, mesh adaption will be performed. This allows to avoid mesh adaption,
/// e.g. in timestep adaption loops of timestep adaptive strategies.
// implements StandardProblemIteration::oneIteration(AdaptInfo*, Flag)
virtual Flag oneIteration(AdaptInfo *adaptInfo, Flag toDo = FULL_ITERATION) override
{
for (int i = 0; i < getNumComponents(); i++)
for (int i = 0; i < ProblemStatType::getNumComponents(); i++)
if (adaptInfo->spaceToleranceReached(i))
adaptInfo->allowRefinement(false, i);
else
......@@ -717,6 +725,10 @@ namespace AMDiS {
return StandardProblemIteration::oneIteration(adaptInfo, toDo);
}
};
}
#ifndef HAVE_PARALLEL_DOMAIN_AMDIS
typedef detail::ProblemStat<ProblemStatSeq> ProblemStat;
#endif
}
......
......@@ -35,16 +35,16 @@ namespace AMDiS { namespace io {
file.read(const_cast<char*>(typeId.data()), 4);
TEST_EXIT(typeId == id)
("Cannot read Arh2 format: this file is not \"arh2\" format.\n");
("Cannot read Arh format: this file is not \"%s\" format.\n", id.c_str());
file.read(reinterpret_cast<char*>(&major_), 1);
TEST_EXIT(major == major_)
("Cannot read Arh2 format: Arh2Reader major version is %i, the file major version is %i. \n",
("Cannot read Arh format: Arh2Reader major version is %i, the file major version is %i. \n",
major, major_);
file.read(reinterpret_cast<char*>(&minor_), 1);
TEST_EXIT(minor <= minor_)
("Cannot read Arh2 format: Arh2Reader minor version is %i is smaller than the file minor version %i.\n",
("Cannot read Arh format: ArhReader minor version is %i is smaller than the file minor version %i.\n",
minor, minor_);
}
......@@ -344,7 +344,7 @@ namespace AMDiS { namespace io {
if ((*nDOF)[0] != feSpaceDOFs[vecsFeSpaceNum[i]][3])
matchdof = false;
else {
for(size_t j = 1; j < nDOF->getSize(); j++) {
for(int j = 1; j < nDOF->getSize(); j++) {
if((*nDOF)[j] != feSpaceDOFs[vecsFeSpaceNum[i]][j-1]){
matchdof = false;
break;
......@@ -373,7 +373,7 @@ namespace AMDiS { namespace io {
TEST_EXIT((*nDOF)[0] == feSpaceDOFs[vecsFeSpaceNum[i]][3])
("The fespace of vec number %i is not equal to the correspond fespace.\n", i+1);
for(size_t j = 1; j < nDOF->getSize(); j++)
for(int j = 1; j < nDOF->getSize(); j++)
TEST_EXIT((*nDOF)[j] == feSpaceDOFs[vecsFeSpaceNum[i]][j-1])
("The fespace of vec number %i is not equal to the correspond fespace.\n", i+1);
}
......@@ -498,12 +498,13 @@ namespace AMDiS { namespace io {
template<typename T>
void readValues(stringstream& file, vector<double>& values)
{
int size = values.size();
T data[size];
size_t size = values.size();
T* data = new T[size];
file.read(reinterpret_cast<char*>(&data[0]), sizeof(T) * size);
for (size_t i = 0; i < size; i++)
values[i] = static_cast<double>(data[i]);
delete data;
}
void readFile(string filename, Mesh *mesh,
......@@ -587,9 +588,11 @@ namespace AMDiS { namespace io {
Parallel::mpi::globalAdd(nMacros);
if(MPI::COMM_WORLD.Get_rank() == 0)
#endif
{
TEST_EXIT(nMacros == nMacros_)
("Number of macro elements in parallel ARH files doesn't match to the current runtime. %d vs %d\n",
nMacros, nMacros_);
}
if (!parh) {
for (int i = 0; i < nProcs; i++) {
......@@ -818,7 +821,7 @@ namespace AMDiS { namespace io {
file.read(const_cast<char*>(macroFilename.data()), macroFile_nl);
uint32_t rank = 0;
for (size_t i = 0; i < nMacros; i++) {
for (int i = 0; i < nMacros; i++) {
file.read(reinterpret_cast<char*>(&rank), 4);
partition.push_back(rank);
}
......
......@@ -120,9 +120,7 @@ namespace AMDiS { namespace io {
Mesh* mesh_ = mesh ? mesh : vecs[0]->getFeSpace()->getMesh();
if (MPI::COMM_WORLD.Get_rank() == 0) {
writeParallelFile(name + ".parh",
mesh ? mesh : vecs[0]->getFeSpace()->getMesh(),
filenameType);
writeParallelFile(name + ".parh", mesh_, filenameType);
}
TEST_EXIT(filenameType == "cont")("Only filename type \"cont\".\n");
......@@ -195,7 +193,7 @@ namespace AMDiS { namespace io {
string dataformat)
{
FUNCNAME("Arh3Writer::detail::writeHeader()");
int nbits = boost::lexical_cast<int>(dataformat.substr(2, 2));
// int nbits = boost::lexical_cast<int>(dataformat.substr(2, 2));
TEST_EXIT(file.is_open())("the file is not open. should not happen.\n");
map<const FiniteElemSpace*, string> AFEDfileName;
......@@ -277,11 +275,11 @@ namespace AMDiS { namespace io {
file.write(nameStr.c_str(), nameStrLen);
DimVec<int>* nDOF = feSpaceIt->first->getBasisFcts()->getNumberOfDofs();
//
for(size_t j = 1; j < nDOF->getSize(); j++) {
for(int j = 1; j < nDOF->getSize(); j++) {
posDOFs = (*nDOF)[j];
file.write(reinterpret_cast<char*>(&posDOFs), 4);
}
for(size_t j = nDOF->getSize(); j < 4 ; j++) {
for(int j = nDOF->getSize(); j < 4 ; j++) {
posDOFs = 0;
file.write(reinterpret_cast<char*>(&posDOFs), 4);
}
......@@ -537,12 +535,13 @@ namespace AMDiS { namespace io {
template<typename T>
int writeValues(stringstream& file, vector<double>& values)
{
int size = values.size();
T data[size];
size_t size = values.size();
T* data = new T[size];
for (size_t i = 0; i < size; i++)
data[i] = static_cast<T>(values[i]);
file.write(reinterpret_cast<char*>(&data[0]), sizeof(T) * size);
delete data;
return sizeof(T) * size;
}
......
......@@ -88,7 +88,7 @@ namespace AMDiS { namespace Parallel {
std::vector<const FiniteElemSpace*> tmpFeSpaces, tmpComponentSpaces(getComponentSpaces().begin(),
getComponentSpaces().begin() + getNumComponents());
for (int i = 0; i < tmpComponentSpaces.size(); i++)
for (size_t i = 0; i < tmpComponentSpaces.size(); i++)
if (std::find(tmpFeSpaces.begin(), tmpFeSpaces.end(), tmpComponentSpaces[i]) == tmpFeSpaces.end())
tmpFeSpaces.push_back(tmpComponentSpaces[i]);
......
......@@ -77,29 +77,7 @@ namespace AMDiS
} // end namespace Parallel
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
struct ProblemStat : public Parallel::ParallelProblemStat,
public StandardProblemIteration
{
typedef Parallel::ParallelProblemStat super;
using super::getName;
ProblemStat(std::string nameStr,
ProblemIterationInterface *problemIteration = NULL)
: super(nameStr, problemIteration),
StandardProblemIteration(this)
{ }
Flag oneIteration(AdaptInfo *adaptInfo, Flag toDo)
{
for (int i = 0; i < getNumComponents(); i++)
if (adaptInfo->spaceToleranceReached(i))
adaptInfo->allowRefinement(false, i);
else
adaptInfo->allowRefinement(true, i);
return StandardProblemIteration::oneIteration(adaptInfo, toDo);
}
};
typedef detail::ProblemStat<Parallel::ParallelProblemStat> ProblemStat;
#endif
} // end namespace AMDiS
......
......@@ -633,7 +633,7 @@ namespace AMDiS { namespace Parallel {
void StdMpiHelper<vector<Matrix<int> > >::createBuffer(vector<Matrix<int> > &data, int *buf)
{
int dimOfWorld = Global::getGeo(WORLD);
// int dimOfWorld = Global::getGeo(WORLD);
int pos = 0;
buf[pos++] = data.size() > 0 ? data[0].getNumRows() : 0;
buf[pos++] = data.size() > 0 ? data[0].getNumCols() : 0;
......
......@@ -30,7 +30,7 @@ namespace AMDiS { namespace extensions {
template<typename T>
T Box::evalAtPoint(const DOFVector<T>& vec, const PointType& x, int strategy, int nrOfPoints)
{
T value;
T value = 0;
switch (strategy) {
case 0:
value = evalAtPoint_simple(vec, x);
......
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