Commit dd252d77 authored by Naumann, Andreas's avatar Naumann, Andreas

No commit message

No commit message
parent 0130f14c
......@@ -55,7 +55,13 @@ namespace AMDiS {
// call standard traverse
*elInfo1 = stack1.traverseFirst(mesh1, level1, flag1);
while (*elInfo1 != NULL && skipEl1(*elInfo1)) {
*elInfo1 = stack1.traverseNext(*elInfo1);
}
*elInfo2 = stack2.traverseFirst(mesh2, level2, flag2);
while (*elInfo2 != NULL && skipEl2(*elInfo2)) {
*elInfo2 = stack2.traverseNext(*elInfo2);
}
// finished ?
if (*elInfo1 == NULL || *elInfo2 == NULL) {
......@@ -87,12 +93,22 @@ namespace AMDiS {
ElInfo **elInfoLarge)
{
// call standard traverse
if (inc1) {
*elInfo1 = stack1.traverseNext(*elInfo1);
}
if (inc2) {
*elInfo2 = stack2.traverseNext(*elInfo2);
}
if (inc1) {
do {
*elInfo1 = stack1.traverseNext(*elInfo1);
} while(*elInfo1 != NULL && skipEl1(*elInfo1));
}
if (inc2) {
do {
*elInfo2 = stack2.traverseNext(*elInfo2);
} while (*elInfo2 != NULL && skipEl2(*elInfo2));
}
// finished ?
if (*elInfo1 == NULL || *elInfo2 == NULL) {
TEST_EXIT(*elInfo1 == *elInfo2)("invalid dual traverse\n");
return false;
}
// finished ?
if (*elInfo1 == NULL || *elInfo2 == NULL) {
......
......@@ -80,7 +80,15 @@ namespace AMDiS {
prepareNextStep(elInfo1, elInfo2, elInfoSmall, elInfoLarge);
return true;
}
virtual bool skipEl1(ElInfo *elInfo) {
return false;
};
virtual bool skipEl2(ElInfo *elInfo) {
return false;
};
inline void setFillSubElemMat(bool b) {
fillSubElemMat = b;
}
......
#include "MemoryManager.h"
#include "ElementData.h"
#include "PartitionElementData.h"
namespace AMDiS {
void ElementData::coarsenElementData(Element* parent,
......@@ -9,6 +9,14 @@ namespace AMDiS {
int elTypeParent)
{
if (decorated_) {
PartitionElementData* ped=NULL;
ped=dynamic_cast<PartitionElementData*> (thisChild->getElementData(PARTITION_ED));
ped=NULL;
ped=dynamic_cast<PartitionElementData*> (otherChild->getElementData(PARTITION_ED));
ped=NULL;
ped=dynamic_cast<PartitionElementData*> (parent->getElementData(PARTITION_ED));
decorated_->coarsenElementData(parent, thisChild, otherChild, elTypeParent);
delete decorated_;
decorated_ = NULL;
......
......@@ -51,7 +51,7 @@ namespace AMDiS {
*/
ElementData(ElementData *decorated = NULL)
: decorated_(decorated)
{}
{ }
/** \brief
* destructor
......@@ -98,9 +98,12 @@ namespace AMDiS {
}
/** \brief
* Returns the name of element data type.
* Returns the id of element data type.
*/
virtual const int getTypeID() const = 0;
virtual const int getTypeID() const
{
return 0;
}
/** \brief
* Returns whether the ElemnetData object is of the type specified by
......@@ -155,6 +158,10 @@ namespace AMDiS {
}
inline void setDecorated(ElementData *d) {
if(getTypeID()==1)
{
if(d!=NULL) std::cout<<"leafdata decorated with nonzero"<<std::endl;
}
decorated_ = d;
}
......
......@@ -73,6 +73,7 @@ namespace AMDiS {
/** \brief
* Refinement of parent to child1 and child2.
* @return true: must this ElementData, else not allowed to delete it
*/
bool refineElementData(Element* parent,
Element* child1,
......
......@@ -62,6 +62,11 @@ namespace AMDiS {
}
return true;
};
/*bool skipEl2(ElInfo *elInfo)
{
return skipEl1(elInfo);
};*/
private:
int coarseLevel_;
};
......@@ -83,6 +88,7 @@ namespace AMDiS {
GET_PARAMETER(0, name + "->debug mode", "%d", &debugMode);
groupIsSet=false;
if (debugMode) {
MPI::Group group = MPI::COMM_WORLD.Get_group();
......@@ -91,9 +97,9 @@ namespace AMDiS {
for (int i = 0; i < rankSize; i++) {
ranks[i] = i + 1;
}
std::cout<<"set amdis-group"<<std::endl;
amdisGroup = group.Incl(rankSize, ranks);
groupIsSet=true;
mpiComm = MPI::COMM_WORLD.Create(amdisGroup);
if (mpiComm != MPI::COMM_NULL) {
......@@ -114,8 +120,14 @@ namespace AMDiS {
{
if (!timeIF_)
closeTimestep(adaptInfo);
amdisGroup.Free();
#ifdef DEBUG
std::cout<<"free amdisGroup"<<std::endl;
#endif
if(groupIsSet)
amdisGroup.Free();
#ifdef DEBUG
std::cout<<"freeD amdisGroup"<<std::endl;
#endif
}
void ParallelProblemBase::closeTimestep(AdaptInfo *adaptInfo)
......@@ -918,7 +930,6 @@ namespace AMDiS {
std::map<DegreeOfFreedom, bool> visited;
MyDualTraverse dualTraverse(localCoarseGridLevel_);
ElInfo *elInfo1, *elInfo2;
ElInfo *large, *small;
......@@ -939,6 +950,12 @@ namespace AMDiS {
PartitionElementData *partitionData =
dynamic_cast<PartitionElementData*>
(element1->getElementData(PARTITION_ED));
#ifdef DEBUG
if(element1->getElementData()==NULL)
std::cout<<"even no elementData, id:"<<element1->getIndex()<<std::endl;
if(partitionData==NULL) std::cout<<"elem_id:"<<element1->getIndex()<<std::endl;
#endif
TEST_EXIT_DBG(partitionData!=NULL)("PARTITION_ED data not found\n");
if (partitionData->getPartitionStatus() == IN) {
// get coarse dofs
......@@ -1353,11 +1370,32 @@ namespace AMDiS {
// create an initial partitioning of the mesh
partitioner->createPartitionData();
// set the element weights, which are 1 at the very first begin
setElemWeights(adaptInfo);
// and now partition the mesh
partitionMesh(adaptInfo);
#ifdef DEBUG
//test mesh
TraverseStack testStack;
ElInfo* testElInfo = testStack.traverseFirst(mesh, -1, Mesh::CALL_EVERY_EL_PREORDER);
while(testElInfo)
{
Element *testElement = testElInfo->getElement();
PartitionElementData* ped=dynamic_cast<PartitionElementData*> (testElement->getElementData(PARTITION_ED));
if(ped!=NULL)
std::cout<<ped->getLevel();
else
std::cout<<"none";
std::cout<<"\t"<<testElement->getIndex()<<"\t"<<testElInfo->getLevel()<<std::endl;
testElInfo=testStack.traverseNext(testElInfo);
}
//end test
#endif
globalRefineOutOfPartition(adaptInfo);
refineOverlap(adaptInfo);
......@@ -1412,10 +1450,15 @@ namespace AMDiS {
{
if (mpiSize > 1) {
ParallelProblem::exitParallelization(adaptInfo);
#ifdef DEBUG
std::cout<<"write data"<<std::endl;
#endif
if (!timeIF_)
problem->writeFiles(adaptInfo, true);
#ifdef DEBUG
std::cout<<"delete data"<<std::endl;
#endif
partitioner->deletePartitionData();
if (!usersEstimator)
......
......@@ -159,6 +159,7 @@ namespace AMDiS {
/// Defines the debug mode. If it is 1, a debug server will be started on rank 0.
int debugMode;
bool groupIsSet;
/** \brief
* If true, the current process is the debug server. Otherwise, the
* processes is a working processes calculating part of the solution.
......
......@@ -19,8 +19,8 @@
/** \file PartitionElementData.h */
#ifndef AMDIS_EMPTYELEMENTDATA_H
#define AMDIS_EMPTYELEMENTDATA_H
#ifndef AMDIS_PARTITIONELEMENTDATA_H
#define AMDIS_PARTITIONELEMENTDATA_H
#include "Element.h"
#include "ElementData.h"
......@@ -28,7 +28,7 @@
namespace AMDiS {
const int PARTITION_ED = 6;
const int PARTITION_ED = 7;
enum PartitionStatus {
UNDEFINED = -1,
......@@ -44,7 +44,7 @@ namespace AMDiS {
inline bool isOfType(int typeID) const {
if (typeID == PARTITION_ED)
return true;
return true;
return false;
};
......@@ -62,12 +62,17 @@ namespace AMDiS {
level(0)
{};
~PartitionElementData()
{
//MSG("i'm deleted\n");
}
bool refineElementData(Element* parent,
Element* child1,
Element* child2,
int elType)
{
ElementData::refineElementData(parent, child1, child2, elType);
ElementData::refineElementData(parent, child1, child2, elType);
PartitionElementData *child1Data = NEW PartitionElementData(child1->getElementData());
PartitionElementData *child2Data = NEW PartitionElementData(child2->getElementData());
child1Data->setPartitionStatus(status);
......
......@@ -218,8 +218,9 @@ namespace AMDiS {
(*it)->getAssembler(omp_get_thread_num())->initElement(elInfo, NULL, quad);
}
}
if (timestep) {
MSG("TimeStep is true");
TEST_EXIT_DBG(uhOld[system])("no uhOld\n");
uhOld[system]->getLocalVector(el, uhOldEl[system]);
......
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