Commit f615ae6e authored by Thomas Witkowski's avatar Thomas Witkowski

* Nothing really important

parent ada4194a
......@@ -38,7 +38,7 @@ namespace AMDiS {
{
DELETE nDOF;
for (int i = 0; i < grdTmpVec1.size(); i++) {
for (int i = 0; i < static_cast<int>(grdTmpVec1.size()); i++) {
DELETE grdTmpVec1[i];
DELETE grdTmpVec2[i];
}
......
......@@ -80,7 +80,6 @@ namespace AMDiS {
if (localBCs.size() > 0) {
// get boundaries of all DOFs
const BoundaryType *localBound = basisFcts->getBound(elInfo, NULL);
// get dof indices
basisFcts->getLocalIndicesVec(elInfo->getElement(), admin, &dofIndices);
......@@ -88,11 +87,11 @@ namespace AMDiS {
for (it = localBCs.begin(); it != localBCs.end(); ++it) {
if ((*it).second) {
if (!(*it).second->isDirichlet()) {
(*it).second->fillBoundaryCondition(mat, elInfo, &dofIndices[0], localBound, nBasFcts);
(*it).second->fillBoundaryCondition(mat, elInfo, &dofIndices[0], localBound, nBasFcts);
}
}
}
// apply dirichlet boundary conditions
for (it = localBCs.begin(); it != localBCs.end(); ++it) {
if ((*it).second) {
......
......@@ -2050,58 +2050,59 @@ namespace AMDiS {
int MacroReader::basicDOFCheckFct(ElInfo* elinfo)
{
FUNCNAME("MacroReader::basicDOFCheckFct");
FUNCNAME("MacroReader::basicDOFCheckFct()");
Mesh* mesh = Mesh::traversePtr;
Element* el = elinfo->getElement();
const DOFAdmin& adm = mesh->getDOFAdmin(mesh->iadmin);
const Element *neig;
const DegreeOfFreedom *dof;
int i, j, jdof, ndof, i0, j0, ov;
const DOFAdmin& admin = mesh->getDOFAdmin(mesh->iadmin);
const Element *neig;
const DegreeOfFreedom *dof;
if (0 == mesh->dof_used.size())
return 0;
if ((ndof = adm.getNumberOfDOFs(VERTEX))) {
j0 = adm.getNumberOfPreDOFs(VERTEX);
TEST_EXIT(j0 + ndof <= mesh->getNumberOfDOFs(VERTEX))
("adm.getNumberOfPreDOFs(VERTEX) %d + nDOF %d > mesh->nDOF %d\n",
j0, ndof, mesh->getNumberOfDOFs(VERTEX));
i0 = mesh->getNode(VERTEX);
for (i = 0; i < mesh->getGeo(VERTEX); i++)
{
if ((dof = el->getDOF(i0+i)) == NULL)
ERROR("no vertex dof %d on element %d\n", i, el->getIndex());
else
for (j = 0; j < ndof; j++)
{
jdof = dof[j0 + j];
TEST(jdof >= 0 && jdof < static_cast<int>(mesh->dof_used.size()))
("vertex dof=%d invalid? size=%d\n",jdof, mesh->dof_used.size());
mesh->dof_used[jdof]++;
}
int ndof = admin.getNumberOfDOFs(VERTEX);
if (ndof) {
int j0 = admin.getNumberOfPreDOFs(VERTEX);
TEST_EXIT(j0 + ndof <= mesh->getNumberOfDOFs(VERTEX))
("admin.getNumberOfPreDOFs(VERTEX) %d + nDOF %d > mesh->nDOF %d\n",
j0, ndof, mesh->getNumberOfDOFs(VERTEX));
int i0 = mesh->getNode(VERTEX);
for (int i = 0; i < mesh->getGeo(VERTEX); i++) {
if ((dof = el->getDOF(i0+i)) == NULL) {
ERROR("no vertex dof %d on element %d\n", i, el->getIndex());
} else {
for (int j = 0; j < ndof; j++) {
int jdof = dof[j0 + j];
TEST(jdof >= 0 && jdof < static_cast<int>(mesh->dof_used.size()))
("vertex dof=%d invalid? size=%d\n",jdof, mesh->dof_used.size());
mesh->dof_used[jdof]++;
}
/* neighbour vertex dofs have been checked in check_fct() */
}
}
/* neighbour vertex dofs have been checked in check_fct() */
}
if (mesh->getDim() > 1) {
if ((ndof = adm.getNumberOfDOFs(EDGE))) {
j0 = adm.getNumberOfPreDOFs(EDGE);
ndof = admin.getNumberOfDOFs(EDGE);
if (ndof) {
int j0 = admin.getNumberOfPreDOFs(EDGE);
TEST_EXIT(j0 + ndof <= mesh->getNumberOfDOFs(EDGE))
("adm.getNumberOfPreDOFs(EDGE) %d + nDOF %d > mesh->nDOF %d\n",
("admin.getNumberOfPreDOFs(EDGE) %d + nDOF %d > mesh->nDOF %d\n",
j0, ndof, mesh->getNumberOfDOFs(EDGE));
i0 = mesh->getNode(EDGE);
int i0 = mesh->getNode(EDGE);
for (i = 0; i < mesh->getGeo(EDGE); i++) {
if ((dof = el->getDOF(i0 + i)) == NULL) {
for (int i = 0; i < mesh->getGeo(EDGE); i++) {
dof = el->getDOF(i0 + i);
if (dof == NULL) {
ERROR("no edge dof %d on element %d\n", i, el->getIndex());
} else {
for (j = 0; j < ndof; j++) {
jdof = dof[j0 + j];
for (int j = 0; j < ndof; j++) {
int jdof = dof[j0 + j];
TEST(jdof >= 0 && jdof < static_cast<int>(mesh->dof_used.size()))
("edge dof=%d invalid? size=%d\n",jdof, mesh->dof_used.size());
mesh->dof_used[jdof]++;
......@@ -2109,9 +2110,10 @@ namespace AMDiS {
}
if (el->getFirstChild() == NULL) {
if(mesh->getDim() == 2) {
if ((neig = elinfo->getNeighbour(i))) {
ov = elinfo->getOppVertex(i);
if (mesh->getDim() == 2) {
neig = elinfo->getNeighbour(i);
if (neig) {
int ov = elinfo->getOppVertex(i);
TEST(neig->getDOF(i0 + ov) == dof)
("el %d edge %d dof %8X: wrong dof %8X in neighbour %d edge %d\n",
......@@ -2119,15 +2121,14 @@ namespace AMDiS {
neig->getIndex(), ov);
}
} else { // dim == 3
int in, k, found;
for (in = 0; in < mesh->getGeo(NEIGH); in++) {
for (int in = 0; in < mesh->getGeo(NEIGH); in++) {
if ((in != el->getVertexOfEdge(i,0)) &&
(in != el->getVertexOfEdge(i,1)) &&
(neig = elinfo->getNeighbour(in))) {
found = 0;
for (k = 0; k < mesh->getGeo(EDGE); k++)
int found = 0;
for (int k = 0; k < mesh->getGeo(EDGE); k++) {
if (neig->getDOF(i0 + k) == dof) found++;
}
TEST(found==1)("el %d edge %d dof found=%d in neighbour %d\n",
el->getIndex(), i, found, neig->getIndex());
}
......@@ -2138,17 +2139,18 @@ namespace AMDiS {
}
}
if(mesh->getDim()==3) {
if ((ndof = adm.getNumberOfDOFs(FACE))) {
j0 = adm.getNumberOfPreDOFs(FACE);
if (mesh->getDim() == 3) {
ndof = admin.getNumberOfDOFs(FACE);
if (ndof) {
int j0 = admin.getNumberOfPreDOFs(FACE);
TEST_EXIT(j0 + ndof <= mesh->getNumberOfDOFs(FACE))
("admin->n0_dof[FACE] %d + nDOF %d > mesh->nDOF %d\n",
j0, ndof, mesh->getNumberOfDOFs(FACE));
i0 = mesh->getNode(FACE);
for (i = 0; i < mesh->getGeo(FACE); i++) {
int i0 = mesh->getNode(FACE);
for (int i = 0; i < mesh->getGeo(FACE); i++) {
TEST(dof = el->getDOF(i0 + i))("no face dof %d ???\n", i);
for (j = 0; j < ndof; j++) {
jdof = dof[j0 + j];
for (int j = 0; j < ndof; j++) {
int jdof = dof[j0 + j];
TEST(jdof >= 0 && jdof < static_cast<int>(mesh->dof_used.size()))
("face dof=%d invalid? size=%d\n",jdof, mesh->dof_used.size());
mesh->dof_used[jdof]++;
......@@ -2156,7 +2158,8 @@ namespace AMDiS {
if (el->getChild(0) == NULL) {
if ((neig = elinfo->getNeighbour(i))) {
ov = elinfo->getOppVertex(i);
int ov = elinfo->getOppVertex(i);
TEST(neig->getDOF(i0 + ov) == dof)
("el %d face %d dof %8X: wrong dof %8X in neighbour %d face %d\n",
el->getIndex(), i, dof, neig->getDOF(i0 + ov), neig->getIndex(),
......@@ -2167,20 +2170,21 @@ namespace AMDiS {
}
}
if ((ndof = adm.getNumberOfDOFs(CENTER))) {
i0 = mesh->getNode(CENTER);
TEST(dof = el->getDOF(i0))("no center dof???\n");
j0 = adm.getNumberOfPreDOFs(CENTER);
TEST_EXIT(j0 + ndof <= mesh->getNumberOfDOFs(CENTER))
("adm.getNumberOfPreDOFs(CENTER) %d + nDOF %d > mesh->nDOF %d\n",
j0, ndof, mesh->getNumberOfDOFs(CENTER));
for (j = 0; j < ndof; j++) {
jdof = dof[j0 + j];
TEST(jdof >= 0 && jdof < static_cast<int>(mesh->dof_used.size()))
("center dof=%d invalid? size=%d\n",jdof, mesh->dof_used.size());
mesh->dof_used[jdof]++;
}
ndof = admin.getNumberOfDOFs(CENTER);
if (ndof) {
int i0 = mesh->getNode(CENTER);
TEST(dof = el->getDOF(i0))("no center dof???\n");
int j0 = admin.getNumberOfPreDOFs(CENTER);
TEST_EXIT(j0 + ndof <= mesh->getNumberOfDOFs(CENTER))
("admin.getNumberOfPreDOFs(CENTER) %d + nDOF %d > mesh->nDOF %d\n",
j0, ndof, mesh->getNumberOfDOFs(CENTER));
for (int j = 0; j < ndof; j++) {
int jdof = dof[j0 + j];
TEST(jdof >= 0 && jdof < static_cast<int>(mesh->dof_used.size()))
("center dof=%d invalid? size=%d\n",jdof, mesh->dof_used.size());
mesh->dof_used[jdof]++;
}
}
return 0;
}
......
......@@ -1069,21 +1069,21 @@ namespace AMDiS {
bool Mesh::indirectlyAssociated(DegreeOfFreedom dof1, DegreeOfFreedom dof2) {
::std::vector<DegreeOfFreedom> associatedToDOF1;
int i, size;
::std::map<BoundaryType, VertexVector*>::iterator it;
::std::map<BoundaryType, VertexVector*>::iterator end = periodicAssociations.end();
DegreeOfFreedom dof, assDOF;
associatedToDOF1.push_back(dof1);
for(it = periodicAssociations.begin(); it != end; ++it) {
size = static_cast<int>(associatedToDOF1.size());
for(i = 0; i < size; i++) {
for (it = periodicAssociations.begin(); it != end; ++it) {
int size = static_cast<int>(associatedToDOF1.size());
for (int i = 0; i < size; i++) {
dof = associatedToDOF1[i];
assDOF = (*(it->second))[dof];
if(assDOF == dof2) {
if (assDOF == dof2) {
return true;
} else {
if(assDOF != dof) associatedToDOF1.push_back(assDOF);
if (assDOF != dof)
associatedToDOF1.push_back(assDOF);
}
}
}
......
......@@ -617,18 +617,6 @@ namespace AMDiS {
*/
inline bool isInitialized() { return initialized; };
// inline void addPeriodicBC(BoundaryType type) {
// periodicBoundaryTypes.insert(type);
// };
// inline bool isPeriodicBC(BoundaryType type) {
// return (periodicBoundaryTypes.find(type) != periodicBoundaryTypes.end());
// };
// inline ::std::map<BoundaryType, PeriodicBC*>& getPeriodicBCMap() {
// return periodicBoundaryConditions;
// };
inline ::std::map<BoundaryType, VertexVector*>& getPeriodicAssociations() {
return periodicAssociations;
};
......@@ -817,11 +805,6 @@ namespace AMDiS {
*/
bool preserveCoarseDOFs;
// /** \brief
// * List of all Meshes. Can be accessed via Mesh::begin() and Mesh::end()
// */
// static ::std::list<Mesh*> meshes;
/** \brief
* Number of all DOFs on a single element
*/
......
......@@ -109,18 +109,14 @@ namespace AMDiS {
if (!masterMatrix_) {
masterMatrix_ = matrix;
Mesh *mesh = matrix->getRowFESpace()->getMesh();
associated_ = mesh->getPeriodicAssociations()[boundaryType];
TEST_EXIT_DBG(associated_)("no associations for periodic boundary condition %d\n",
boundaryType);
const BasisFunction *basFcts = rowFESpace->getBasisFcts();
int num = basFcts->getNumber();
TEST_EXIT(associated_)
("no associations for periodic boundary condition %d\n", boundaryType);
neighIndices_ = GET_MEMORY(DegreeOfFreedom, num);
neighIndices_ = GET_MEMORY(DegreeOfFreedom,
rowFESpace->getBasisFcts()->getNumber());
}
}
......@@ -131,30 +127,22 @@ namespace AMDiS {
int nBasFcts)
{
if (matrix == masterMatrix_) {
int dim = rowFESpace->getMesh()->getDim();
if (dim > 1) {
DOFAdmin *admin = rowFESpace->getAdmin();
FixVec<int, WORLD> elFace(dim, NO_INIT);
FixVec<int, WORLD> neighFace(dim, NO_INIT);
DimVec<int> vertexPermutation(dim, NO_INIT);
const BasisFunction *basFcts = rowFESpace->getBasisFcts();
int num = basFcts->getNumber();
Element *element = elInfo->getElement();
DimVec<DegreeOfFreedom> periodicDOFs(dim-1, NO_INIT);
int vertex, index, side;
GeoIndex sideGeoIndex = INDEX_OF_DIM(dim-1, dim);
for (side = 0; side < dim + 1; side++) {
if (elInfo->getBoundary(sideGeoIndex, side) == boundaryType) {
for (vertex = 0; vertex < dim; vertex++) {
index = element->getVertexOfPosition(sideGeoIndex,
side,
......@@ -163,10 +151,9 @@ namespace AMDiS {
}
Element *neigh = elInfo->getNeighbour(side);
basFcts->getLocalIndices(neigh, admin, neighIndices_);
int oppVertex = 0;
for (int i = 0; i < dim + 1; i++) {
// get vertex permutation
if (i == side) {
......@@ -184,12 +171,13 @@ namespace AMDiS {
}
oppVertex += i - vertexPermutation[i];
}
vertexPermutation[side] = oppVertex;
// get DOF permutation
const DegreeOfFreedom *dofPermutation =
periodicDOFMapping_->getDOFPermutation(vertexPermutation);
// set associated dofs
for (int i = 0; i < num; i++) {
if ((*(basFcts->getCoords(i)))[side] == 0) {
......
......@@ -603,15 +603,15 @@ namespace AMDiS {
Mesh::FILL_DET |
Mesh::FILL_GRD_LAMBDA |
Mesh::FILL_NEIGH);
// for all elements ...
while (elInfo) {
if (systemMatrix_->getBoundaryManager())
if (systemMatrix_->getBoundaryManager())
systemMatrix_->getBoundaryManager()->fillBoundaryConditions(elInfo, systemMatrix_);
if (rhs_->getBoundaryManager())
rhs_->getBoundaryManager()->fillBoundaryConditions(elInfo, rhs_);
if (solution_->getBoundaryManager())
solution_->getBoundaryManager()->fillBoundaryConditions(elInfo, solution_);
elInfo = stack.traverseNext(elInfo);
}
......
......@@ -42,6 +42,8 @@ namespace AMDiS {
fineSolutions.clear();
coarseSolutions.clear();
}
virtual ~ParaRealProblemBase() {};
void storeSolution(T *vec)
{
......
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