Loading Unstructured_mesh/cellboundaryconnection.h +44 −44 Original line number Original line Diff line number Diff line Loading @@ -6,17 +6,17 @@ template<typename indexType> template<typename indexType> class CellBoundaryConnection : public CellConnection<indexType> { class CellBoundaryConnection : public CellConnection<indexType> { /** /** * @brief NextBElemWRTCL * @brief nextBElemWRTCL * * * Index of the next boundary element with respect to the left cell * Index of the next boundary element with respect to the left cell */ */ indexType NextBElemWRTCL; indexType nextBElemWRTCL; /** /** * @brief NextBElemWRTCR * @brief nextBElemWRTCR * * * Index of the next boundary element with respect to right cell * Index of the next boundary element with respect to right cell */ */ indexType NextBElemWRTCR; indexType nextBElemWRTCR; public: public: CellBoundaryConnection(indexType cellLeft = INVALID_INDEX(indexType), CellBoundaryConnection(indexType cellLeft = INVALID_INDEX(indexType), indexType cellRight = INVALID_INDEX(indexType), indexType cellRight = INVALID_INDEX(indexType), Loading @@ -25,20 +25,20 @@ public: /* /* ** Set atribute methods ** Set atribute methods */ */ void SetNextBElemWRTCR(indexType nextIndex); void setNextBElemWRTCR(indexType nextIndex); void SetNextBElemWRTCL(indexType nextIndex); void setNextBElemWRTCL(indexType nextIndex); bool SetNextBElem(indexType nextBElemIndex, indexType cellIndex); bool setNextBElem(indexType nextBElemIndex, indexType cellIndex); indexType GetNextBElemWRTCL() const; indexType getNextBElemWRTCL() const; indexType GetNextBElemWRTCR() const; indexType getNextBElemWRTCR() const; indexType GetNextBElem(indexType cellIndex) const; indexType getNextBElem(indexType cellIndex) const; // Returns the other Cell than sent by parameter // Returns the other Cell than sent by parameter indexType GetOtherCellIndex(indexType cellIndex) const; indexType getOtherCellIndex(indexType cellIndex) const; }; }; Loading @@ -50,22 +50,22 @@ public: template<typename indexType> template<typename indexType> CellBoundaryConnection<indexType>::CellBoundaryConnection(indexType cellLeft, indexType cellRight, indexType nextLeft, indexType nextRight) CellBoundaryConnection<indexType>::CellBoundaryConnection(indexType cellLeft, indexType cellRight, indexType nextLeft, indexType nextRight) : CellConnection<indexType> (cellLeft, cellRight) { : CellConnection<indexType> (cellLeft, cellRight) { NextBElemWRTCL = nextLeft; nextBElemWRTCL = nextLeft; NextBElemWRTCR = nextRight; nextBElemWRTCR = nextRight; } } template<typename indexType> template<typename indexType> void CellBoundaryConnection<indexType>::SetNextBElemWRTCR(indexType nextIndex){ void CellBoundaryConnection<indexType>::setNextBElemWRTCR(indexType nextIndex){ NextBElemWRTCR = nextIndex; nextBElemWRTCR = nextIndex; } } template<typename indexType> template<typename indexType> void CellBoundaryConnection<indexType>::SetNextBElemWRTCL(indexType nextIndex){ void CellBoundaryConnection<indexType>::setNextBElemWRTCL(indexType nextIndex){ NextBElemWRTCL = nextIndex; nextBElemWRTCL = nextIndex; } } template<typename indexType> template<typename indexType> bool CellBoundaryConnection<indexType>::SetNextBElem(indexType nextBElemIndex, indexType cellIndex){ bool CellBoundaryConnection<indexType>::setNextBElem(indexType nextBElemIndex, indexType cellIndex){ // CellIndex is invalid then false returned // CellIndex is invalid then false returned if (cellIndex == INVALID_INDEX(indexType)){ if (cellIndex == INVALID_INDEX(indexType)){ Loading @@ -73,16 +73,16 @@ bool CellBoundaryConnection<indexType>::SetNextBElem(indexType nextBElemIndex, i } } // first test wether cell index eaqules left or right // first test wether cell index eaqules left or right // then is posible to set up invalid indexes // then is posible to set up invalid indexes if (CellConnection<indexType>::GetCellLeftIndex() == cellIndex) { if (CellConnection<indexType>::getCellLeftIndex() == cellIndex) { SetNextBElemWRTCL(nextBElemIndex); setNextBElemWRTCL(nextBElemIndex); return true; return true; } } if (CellConnection<indexType>::GetCellRightIndex() == cellIndex){ if (CellConnection<indexType>::getCellRightIndex() == cellIndex){ SetNextBElemWRTCR(nextBElemIndex); setNextBElemWRTCR(nextBElemIndex); return true; return true; } } Loading @@ -90,17 +90,17 @@ bool CellBoundaryConnection<indexType>::SetNextBElem(indexType nextBElemIndex, i // Attribute CellRightIndex is invalid then // Attribute CellRightIndex is invalid then // CellRightIndex is set as cellIndex // CellRightIndex is set as cellIndex if (CellConnection<indexType>::GetCellLeftIndex() == INVALID_INDEX(indexType)){ if (CellConnection<indexType>::getCellLeftIndex() == INVALID_INDEX(indexType)){ CellConnection<indexType>::SetCellLeftIndex(cellIndex); CellConnection<indexType>::setCellLeftIndex(cellIndex); } } // Parameter cellIndex is equal to CellRightIndex // Parameter cellIndex is equal to CellRightIndex // then nextEdgeWRTCL is set as nextEdgeIndex, ret true // then nextEdgeWRTCL is set as nextEdgeIndex, ret true if (cellIndex == CellConnection<indexType>::GetCellLeftIndex()) { if (cellIndex == CellConnection<indexType>::getCellLeftIndex()) { SetNextBElemWRTCL(nextBElemIndex); setNextBElemWRTCL(nextBElemIndex); return true; return true; Loading @@ -109,15 +109,15 @@ bool CellBoundaryConnection<indexType>::SetNextBElem(indexType nextBElemIndex, i // Attribute CellRightIndex is invalid // Attribute CellRightIndex is invalid // but CellLeftIndex is already filled // but CellLeftIndex is already filled // then set CellLeftIndex as cellIndex // then set CellLeftIndex as cellIndex if(CellConnection<indexType>::GetCellRightIndex() == INVALID_INDEX(indexType)){ if(CellConnection<indexType>::getCellRightIndex() == INVALID_INDEX(indexType)){ CellConnection<indexType>::SetCellRightIndex(cellIndex); CellConnection<indexType>::setCellRightIndex(cellIndex); } } // Parameter cellIndex is equal to CellLeftIndex then // Parameter cellIndex is equal to CellLeftIndex then // set NextEdgeWRTCR as nextEdgeIndex, ret true // set NextEdgeWRTCR as nextEdgeIndex, ret true if (cellIndex == CellConnection<indexType>::GetCellRightIndex()){ if (cellIndex == CellConnection<indexType>::getCellRightIndex()){ SetNextBElemWRTCR(nextBElemIndex); setNextBElemWRTCR(nextBElemIndex); return true; return true; Loading @@ -137,17 +137,17 @@ bool CellBoundaryConnection<indexType>::SetNextBElem(indexType nextBElemIndex, i } } template<typename indexType> template<typename indexType> indexType CellBoundaryConnection<indexType>::GetNextBElemWRTCL() const { indexType CellBoundaryConnection<indexType>::getNextBElemWRTCL() const { return NextBElemWRTCL; return nextBElemWRTCL; } } template<typename indexType> template<typename indexType> indexType CellBoundaryConnection<indexType>::GetNextBElemWRTCR() const { indexType CellBoundaryConnection<indexType>::getNextBElemWRTCR() const { return NextBElemWRTCR; return nextBElemWRTCR; } } template<typename indexType> template<typename indexType> indexType CellBoundaryConnection<indexType>::GetNextBElem(indexType cellIndex) const{ indexType CellBoundaryConnection<indexType>::getNextBElem(indexType cellIndex) const{ // If cell is nullptr then ret nullptr // If cell is nullptr then ret nullptr if (cellIndex == INVALID_INDEX(indexType)) { if (cellIndex == INVALID_INDEX(indexType)) { return INVALID_INDEX(indexType); return INVALID_INDEX(indexType); Loading @@ -155,12 +155,12 @@ indexType CellBoundaryConnection<indexType>::GetNextBElem(indexType cellIndex) c // If the cell is equal the Cell1 then return the NextBElemWRTCR // If the cell is equal the Cell1 then return the NextBElemWRTCR if(cellIndex == CellConnection<indexType>::GetCellRightIndex()){ if(cellIndex == CellConnection<indexType>::getCellRightIndex()){ return GetNextBElemWRTCR(); return getNextBElemWRTCR(); // If the cell is equal the Cell2 then return the NextBElemWRTCL // If the cell is equal the Cell2 then return the NextBElemWRTCL } else if (cellIndex == CellConnection<indexType>::GetCellLeftIndex()){ } else if (cellIndex == CellConnection<indexType>::getCellLeftIndex()){ return GetNextBElemWRTCL(); return getNextBElemWRTCL(); // If the cell is not equal left cell neither cell right then return invalid index // If the cell is not equal left cell neither cell right then return invalid index } else { } else { Loading @@ -169,11 +169,11 @@ indexType CellBoundaryConnection<indexType>::GetNextBElem(indexType cellIndex) c } } template<typename indexType> template<typename indexType> indexType CellBoundaryConnection<indexType>::GetOtherCellIndex(indexType cellIndex) const{ indexType CellBoundaryConnection<indexType>::getOtherCellIndex(indexType cellIndex) const{ if (cellIndex == CellConnection<indexType>::GetCellLeftIndex()) { if (cellIndex == CellConnection<indexType>::getCellLeftIndex()) { return CellConnection<indexType>::GetCellRightIndex(); return CellConnection<indexType>::getCellRightIndex(); } else if (cellIndex == CellConnection<indexType>::GetCellRightIndex()){ } else if (cellIndex == CellConnection<indexType>::getCellRightIndex()){ return CellConnection<indexType>::GetCellLeftIndex(); return CellConnection<indexType>::getCellLeftIndex(); } } return INVALID_INDEX(indexType); return INVALID_INDEX(indexType); } } Loading Unstructured_mesh/cellconnection.h +36 −36 Original line number Original line Diff line number Diff line Loading @@ -10,7 +10,7 @@ class CellConnection { class CellConnection { // Indexes to two cells which neighbours // Indexes to two cells which neighbours // with this edge // with this edge indexType CellRightIndex, CellLeftIndex; indexType cellRightIndex, cellLeftIndex; public: public: /** /** * @brief CellConnection * @brief CellConnection Loading @@ -21,35 +21,35 @@ indexType cellRight = INVALID_INDEX(indexType)); indexType cellRight = INVALID_INDEX(indexType)); /** /** * @brief SetCellRightIndex * @brief setCellRightIndex * @param cellIndex * @param cellIndex */ */ void SetCellRightIndex(indexType cellIndex); void setCellRightIndex(indexType cellIndex); /** /** * @brief SetCellLeftIndex * @brief SetCellLeftIndex * @param cellIndex * @param cellIndex */ */ void SetCellLeftIndex(indexType cellIndex); void setCellLeftIndex(indexType cellIndex); /** /** * @brief SetCellIndex * @brief SetCellIndex * @param cellIndex * @param cellIndex * @return * @return */ */ bool SetCellIndex(indexType cellIndex); bool setCellIndex(indexType cellIndex); /** /** * @brief GetCellRightIndex * @brief GetCellRightIndex * @return * @return */ */ indexType GetCellRightIndex() const; indexType getCellRightIndex() const; /** /** * @brief GetCellLeftIndex * @brief GetCellLeftIndex * @return * @return */ */ indexType GetCellLeftIndex() const; indexType getCellLeftIndex() const; // Returns the other Cell than sent by parameter // Returns the other Cell than sent by parameter /** /** Loading @@ -57,14 +57,14 @@ * @param cellIndex * @param cellIndex * @return * @return */ */ indexType GetOtherCellIndex(indexType cellIndex) const; indexType getOtherCellIndex(indexType cellIndex) const; /** /** * @brief CellsOK * @brief CellsOK * @return true if both cell indexes are set * @return true if both cell indexes are set */ */ bool CellsOK() const; bool cellsOK() const; /** /** Loading @@ -72,7 +72,7 @@ * * * swaps the left and right cell indexes * swaps the left and right cell indexes */ */ void SwapCellsLR(); void swapCellsLR(); }; }; Loading @@ -85,22 +85,22 @@ template<typename indexType> template<typename indexType> CellConnection<indexType>::CellConnection(indexType cellLeft, indexType cellRight){ CellConnection<indexType>::CellConnection(indexType cellLeft, indexType cellRight){ CellRightIndex = cellRight; cellRightIndex = cellRight; CellLeftIndex = cellLeft; cellLeftIndex = cellLeft; } } template<typename indexType> template<typename indexType> void CellConnection<indexType>::SetCellRightIndex(indexType cellIndex){ void CellConnection<indexType>::setCellRightIndex(indexType cellIndex){ CellRightIndex = cellIndex; cellRightIndex = cellIndex; } } template<typename indexType> template<typename indexType> void CellConnection<indexType>::SetCellLeftIndex(indexType cellIndex){ void CellConnection<indexType>::setCellLeftIndex(indexType cellIndex){ CellLeftIndex = cellIndex; cellLeftIndex = cellIndex; } } template<typename indexType> template<typename indexType> bool CellConnection<indexType>::SetCellIndex(indexType cellIndex){ bool CellConnection<indexType>::setCellIndex(indexType cellIndex){ // If the parameter cell is nullptr then ret false // If the parameter cell is nullptr then ret false if (cellIndex == INVALID_INDEX(indexType)){ if (cellIndex == INVALID_INDEX(indexType)){ return false; return false; Loading @@ -108,17 +108,17 @@ bool CellConnection<indexType>::SetCellIndex(indexType cellIndex){ // If the CellLeftIndex is lower than 0 // If the CellLeftIndex is lower than 0 // then set CellLeftIndex as cellIndex, ret true // then set CellLeftIndex as cellIndex, ret true if (GetCellLeftIndex() == INVALID_INDEX(indexType)) { if (getCellLeftIndex() == INVALID_INDEX(indexType)) { SetCellLeftIndex(cellIndex); setCellLeftIndex(cellIndex); return true; return true; // If the CellRightIndex is valid // If the CellRightIndex is valid // and CellLeftIndex is not // and CellLeftIndex is not // then set CellRightIndex as cellIndex // then set CellRightIndex as cellIndex } else if (GetCellRightIndex() == INVALID_INDEX(indexType)) { } else if (getCellRightIndex() == INVALID_INDEX(indexType)) { SetCellRightIndex(cellIndex); setCellRightIndex(cellIndex); return true; return true; // If both CellLeftIndex and CellRightIndex are >= 0 // If both CellLeftIndex and CellRightIndex are >= 0 Loading @@ -133,37 +133,37 @@ bool CellConnection<indexType>::SetCellIndex(indexType cellIndex){ } } template<typename indexType> template<typename indexType> indexType CellConnection<indexType>::GetCellRightIndex() const { indexType CellConnection<indexType>::getCellRightIndex() const { return CellRightIndex; return cellRightIndex; } } template<typename indexType> template<typename indexType> indexType CellConnection<indexType>::GetCellLeftIndex() const { indexType CellConnection<indexType>::getCellLeftIndex() const { return CellLeftIndex; return cellLeftIndex; } } template<typename indexType> template<typename indexType> indexType CellConnection<indexType>::GetOtherCellIndex(indexType cellIndex) const{ indexType CellConnection<indexType>::getOtherCellIndex(indexType cellIndex) const{ if (cellIndex == GetCellLeftIndex()) { if (cellIndex == getCellLeftIndex()) { return GetCellRightIndex(); return getCellRightIndex(); } else if (cellIndex == GetCellRightIndex()){ } else if (cellIndex == getCellRightIndex()){ return GetCellLeftIndex(); return getCellLeftIndex(); } } return INVALID_INDEX(indexType); return INVALID_INDEX(indexType); } } template<typename indexType> template<typename indexType> bool CellConnection<indexType>::CellsOK() const { bool CellConnection<indexType>::cellsOK() const { return GetCellRightIndex() != INVALID_INDEX(indexType) && GetCellLeftIndex() != INVALID_INDEX(indexType); return getCellRightIndex() != INVALID_INDEX(indexType) && getCellLeftIndex() != INVALID_INDEX(indexType); } } template<typename indexType> template<typename indexType> void CellConnection<indexType>::SwapCellsLR() { void CellConnection<indexType>::swapCellsLR() { indexType cellLeftIndex = GetCellRightIndex(); indexType cellLeftIndex = getCellRightIndex(); SetCellRightIndex(GetCellLeftIndex()); setCellRightIndex(getCellLeftIndex()); SetCellLeftIndex(cellLeftIndex); setCellLeftIndex(cellLeftIndex); } } Loading Unstructured_mesh/computationaly_significant_element.h +14 −14 Original line number Original line Diff line number Diff line Loading @@ -6,32 +6,32 @@ template <unsigned int MeshDim, typename Real> class ComputationallySignificantElement class ComputationallySignificantElement { { protected: protected: Vertex<MeshDim, Real> Center; Vertex<MeshDim, Real> center; int Flag; int flag; public: public: ComputationallySignificantElement() { ComputationallySignificantElement() { Center = {}; center = {}; Flag = int(); flag = int(); } } Vertex<MeshDim, Real>& GetCenter(){ Vertex<MeshDim, Real>& getCenter(){ return Center; return center; } } const Vertex<MeshDim, Real>& GetCenter() const { const Vertex<MeshDim, Real>& getCenter() const { return Center; return center; } } void SetCenter(const Vertex<MeshDim, Real>& v) { void setCenter(const Vertex<MeshDim, Real>& v) { Center = v; center = v; } } int& GetFlag() { int& getFlag() { return Flag; return flag; } } const int& GetFlag() const { const int& getFlag() const { return Flag; return flag; } } }; }; Loading Unstructured_mesh/main.cpp +143 −143 File changed.Preview size limit exceeded, changes collapsed. Show changes Unstructured_mesh/mesh_element.h +16 −16 Original line number Original line Diff line number Diff line Loading @@ -61,12 +61,12 @@ class SubelementContainer : public std::array<Subelement<IndexType>, Reserve>{ unsigned char numberOfElements = 0; unsigned char numberOfElements = 0; public: public: unsigned char GetNumberOfSubElements(){ unsigned char getNumberOfSubElements(){ return numberOfElements; return numberOfElements; } } void AddSubelement(IndexType index, bool isLeft) { void addSubelement(IndexType index, bool isLeft) { if (numberOfElements < Reserve){ if (numberOfElements < Reserve){ this->at(numberOfElements).index = index; this->at(numberOfElements).index = index; this->at(numberOfElements).isLeft = isLeft; this->at(numberOfElements).isLeft = isLeft; Loading @@ -79,7 +79,7 @@ public: } } void RemoveSubelement(unsigned char atIndex){ void removeSubelement(unsigned char atIndex){ if (atIndex < numberOfElements){ if (atIndex < numberOfElements){ for(unsigned char i = atIndex; i < numberOfElements - 1; i++){ for(unsigned char i = atIndex; i < numberOfElements - 1; i++){ this->at(i) = this->at(i+1); this->at(i) = this->at(i+1); Loading @@ -94,11 +94,11 @@ public: } } typename std::array<Subelement<IndexType>, Reserve>::iterator end(){ typename std::array<Subelement<IndexType>, Reserve>::iterator end(){ return this->begin() + GetNumberOfSubElements(); return this->begin() + getNumberOfSubElements(); } } typename std::array<Subelement<IndexType>, Reserve>::const_iterator cend(){ typename std::array<Subelement<IndexType>, Reserve>::const_iterator cend(){ return this->cbegin() + GetNumberOfSubElements(); return this->cbegin() + getNumberOfSubElements(); } } }; }; Loading @@ -118,11 +118,11 @@ class MeshElement : public MeshElementBase<IndexType>, SubelementContainer<IndexType, Reserve> subelements; SubelementContainer<IndexType, Reserve> subelements; public: public: SubelementContainer<IndexType, Reserve>& GetSubelements(){ SubelementContainer<IndexType, Reserve>& getSubelements(){ return subelements; return subelements; } } const SubelementContainer<IndexType, Reserve>& GetSubelements() const { const SubelementContainer<IndexType, Reserve>& getSubelements() const { return subelements; return subelements; } } Loading Loading @@ -221,11 +221,11 @@ public: } } IndexType GetBoundaryElementIndex(){ IndexType getBoundaryElementIndex(){ return boundaryElementIndex; return boundaryElementIndex; } } void SetBoundaryElementIndex(IndexType index){ void setBoundaryElementIndex(IndexType index){ boundaryElementIndex = index; boundaryElementIndex = index; } } Loading Loading @@ -346,7 +346,7 @@ public: void SetupBoundaryCellsCenters() { void SetupBoundaryCellsCenters() { for(Cell& cell : BoundaryCells){ for(Cell& cell : BoundaryCells){ cell.SetCenter(GetFaces().at(cell.GetBoundaryElementIndex()).GetCenter()); cell.SetCenter(GetFaces().at(cell.getBoundaryElementIndex()).GetCenter()); } } } } Loading @@ -363,8 +363,8 @@ public: actual = firstBElem; actual = firstBElem; this->parentMesh = parentMesh; this->parentMesh = parentMesh; } } CellSubelementIterator& operator++ () {actual = parentMesh->GetFaces().at(actual).GetNextBElem(cellIndex) == firstBElem ? INVALID_INDEX(IndexType) : parentMesh->GetFaces().at(actual).GetNextBElem(cellIndex); return *this;} CellSubelementIterator& operator++ () {actual = parentMesh->GetFaces().at(actual).getNextBElem(cellIndex) == firstBElem ? INVALID_INDEX(IndexType) : parentMesh->GetFaces().at(actual).getNextBElem(cellIndex); return *this;} CellSubelementIterator& operator++ (int) {actual = parentMesh->GetFaces().at(actual).GetNextBElem(cellIndex) == firstBElem ? INVALID_INDEX(IndexType) : parentMesh->GetFaces().at(actual).GetNextBElem(cellIndex); return *this;} CellSubelementIterator& operator++ (int) {actual = parentMesh->GetFaces().at(actual).getNextBElem(cellIndex) == firstBElem ? INVALID_INDEX(IndexType) : parentMesh->GetFaces().at(actual).getNextBElem(cellIndex); return *this;} IndexType operator* (){return actual;} IndexType operator* (){return actual;} bool operator== (CellSubelementIterator& it) {return actual == it.actual;} bool operator== (CellSubelementIterator& it) {return actual == it.actual;} bool operator!= (CellSubelementIterator& it) {return actual != it.actual;} bool operator!= (CellSubelementIterator& it) {return actual != it.actual;} Loading @@ -380,7 +380,7 @@ public: } } CellSubelementIterator begin() { CellSubelementIterator begin() { return CellSubelementIterator(cellIndex, parentMesh->GetCells()[cellIndex].GetBoundaryElementIndex(), parentMesh); return CellSubelementIterator(cellIndex, parentMesh->GetCells()[cellIndex].getBoundaryElementIndex(), parentMesh); } } CellSubelementIterator end() { CellSubelementIterator end() { Loading Loading @@ -408,8 +408,8 @@ public: return elementIndex; return elementIndex; } } SubelementContainer<IndexType, reserve<ElementDim>()>& GetSubelements(){ SubelementContainer<IndexType, reserve<ElementDim>()>& getSubelements(){ return parentMesh->template GetElements<ElementDim>()[elementIndex].GetSubelements(); return parentMesh->template GetElements<ElementDim>()[elementIndex].getSubelements(); } } }; }; Loading @@ -433,7 +433,7 @@ public: return elementIndex; return elementIndex; } } CellSubelements GetSubelements(){ CellSubelements getSubelements(){ return CellSubelements(parentMesh, elementIndex); return CellSubelements(parentMesh, elementIndex); } } }; }; Loading Loading
Unstructured_mesh/cellboundaryconnection.h +44 −44 Original line number Original line Diff line number Diff line Loading @@ -6,17 +6,17 @@ template<typename indexType> template<typename indexType> class CellBoundaryConnection : public CellConnection<indexType> { class CellBoundaryConnection : public CellConnection<indexType> { /** /** * @brief NextBElemWRTCL * @brief nextBElemWRTCL * * * Index of the next boundary element with respect to the left cell * Index of the next boundary element with respect to the left cell */ */ indexType NextBElemWRTCL; indexType nextBElemWRTCL; /** /** * @brief NextBElemWRTCR * @brief nextBElemWRTCR * * * Index of the next boundary element with respect to right cell * Index of the next boundary element with respect to right cell */ */ indexType NextBElemWRTCR; indexType nextBElemWRTCR; public: public: CellBoundaryConnection(indexType cellLeft = INVALID_INDEX(indexType), CellBoundaryConnection(indexType cellLeft = INVALID_INDEX(indexType), indexType cellRight = INVALID_INDEX(indexType), indexType cellRight = INVALID_INDEX(indexType), Loading @@ -25,20 +25,20 @@ public: /* /* ** Set atribute methods ** Set atribute methods */ */ void SetNextBElemWRTCR(indexType nextIndex); void setNextBElemWRTCR(indexType nextIndex); void SetNextBElemWRTCL(indexType nextIndex); void setNextBElemWRTCL(indexType nextIndex); bool SetNextBElem(indexType nextBElemIndex, indexType cellIndex); bool setNextBElem(indexType nextBElemIndex, indexType cellIndex); indexType GetNextBElemWRTCL() const; indexType getNextBElemWRTCL() const; indexType GetNextBElemWRTCR() const; indexType getNextBElemWRTCR() const; indexType GetNextBElem(indexType cellIndex) const; indexType getNextBElem(indexType cellIndex) const; // Returns the other Cell than sent by parameter // Returns the other Cell than sent by parameter indexType GetOtherCellIndex(indexType cellIndex) const; indexType getOtherCellIndex(indexType cellIndex) const; }; }; Loading @@ -50,22 +50,22 @@ public: template<typename indexType> template<typename indexType> CellBoundaryConnection<indexType>::CellBoundaryConnection(indexType cellLeft, indexType cellRight, indexType nextLeft, indexType nextRight) CellBoundaryConnection<indexType>::CellBoundaryConnection(indexType cellLeft, indexType cellRight, indexType nextLeft, indexType nextRight) : CellConnection<indexType> (cellLeft, cellRight) { : CellConnection<indexType> (cellLeft, cellRight) { NextBElemWRTCL = nextLeft; nextBElemWRTCL = nextLeft; NextBElemWRTCR = nextRight; nextBElemWRTCR = nextRight; } } template<typename indexType> template<typename indexType> void CellBoundaryConnection<indexType>::SetNextBElemWRTCR(indexType nextIndex){ void CellBoundaryConnection<indexType>::setNextBElemWRTCR(indexType nextIndex){ NextBElemWRTCR = nextIndex; nextBElemWRTCR = nextIndex; } } template<typename indexType> template<typename indexType> void CellBoundaryConnection<indexType>::SetNextBElemWRTCL(indexType nextIndex){ void CellBoundaryConnection<indexType>::setNextBElemWRTCL(indexType nextIndex){ NextBElemWRTCL = nextIndex; nextBElemWRTCL = nextIndex; } } template<typename indexType> template<typename indexType> bool CellBoundaryConnection<indexType>::SetNextBElem(indexType nextBElemIndex, indexType cellIndex){ bool CellBoundaryConnection<indexType>::setNextBElem(indexType nextBElemIndex, indexType cellIndex){ // CellIndex is invalid then false returned // CellIndex is invalid then false returned if (cellIndex == INVALID_INDEX(indexType)){ if (cellIndex == INVALID_INDEX(indexType)){ Loading @@ -73,16 +73,16 @@ bool CellBoundaryConnection<indexType>::SetNextBElem(indexType nextBElemIndex, i } } // first test wether cell index eaqules left or right // first test wether cell index eaqules left or right // then is posible to set up invalid indexes // then is posible to set up invalid indexes if (CellConnection<indexType>::GetCellLeftIndex() == cellIndex) { if (CellConnection<indexType>::getCellLeftIndex() == cellIndex) { SetNextBElemWRTCL(nextBElemIndex); setNextBElemWRTCL(nextBElemIndex); return true; return true; } } if (CellConnection<indexType>::GetCellRightIndex() == cellIndex){ if (CellConnection<indexType>::getCellRightIndex() == cellIndex){ SetNextBElemWRTCR(nextBElemIndex); setNextBElemWRTCR(nextBElemIndex); return true; return true; } } Loading @@ -90,17 +90,17 @@ bool CellBoundaryConnection<indexType>::SetNextBElem(indexType nextBElemIndex, i // Attribute CellRightIndex is invalid then // Attribute CellRightIndex is invalid then // CellRightIndex is set as cellIndex // CellRightIndex is set as cellIndex if (CellConnection<indexType>::GetCellLeftIndex() == INVALID_INDEX(indexType)){ if (CellConnection<indexType>::getCellLeftIndex() == INVALID_INDEX(indexType)){ CellConnection<indexType>::SetCellLeftIndex(cellIndex); CellConnection<indexType>::setCellLeftIndex(cellIndex); } } // Parameter cellIndex is equal to CellRightIndex // Parameter cellIndex is equal to CellRightIndex // then nextEdgeWRTCL is set as nextEdgeIndex, ret true // then nextEdgeWRTCL is set as nextEdgeIndex, ret true if (cellIndex == CellConnection<indexType>::GetCellLeftIndex()) { if (cellIndex == CellConnection<indexType>::getCellLeftIndex()) { SetNextBElemWRTCL(nextBElemIndex); setNextBElemWRTCL(nextBElemIndex); return true; return true; Loading @@ -109,15 +109,15 @@ bool CellBoundaryConnection<indexType>::SetNextBElem(indexType nextBElemIndex, i // Attribute CellRightIndex is invalid // Attribute CellRightIndex is invalid // but CellLeftIndex is already filled // but CellLeftIndex is already filled // then set CellLeftIndex as cellIndex // then set CellLeftIndex as cellIndex if(CellConnection<indexType>::GetCellRightIndex() == INVALID_INDEX(indexType)){ if(CellConnection<indexType>::getCellRightIndex() == INVALID_INDEX(indexType)){ CellConnection<indexType>::SetCellRightIndex(cellIndex); CellConnection<indexType>::setCellRightIndex(cellIndex); } } // Parameter cellIndex is equal to CellLeftIndex then // Parameter cellIndex is equal to CellLeftIndex then // set NextEdgeWRTCR as nextEdgeIndex, ret true // set NextEdgeWRTCR as nextEdgeIndex, ret true if (cellIndex == CellConnection<indexType>::GetCellRightIndex()){ if (cellIndex == CellConnection<indexType>::getCellRightIndex()){ SetNextBElemWRTCR(nextBElemIndex); setNextBElemWRTCR(nextBElemIndex); return true; return true; Loading @@ -137,17 +137,17 @@ bool CellBoundaryConnection<indexType>::SetNextBElem(indexType nextBElemIndex, i } } template<typename indexType> template<typename indexType> indexType CellBoundaryConnection<indexType>::GetNextBElemWRTCL() const { indexType CellBoundaryConnection<indexType>::getNextBElemWRTCL() const { return NextBElemWRTCL; return nextBElemWRTCL; } } template<typename indexType> template<typename indexType> indexType CellBoundaryConnection<indexType>::GetNextBElemWRTCR() const { indexType CellBoundaryConnection<indexType>::getNextBElemWRTCR() const { return NextBElemWRTCR; return nextBElemWRTCR; } } template<typename indexType> template<typename indexType> indexType CellBoundaryConnection<indexType>::GetNextBElem(indexType cellIndex) const{ indexType CellBoundaryConnection<indexType>::getNextBElem(indexType cellIndex) const{ // If cell is nullptr then ret nullptr // If cell is nullptr then ret nullptr if (cellIndex == INVALID_INDEX(indexType)) { if (cellIndex == INVALID_INDEX(indexType)) { return INVALID_INDEX(indexType); return INVALID_INDEX(indexType); Loading @@ -155,12 +155,12 @@ indexType CellBoundaryConnection<indexType>::GetNextBElem(indexType cellIndex) c // If the cell is equal the Cell1 then return the NextBElemWRTCR // If the cell is equal the Cell1 then return the NextBElemWRTCR if(cellIndex == CellConnection<indexType>::GetCellRightIndex()){ if(cellIndex == CellConnection<indexType>::getCellRightIndex()){ return GetNextBElemWRTCR(); return getNextBElemWRTCR(); // If the cell is equal the Cell2 then return the NextBElemWRTCL // If the cell is equal the Cell2 then return the NextBElemWRTCL } else if (cellIndex == CellConnection<indexType>::GetCellLeftIndex()){ } else if (cellIndex == CellConnection<indexType>::getCellLeftIndex()){ return GetNextBElemWRTCL(); return getNextBElemWRTCL(); // If the cell is not equal left cell neither cell right then return invalid index // If the cell is not equal left cell neither cell right then return invalid index } else { } else { Loading @@ -169,11 +169,11 @@ indexType CellBoundaryConnection<indexType>::GetNextBElem(indexType cellIndex) c } } template<typename indexType> template<typename indexType> indexType CellBoundaryConnection<indexType>::GetOtherCellIndex(indexType cellIndex) const{ indexType CellBoundaryConnection<indexType>::getOtherCellIndex(indexType cellIndex) const{ if (cellIndex == CellConnection<indexType>::GetCellLeftIndex()) { if (cellIndex == CellConnection<indexType>::getCellLeftIndex()) { return CellConnection<indexType>::GetCellRightIndex(); return CellConnection<indexType>::getCellRightIndex(); } else if (cellIndex == CellConnection<indexType>::GetCellRightIndex()){ } else if (cellIndex == CellConnection<indexType>::getCellRightIndex()){ return CellConnection<indexType>::GetCellLeftIndex(); return CellConnection<indexType>::getCellLeftIndex(); } } return INVALID_INDEX(indexType); return INVALID_INDEX(indexType); } } Loading
Unstructured_mesh/cellconnection.h +36 −36 Original line number Original line Diff line number Diff line Loading @@ -10,7 +10,7 @@ class CellConnection { class CellConnection { // Indexes to two cells which neighbours // Indexes to two cells which neighbours // with this edge // with this edge indexType CellRightIndex, CellLeftIndex; indexType cellRightIndex, cellLeftIndex; public: public: /** /** * @brief CellConnection * @brief CellConnection Loading @@ -21,35 +21,35 @@ indexType cellRight = INVALID_INDEX(indexType)); indexType cellRight = INVALID_INDEX(indexType)); /** /** * @brief SetCellRightIndex * @brief setCellRightIndex * @param cellIndex * @param cellIndex */ */ void SetCellRightIndex(indexType cellIndex); void setCellRightIndex(indexType cellIndex); /** /** * @brief SetCellLeftIndex * @brief SetCellLeftIndex * @param cellIndex * @param cellIndex */ */ void SetCellLeftIndex(indexType cellIndex); void setCellLeftIndex(indexType cellIndex); /** /** * @brief SetCellIndex * @brief SetCellIndex * @param cellIndex * @param cellIndex * @return * @return */ */ bool SetCellIndex(indexType cellIndex); bool setCellIndex(indexType cellIndex); /** /** * @brief GetCellRightIndex * @brief GetCellRightIndex * @return * @return */ */ indexType GetCellRightIndex() const; indexType getCellRightIndex() const; /** /** * @brief GetCellLeftIndex * @brief GetCellLeftIndex * @return * @return */ */ indexType GetCellLeftIndex() const; indexType getCellLeftIndex() const; // Returns the other Cell than sent by parameter // Returns the other Cell than sent by parameter /** /** Loading @@ -57,14 +57,14 @@ * @param cellIndex * @param cellIndex * @return * @return */ */ indexType GetOtherCellIndex(indexType cellIndex) const; indexType getOtherCellIndex(indexType cellIndex) const; /** /** * @brief CellsOK * @brief CellsOK * @return true if both cell indexes are set * @return true if both cell indexes are set */ */ bool CellsOK() const; bool cellsOK() const; /** /** Loading @@ -72,7 +72,7 @@ * * * swaps the left and right cell indexes * swaps the left and right cell indexes */ */ void SwapCellsLR(); void swapCellsLR(); }; }; Loading @@ -85,22 +85,22 @@ template<typename indexType> template<typename indexType> CellConnection<indexType>::CellConnection(indexType cellLeft, indexType cellRight){ CellConnection<indexType>::CellConnection(indexType cellLeft, indexType cellRight){ CellRightIndex = cellRight; cellRightIndex = cellRight; CellLeftIndex = cellLeft; cellLeftIndex = cellLeft; } } template<typename indexType> template<typename indexType> void CellConnection<indexType>::SetCellRightIndex(indexType cellIndex){ void CellConnection<indexType>::setCellRightIndex(indexType cellIndex){ CellRightIndex = cellIndex; cellRightIndex = cellIndex; } } template<typename indexType> template<typename indexType> void CellConnection<indexType>::SetCellLeftIndex(indexType cellIndex){ void CellConnection<indexType>::setCellLeftIndex(indexType cellIndex){ CellLeftIndex = cellIndex; cellLeftIndex = cellIndex; } } template<typename indexType> template<typename indexType> bool CellConnection<indexType>::SetCellIndex(indexType cellIndex){ bool CellConnection<indexType>::setCellIndex(indexType cellIndex){ // If the parameter cell is nullptr then ret false // If the parameter cell is nullptr then ret false if (cellIndex == INVALID_INDEX(indexType)){ if (cellIndex == INVALID_INDEX(indexType)){ return false; return false; Loading @@ -108,17 +108,17 @@ bool CellConnection<indexType>::SetCellIndex(indexType cellIndex){ // If the CellLeftIndex is lower than 0 // If the CellLeftIndex is lower than 0 // then set CellLeftIndex as cellIndex, ret true // then set CellLeftIndex as cellIndex, ret true if (GetCellLeftIndex() == INVALID_INDEX(indexType)) { if (getCellLeftIndex() == INVALID_INDEX(indexType)) { SetCellLeftIndex(cellIndex); setCellLeftIndex(cellIndex); return true; return true; // If the CellRightIndex is valid // If the CellRightIndex is valid // and CellLeftIndex is not // and CellLeftIndex is not // then set CellRightIndex as cellIndex // then set CellRightIndex as cellIndex } else if (GetCellRightIndex() == INVALID_INDEX(indexType)) { } else if (getCellRightIndex() == INVALID_INDEX(indexType)) { SetCellRightIndex(cellIndex); setCellRightIndex(cellIndex); return true; return true; // If both CellLeftIndex and CellRightIndex are >= 0 // If both CellLeftIndex and CellRightIndex are >= 0 Loading @@ -133,37 +133,37 @@ bool CellConnection<indexType>::SetCellIndex(indexType cellIndex){ } } template<typename indexType> template<typename indexType> indexType CellConnection<indexType>::GetCellRightIndex() const { indexType CellConnection<indexType>::getCellRightIndex() const { return CellRightIndex; return cellRightIndex; } } template<typename indexType> template<typename indexType> indexType CellConnection<indexType>::GetCellLeftIndex() const { indexType CellConnection<indexType>::getCellLeftIndex() const { return CellLeftIndex; return cellLeftIndex; } } template<typename indexType> template<typename indexType> indexType CellConnection<indexType>::GetOtherCellIndex(indexType cellIndex) const{ indexType CellConnection<indexType>::getOtherCellIndex(indexType cellIndex) const{ if (cellIndex == GetCellLeftIndex()) { if (cellIndex == getCellLeftIndex()) { return GetCellRightIndex(); return getCellRightIndex(); } else if (cellIndex == GetCellRightIndex()){ } else if (cellIndex == getCellRightIndex()){ return GetCellLeftIndex(); return getCellLeftIndex(); } } return INVALID_INDEX(indexType); return INVALID_INDEX(indexType); } } template<typename indexType> template<typename indexType> bool CellConnection<indexType>::CellsOK() const { bool CellConnection<indexType>::cellsOK() const { return GetCellRightIndex() != INVALID_INDEX(indexType) && GetCellLeftIndex() != INVALID_INDEX(indexType); return getCellRightIndex() != INVALID_INDEX(indexType) && getCellLeftIndex() != INVALID_INDEX(indexType); } } template<typename indexType> template<typename indexType> void CellConnection<indexType>::SwapCellsLR() { void CellConnection<indexType>::swapCellsLR() { indexType cellLeftIndex = GetCellRightIndex(); indexType cellLeftIndex = getCellRightIndex(); SetCellRightIndex(GetCellLeftIndex()); setCellRightIndex(getCellLeftIndex()); SetCellLeftIndex(cellLeftIndex); setCellLeftIndex(cellLeftIndex); } } Loading
Unstructured_mesh/computationaly_significant_element.h +14 −14 Original line number Original line Diff line number Diff line Loading @@ -6,32 +6,32 @@ template <unsigned int MeshDim, typename Real> class ComputationallySignificantElement class ComputationallySignificantElement { { protected: protected: Vertex<MeshDim, Real> Center; Vertex<MeshDim, Real> center; int Flag; int flag; public: public: ComputationallySignificantElement() { ComputationallySignificantElement() { Center = {}; center = {}; Flag = int(); flag = int(); } } Vertex<MeshDim, Real>& GetCenter(){ Vertex<MeshDim, Real>& getCenter(){ return Center; return center; } } const Vertex<MeshDim, Real>& GetCenter() const { const Vertex<MeshDim, Real>& getCenter() const { return Center; return center; } } void SetCenter(const Vertex<MeshDim, Real>& v) { void setCenter(const Vertex<MeshDim, Real>& v) { Center = v; center = v; } } int& GetFlag() { int& getFlag() { return Flag; return flag; } } const int& GetFlag() const { const int& getFlag() const { return Flag; return flag; } } }; }; Loading
Unstructured_mesh/main.cpp +143 −143 File changed.Preview size limit exceeded, changes collapsed. Show changes
Unstructured_mesh/mesh_element.h +16 −16 Original line number Original line Diff line number Diff line Loading @@ -61,12 +61,12 @@ class SubelementContainer : public std::array<Subelement<IndexType>, Reserve>{ unsigned char numberOfElements = 0; unsigned char numberOfElements = 0; public: public: unsigned char GetNumberOfSubElements(){ unsigned char getNumberOfSubElements(){ return numberOfElements; return numberOfElements; } } void AddSubelement(IndexType index, bool isLeft) { void addSubelement(IndexType index, bool isLeft) { if (numberOfElements < Reserve){ if (numberOfElements < Reserve){ this->at(numberOfElements).index = index; this->at(numberOfElements).index = index; this->at(numberOfElements).isLeft = isLeft; this->at(numberOfElements).isLeft = isLeft; Loading @@ -79,7 +79,7 @@ public: } } void RemoveSubelement(unsigned char atIndex){ void removeSubelement(unsigned char atIndex){ if (atIndex < numberOfElements){ if (atIndex < numberOfElements){ for(unsigned char i = atIndex; i < numberOfElements - 1; i++){ for(unsigned char i = atIndex; i < numberOfElements - 1; i++){ this->at(i) = this->at(i+1); this->at(i) = this->at(i+1); Loading @@ -94,11 +94,11 @@ public: } } typename std::array<Subelement<IndexType>, Reserve>::iterator end(){ typename std::array<Subelement<IndexType>, Reserve>::iterator end(){ return this->begin() + GetNumberOfSubElements(); return this->begin() + getNumberOfSubElements(); } } typename std::array<Subelement<IndexType>, Reserve>::const_iterator cend(){ typename std::array<Subelement<IndexType>, Reserve>::const_iterator cend(){ return this->cbegin() + GetNumberOfSubElements(); return this->cbegin() + getNumberOfSubElements(); } } }; }; Loading @@ -118,11 +118,11 @@ class MeshElement : public MeshElementBase<IndexType>, SubelementContainer<IndexType, Reserve> subelements; SubelementContainer<IndexType, Reserve> subelements; public: public: SubelementContainer<IndexType, Reserve>& GetSubelements(){ SubelementContainer<IndexType, Reserve>& getSubelements(){ return subelements; return subelements; } } const SubelementContainer<IndexType, Reserve>& GetSubelements() const { const SubelementContainer<IndexType, Reserve>& getSubelements() const { return subelements; return subelements; } } Loading Loading @@ -221,11 +221,11 @@ public: } } IndexType GetBoundaryElementIndex(){ IndexType getBoundaryElementIndex(){ return boundaryElementIndex; return boundaryElementIndex; } } void SetBoundaryElementIndex(IndexType index){ void setBoundaryElementIndex(IndexType index){ boundaryElementIndex = index; boundaryElementIndex = index; } } Loading Loading @@ -346,7 +346,7 @@ public: void SetupBoundaryCellsCenters() { void SetupBoundaryCellsCenters() { for(Cell& cell : BoundaryCells){ for(Cell& cell : BoundaryCells){ cell.SetCenter(GetFaces().at(cell.GetBoundaryElementIndex()).GetCenter()); cell.SetCenter(GetFaces().at(cell.getBoundaryElementIndex()).GetCenter()); } } } } Loading @@ -363,8 +363,8 @@ public: actual = firstBElem; actual = firstBElem; this->parentMesh = parentMesh; this->parentMesh = parentMesh; } } CellSubelementIterator& operator++ () {actual = parentMesh->GetFaces().at(actual).GetNextBElem(cellIndex) == firstBElem ? INVALID_INDEX(IndexType) : parentMesh->GetFaces().at(actual).GetNextBElem(cellIndex); return *this;} CellSubelementIterator& operator++ () {actual = parentMesh->GetFaces().at(actual).getNextBElem(cellIndex) == firstBElem ? INVALID_INDEX(IndexType) : parentMesh->GetFaces().at(actual).getNextBElem(cellIndex); return *this;} CellSubelementIterator& operator++ (int) {actual = parentMesh->GetFaces().at(actual).GetNextBElem(cellIndex) == firstBElem ? INVALID_INDEX(IndexType) : parentMesh->GetFaces().at(actual).GetNextBElem(cellIndex); return *this;} CellSubelementIterator& operator++ (int) {actual = parentMesh->GetFaces().at(actual).getNextBElem(cellIndex) == firstBElem ? INVALID_INDEX(IndexType) : parentMesh->GetFaces().at(actual).getNextBElem(cellIndex); return *this;} IndexType operator* (){return actual;} IndexType operator* (){return actual;} bool operator== (CellSubelementIterator& it) {return actual == it.actual;} bool operator== (CellSubelementIterator& it) {return actual == it.actual;} bool operator!= (CellSubelementIterator& it) {return actual != it.actual;} bool operator!= (CellSubelementIterator& it) {return actual != it.actual;} Loading @@ -380,7 +380,7 @@ public: } } CellSubelementIterator begin() { CellSubelementIterator begin() { return CellSubelementIterator(cellIndex, parentMesh->GetCells()[cellIndex].GetBoundaryElementIndex(), parentMesh); return CellSubelementIterator(cellIndex, parentMesh->GetCells()[cellIndex].getBoundaryElementIndex(), parentMesh); } } CellSubelementIterator end() { CellSubelementIterator end() { Loading Loading @@ -408,8 +408,8 @@ public: return elementIndex; return elementIndex; } } SubelementContainer<IndexType, reserve<ElementDim>()>& GetSubelements(){ SubelementContainer<IndexType, reserve<ElementDim>()>& getSubelements(){ return parentMesh->template GetElements<ElementDim>()[elementIndex].GetSubelements(); return parentMesh->template GetElements<ElementDim>()[elementIndex].getSubelements(); } } }; }; Loading @@ -433,7 +433,7 @@ public: return elementIndex; return elementIndex; } } CellSubelements GetSubelements(){ CellSubelements getSubelements(){ return CellSubelements(parentMesh, elementIndex); return CellSubelements(parentMesh, elementIndex); } } }; }; Loading