diff --git a/AMDiS/src/FiniteElemSpace.cc b/AMDiS/src/FiniteElemSpace.cc index 92f6840c3f513eeba67a1f4e603fdf549e6f076f..dbec0d6e0c1eb4147b36db9d466c36265355e6c6 100644 --- a/AMDiS/src/FiniteElemSpace.cc +++ b/AMDiS/src/FiniteElemSpace.cc @@ -33,7 +33,8 @@ namespace AMDiS { if (admin_local->getNumberOfDOFs(j) != (*ndof)[j]) break; } - if (j > mesh->getDim()) break; + if (j > mesh->getDim()) + break; admin_local = NULL; } if (!admin_local) { @@ -44,6 +45,25 @@ namespace AMDiS { feSpaces.push_back(this); } + + FiniteElemSpace::FiniteElemSpace() + { + } + + FiniteElemSpace& FiniteElemSpace::operator=(const FiniteElemSpace& feSpace) + { + if (&feSpace == this) + return *this; + + if (feSpace.admin == &(feSpace.mesh->getDOFAdmin(0))) { + std::cout << "JA, SIND GLEICH\n"; + } else { + std::cout << "NO, NICHT WIRKLICH\n"; + } + ERROR_EXIT("\n"); + + return *this; + } FiniteElemSpace *FiniteElemSpace::provideFESpace(DOFAdmin *admin, const BasisFunction *basFcts, @@ -64,7 +84,7 @@ namespace AMDiS { } } - if(admin) { + if (admin) { ERROR_EXIT("no fespace found for this admin\n"); return NULL; } else { diff --git a/AMDiS/src/FiniteElemSpace.h b/AMDiS/src/FiniteElemSpace.h index 7ed65871d1d6e9fb24a3228447ebf99b13fc4408..95701ad260e4fecf1d989fec9928cb6ba5dad244 100644 --- a/AMDiS/src/FiniteElemSpace.h +++ b/AMDiS/src/FiniteElemSpace.h @@ -58,6 +58,11 @@ namespace AMDiS { MEMORY_MANAGED(FiniteElemSpace); + /** \brief + * Create an empty fe space. + */ + FiniteElemSpace(); + /** \brief * */ @@ -70,6 +75,8 @@ namespace AMDiS { * destructor */ virtual ~FiniteElemSpace() {} + + FiniteElemSpace& operator=(const FiniteElemSpace& feSpace); /** \brief * Returns \ref name diff --git a/AMDiS/src/Mesh.cc b/AMDiS/src/Mesh.cc index 4501aad23305f11ae800dd88c73df03d117ccdfd..46fa9223da91a1528f79500d5d983b90d0d7fde6 100644 --- a/AMDiS/src/Mesh.cc +++ b/AMDiS/src/Mesh.cc @@ -272,158 +272,23 @@ namespace AMDiS { } // ===== adding dofs to already existing elements ============================ - - if (initialized) { - static bool pnd_1d_0[2] = {true, true}; - static bool pnd_1d_1[1] = {false}; - static bool pnd_2d_0[3] = {true, true, true}; - static bool pnd_2d_1[3] = {true, true, false}; - static bool pnd_2d_2[1] = {false}; - static bool pnd_3d_0[4] = {true, true, true, true}; - static bool pnd_3d_1[6] = {false, true, true, true, true, true}; - static bool pnd_3d_2[4] = {true, true, false, false}; - static bool pnd_3d_3[1] = {false}; - static bool *pnd_1d[2] = {pnd_1d_0, pnd_1d_1}; - static bool *pnd_2d[3] = {pnd_2d_0, pnd_2d_1, pnd_2d_2}; - static bool *pnd_3d[4] = {pnd_3d_0, pnd_3d_1, pnd_3d_2, pnd_3d_3}; - static bool **parentNeedsDOF[4] = {NULL, pnd_1d, pnd_2d, pnd_3d}; - - - std::list<struct delmem> delList; - std::map< std::set<DegreeOfFreedom>, DegreeOfFreedom*> dofPtrMap; - const DOFAdmin *vertexAdmin = getVertexAdmin(); - int vertexAdminPreDOFs = vertexAdmin->getNumberOfPreDOFs(VERTEX); - - // finding necessary node number for new admin - - int newNNode = 0; - GeoIndex geoIndex; - - for (int d = 0; d < dim+1; d++) { - geoIndex = INDEX_OF_DIM(d, dim); - - if (localAdmin->getNumberOfDOFs(geoIndex)>0||nDOF[geoIndex]>0) - newNNode += getGeo(geoIndex); - } - - bool extendNodes = (newNNode>nNodeEl); - int oldNNodes = nNodeEl; - - nNodeEl = newNNode; - - TraverseStack stack; - ElInfo *elInfo = NULL; - WARNING("You are using untested code (adding dofs to existing mesh). Please contact\nsoftware administrator if any errors occur in this context.\n"); - - elInfo = stack.traverseFirst(this, -1, CALL_EVERY_EL_PREORDER); - while(elInfo) { - Element *element = elInfo->getElement(); - DegreeOfFreedom *newDOF, **oldDOF, **dof = - const_cast<DegreeOfFreedom**>(element->getDOF()); - - int index = 0; - - if (extendNodes) { - oldDOF=dof; - element->setDOFPtrs(); - dof=const_cast<DegreeOfFreedom**>(element->getDOF()); - int index=0,oldIndex=0; - for (int d = 0; d < dim + 1; d++) { - geoIndex = INDEX_OF_DIM(d, dim); - if (nDOF[geoIndex]>0) { - for (int i = 0;i < getGeo(geoIndex); ++i) - dof[index++] = oldDOF[oldIndex++]; - } - else { - if (localAdmin->getNumberOfDOFs(geoIndex) > 0) - index += getGeo(geoIndex); - } - } - - FREE_MEMORY(oldDOF, DegreeOfFreedom*, oldNNodes); - - TEST_EXIT_DBG(index == nNodeEl)("ERROR: Number of entered nodes %f != number of nodes %f\n",index,nNodeEl); - - } + // If adding DOFAdmins to already initilized meshes is required, see older + // AMDiS version (revision < 244) at the same code position. + TEST_EXIT(!initialized)("Adding DOFAdmins to initilized meshes does not work!\n"); - index = 0; - - // allocate new memory at elements - for (int d = 0; d < dim+1; d++) { - geoIndex = INDEX_OF_DIM(d, dim); - - int numberOfDOFs = localAdmin->getNumberOfDOFs(geoIndex); - int numberOfPreDOFs = nDOF[geoIndex]; - - if (numberOfDOFs>0||numberOfPreDOFs>0) { - - // for all vertices/edges/... - for (int i = 0; i < getGeo(geoIndex); i++, index++) { - std::set<DegreeOfFreedom> dofSet; - for (int j = 0; j < d+1; j++) { - dofSet.insert(dof[element->getVertexOfPosition(geoIndex, i, j)][vertexAdminPreDOFs]); - } - - if (element->isLeaf() || parentNeedsDOF[dim][d][i]) { - if (dofPtrMap[dofSet] == NULL) { - if (localAdmin->getNumberOfDOFs(geoIndex)) { - newDOF = GET_MEMORY(DegreeOfFreedom, numberOfPreDOFs + numberOfDOFs); - // copy old dofs to new memory and free old memory - if (dof[index]) { - for (int j = 0; j < numberOfPreDOFs; j++) { - newDOF[j] = dof[index][j]; - } - // FREE_MEMORY(dof[index], DegreeOfFreedom, numberOfPreDOFs); - // Do not free memory. The information has to be used to identify the part in other elements. - // The memory is only marked for freeing. - struct delmem fm; - fm.ptr = dof[index]; - fm.len = numberOfPreDOFs; - delList.push_back(fm); - } - for (int j = 0; j < numberOfDOFs; j++) { - newDOF[numberOfPreDOFs + j] = localAdmin->getDOFIndex(); - } - dof[index] = newDOF; - } - dofPtrMap[dofSet] = dof[index]; - } else { - dof[index] = dofPtrMap[dofSet]; - } - } - } - } - } - elInfo = stack.traverseNext(elInfo); - } - - // now free the old dof memory: - - std::list<struct delmem>::iterator it = delList.begin(); - - while (it!=delList.end()) { - FREE_MEMORY((*it).ptr, DegreeOfFreedom, (*it).len); - it++; - } - - delList.clear(); - - } - // ============================================================================ - admin.push_back(localAdmin); nDOFEl = 0; localAdmin->setNumberOfPreDOFs(VERTEX,nDOF[VERTEX]); - nDOF[VERTEX] += localAdmin->getNumberOfDOFs(VERTEX); + nDOF[VERTEX] += localAdmin->getNumberOfDOFs(VERTEX); nDOFEl += getGeo(VERTEX) * nDOF[VERTEX]; - if(dim > 1) { + if (dim > 1) { localAdmin->setNumberOfPreDOFs(EDGE,nDOF[EDGE]); - nDOF[EDGE] += localAdmin->getNumberOfDOFs(EDGE); + nDOF[EDGE] += localAdmin->getNumberOfDOFs(EDGE); nDOFEl += getGeo(EDGE) * nDOF[EDGE]; } @@ -438,10 +303,11 @@ namespace AMDiS { if (dim > 1) { node[EDGE] = nNodeEl; - if (nDOF[EDGE] > 0) nNodeEl += getGeo(EDGE); + if (nDOF[EDGE] > 0) + nNodeEl += getGeo(EDGE); } - if (3 == dim){ + if (dim == 3) { localAdmin->setNumberOfPreDOFs(FACE,nDOF[FACE]); nDOF[FACE] += localAdmin->getNumberOfDOFs(FACE); nDOFEl += getGeo(FACE) * nDOF[FACE]; @@ -451,8 +317,9 @@ namespace AMDiS { } node[CENTER] = nNodeEl; - if (nDOF[CENTER] > 0) + if (nDOF[CENTER] > 0) { nNodeEl += 1; + } } diff --git a/AMDiS/src/SolutionDataStorage.h b/AMDiS/src/SolutionDataStorage.h index 4cd0b0ebaea72e37aec5516c04a2bc83a8166433..2f410456dcaa6d05701ebf750abc50a543e2190b 100644 --- a/AMDiS/src/SolutionDataStorage.h +++ b/AMDiS/src/SolutionDataStorage.h @@ -50,8 +50,8 @@ namespace AMDiS { * */ void push(T *solution, - double timestamp, - typename SolutionHelper<T>::type feSpace); + typename SolutionHelper<T>::type feSpace, + double timestamp); /** \brief * diff --git a/AMDiS/src/SolutionDataStorage.hh b/AMDiS/src/SolutionDataStorage.hh index 1bf73e5cb37fc41a7c7082f0c71566ea9df1b4df..901d7908bbb75a62c9368be6606c73131d1775ad 100644 --- a/AMDiS/src/SolutionDataStorage.hh +++ b/AMDiS/src/SolutionDataStorage.hh @@ -58,8 +58,8 @@ namespace AMDiS { template<typename T> void SolutionDataStorage<T>::push(T *solution, - double timestamp, - typename SolutionHelper<T>::type feSpace) + typename SolutionHelper<T>::type feSpace, + double timestamp) { FUNCNAME("SolutionDataStorage<T>::push()"); diff --git a/AMDiS/src/SystemVector.h b/AMDiS/src/SystemVector.h index 9a1042ae39704ecc8342ac360f65b43c88143c96..bf08bc4fba0604d1b808bbbfc1092d799dc0a391 100644 --- a/AMDiS/src/SystemVector.h +++ b/AMDiS/src/SystemVector.h @@ -204,6 +204,10 @@ namespace AMDiS { return feSpace[i]; } + inline std::vector<FiniteElemSpace*> getFESpaces() const { + return feSpace; + } + /** \brief * Here the system vector is interpreted as one large vector. The given * is used as a global index which indicates a local vector number and diff --git a/AMDiS/src/UmfPackSolver.hh b/AMDiS/src/UmfPackSolver.hh index 2d7655db296b76f8713f3414623d446bbf0c196c..c8007a7bd3420f5426c8ecc1fafe5472ccb171c1 100644 --- a/AMDiS/src/UmfPackSolver.hh +++ b/AMDiS/src/UmfPackSolver.hh @@ -159,7 +159,6 @@ namespace AMDiS { umfpack_di_free_symbolic(&symbolic_); } if (multipleRhs == 0) { - std::cout << "FREE THE STUFF" << std::endl; umfpack_di_free_numeric(&numeric); }