From a46e1929ee2c8d446e8f2cac181168e4295fa108 Mon Sep 17 00:00:00 2001 From: Tomas Jakubec <jakubto1@fjfi.cvut.cz> Date: Sun, 29 Sep 2019 16:23:22 +0200 Subject: [PATCH] lovered some first letter in function names --- Unstructured_mesh/cellboundaryconnection.h | 88 +++--- Unstructured_mesh/cellconnection.h | 72 ++--- .../computationaly_significant_element.h | 28 +- Unstructured_mesh/main.cpp | 286 +++++++++--------- Unstructured_mesh/mesh_element.h | 32 +- Unstructured_mesh/mesh_functions.h | 118 ++++---- Unstructured_mesh/unstructuredmesh.h | 4 +- Unstructured_mesh/vector.h | 12 +- Unstructured_mesh/vertex.h | 41 +-- 9 files changed, 341 insertions(+), 340 deletions(-) diff --git a/Unstructured_mesh/cellboundaryconnection.h b/Unstructured_mesh/cellboundaryconnection.h index f3cdeca..355e619 100644 --- a/Unstructured_mesh/cellboundaryconnection.h +++ b/Unstructured_mesh/cellboundaryconnection.h @@ -6,17 +6,17 @@ template<typename indexType> class CellBoundaryConnection : public CellConnection<indexType> { /** - * @brief NextBElemWRTCL + * @brief nextBElemWRTCL * * 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 */ - indexType NextBElemWRTCR; + indexType nextBElemWRTCR; public: CellBoundaryConnection(indexType cellLeft = INVALID_INDEX(indexType), indexType cellRight = INVALID_INDEX(indexType), @@ -25,20 +25,20 @@ public: /* ** 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 - indexType GetOtherCellIndex(indexType cellIndex) const; + indexType getOtherCellIndex(indexType cellIndex) const; }; @@ -50,22 +50,22 @@ public: template<typename indexType> CellBoundaryConnection<indexType>::CellBoundaryConnection(indexType cellLeft, indexType cellRight, indexType nextLeft, indexType nextRight) : CellConnection<indexType> (cellLeft, cellRight) { - NextBElemWRTCL = nextLeft; - NextBElemWRTCR = nextRight; + nextBElemWRTCL = nextLeft; + nextBElemWRTCR = nextRight; } template<typename indexType> -void CellBoundaryConnection<indexType>::SetNextBElemWRTCR(indexType nextIndex){ - NextBElemWRTCR = nextIndex; +void CellBoundaryConnection<indexType>::setNextBElemWRTCR(indexType nextIndex){ + nextBElemWRTCR = nextIndex; } template<typename indexType> -void CellBoundaryConnection<indexType>::SetNextBElemWRTCL(indexType nextIndex){ - NextBElemWRTCL = nextIndex; +void CellBoundaryConnection<indexType>::setNextBElemWRTCL(indexType nextIndex){ + nextBElemWRTCL = nextIndex; } 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 if (cellIndex == INVALID_INDEX(indexType)){ @@ -73,16 +73,16 @@ bool CellBoundaryConnection<indexType>::SetNextBElem(indexType nextBElemIndex, i } // first test wether cell index eaqules left or right // then is posible to set up invalid indexes - if (CellConnection<indexType>::GetCellLeftIndex() == cellIndex) { + if (CellConnection<indexType>::getCellLeftIndex() == cellIndex) { - SetNextBElemWRTCL(nextBElemIndex); + setNextBElemWRTCL(nextBElemIndex); return true; } - if (CellConnection<indexType>::GetCellRightIndex() == cellIndex){ + if (CellConnection<indexType>::getCellRightIndex() == cellIndex){ - SetNextBElemWRTCR(nextBElemIndex); + setNextBElemWRTCR(nextBElemIndex); return true; } @@ -90,17 +90,17 @@ bool CellBoundaryConnection<indexType>::SetNextBElem(indexType nextBElemIndex, i // Attribute CellRightIndex is invalid then // 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 // then nextEdgeWRTCL is set as nextEdgeIndex, ret true - if (cellIndex == CellConnection<indexType>::GetCellLeftIndex()) { + if (cellIndex == CellConnection<indexType>::getCellLeftIndex()) { - SetNextBElemWRTCL(nextBElemIndex); + setNextBElemWRTCL(nextBElemIndex); return true; @@ -109,15 +109,15 @@ bool CellBoundaryConnection<indexType>::SetNextBElem(indexType nextBElemIndex, i // Attribute CellRightIndex is invalid // but CellLeftIndex is already filled // then set CellLeftIndex as cellIndex - if(CellConnection<indexType>::GetCellRightIndex() == INVALID_INDEX(indexType)){ - CellConnection<indexType>::SetCellRightIndex(cellIndex); + if(CellConnection<indexType>::getCellRightIndex() == INVALID_INDEX(indexType)){ + CellConnection<indexType>::setCellRightIndex(cellIndex); } // Parameter cellIndex is equal to CellLeftIndex then // set NextEdgeWRTCR as nextEdgeIndex, ret true - if (cellIndex == CellConnection<indexType>::GetCellRightIndex()){ + if (cellIndex == CellConnection<indexType>::getCellRightIndex()){ - SetNextBElemWRTCR(nextBElemIndex); + setNextBElemWRTCR(nextBElemIndex); return true; @@ -137,17 +137,17 @@ bool CellBoundaryConnection<indexType>::SetNextBElem(indexType nextBElemIndex, i } template<typename indexType> -indexType CellBoundaryConnection<indexType>::GetNextBElemWRTCL() const { - return NextBElemWRTCL; +indexType CellBoundaryConnection<indexType>::getNextBElemWRTCL() const { + return nextBElemWRTCL; } template<typename indexType> -indexType CellBoundaryConnection<indexType>::GetNextBElemWRTCR() const { - return NextBElemWRTCR; +indexType CellBoundaryConnection<indexType>::getNextBElemWRTCR() const { + return nextBElemWRTCR; } 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 (cellIndex == INVALID_INDEX(indexType)) { return INVALID_INDEX(indexType); @@ -155,12 +155,12 @@ indexType CellBoundaryConnection<indexType>::GetNextBElem(indexType cellIndex) c // If the cell is equal the Cell1 then return the NextBElemWRTCR - if(cellIndex == CellConnection<indexType>::GetCellRightIndex()){ - return GetNextBElemWRTCR(); + if(cellIndex == CellConnection<indexType>::getCellRightIndex()){ + return getNextBElemWRTCR(); // If the cell is equal the Cell2 then return the NextBElemWRTCL - } else if (cellIndex == CellConnection<indexType>::GetCellLeftIndex()){ - return GetNextBElemWRTCL(); + } else if (cellIndex == CellConnection<indexType>::getCellLeftIndex()){ + return getNextBElemWRTCL(); // If the cell is not equal left cell neither cell right then return invalid index } else { @@ -169,11 +169,11 @@ indexType CellBoundaryConnection<indexType>::GetNextBElem(indexType cellIndex) c } template<typename indexType> -indexType CellBoundaryConnection<indexType>::GetOtherCellIndex(indexType cellIndex) const{ - if (cellIndex == CellConnection<indexType>::GetCellLeftIndex()) { - return CellConnection<indexType>::GetCellRightIndex(); - } else if (cellIndex == CellConnection<indexType>::GetCellRightIndex()){ - return CellConnection<indexType>::GetCellLeftIndex(); +indexType CellBoundaryConnection<indexType>::getOtherCellIndex(indexType cellIndex) const{ + if (cellIndex == CellConnection<indexType>::getCellLeftIndex()) { + return CellConnection<indexType>::getCellRightIndex(); + } else if (cellIndex == CellConnection<indexType>::getCellRightIndex()){ + return CellConnection<indexType>::getCellLeftIndex(); } return INVALID_INDEX(indexType); } diff --git a/Unstructured_mesh/cellconnection.h b/Unstructured_mesh/cellconnection.h index d5eca1d..3e05af4 100644 --- a/Unstructured_mesh/cellconnection.h +++ b/Unstructured_mesh/cellconnection.h @@ -10,7 +10,7 @@ class CellConnection { // Indexes to two cells which neighbours // with this edge - indexType CellRightIndex, CellLeftIndex; + indexType cellRightIndex, cellLeftIndex; public: /** * @brief CellConnection @@ -21,35 +21,35 @@ indexType cellRight = INVALID_INDEX(indexType)); /** - * @brief SetCellRightIndex + * @brief setCellRightIndex * @param cellIndex */ - void SetCellRightIndex(indexType cellIndex); + void setCellRightIndex(indexType cellIndex); /** * @brief SetCellLeftIndex * @param cellIndex */ - void SetCellLeftIndex(indexType cellIndex); + void setCellLeftIndex(indexType cellIndex); /** * @brief SetCellIndex * @param cellIndex * @return */ - bool SetCellIndex(indexType cellIndex); + bool setCellIndex(indexType cellIndex); /** * @brief GetCellRightIndex * @return */ - indexType GetCellRightIndex() const; + indexType getCellRightIndex() const; /** * @brief GetCellLeftIndex * @return */ - indexType GetCellLeftIndex() const; + indexType getCellLeftIndex() const; // Returns the other Cell than sent by parameter /** @@ -57,14 +57,14 @@ * @param cellIndex * @return */ - indexType GetOtherCellIndex(indexType cellIndex) const; + indexType getOtherCellIndex(indexType cellIndex) const; /** * @brief CellsOK * @return true if both cell indexes are set */ - bool CellsOK() const; + bool cellsOK() const; /** @@ -72,7 +72,7 @@ * * swaps the left and right cell indexes */ - void SwapCellsLR(); + void swapCellsLR(); }; @@ -85,22 +85,22 @@ template<typename indexType> CellConnection<indexType>::CellConnection(indexType cellLeft, indexType cellRight){ - CellRightIndex = cellRight; - CellLeftIndex = cellLeft; + cellRightIndex = cellRight; + cellLeftIndex = cellLeft; } template<typename indexType> -void CellConnection<indexType>::SetCellRightIndex(indexType cellIndex){ - CellRightIndex = cellIndex; +void CellConnection<indexType>::setCellRightIndex(indexType cellIndex){ + cellRightIndex = cellIndex; } template<typename indexType> -void CellConnection<indexType>::SetCellLeftIndex(indexType cellIndex){ - CellLeftIndex = cellIndex; +void CellConnection<indexType>::setCellLeftIndex(indexType cellIndex){ + cellLeftIndex = cellIndex; } 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 (cellIndex == INVALID_INDEX(indexType)){ return false; @@ -108,17 +108,17 @@ bool CellConnection<indexType>::SetCellIndex(indexType cellIndex){ // If the CellLeftIndex is lower than 0 // then set CellLeftIndex as cellIndex, ret true - if (GetCellLeftIndex() == INVALID_INDEX(indexType)) { + if (getCellLeftIndex() == INVALID_INDEX(indexType)) { - SetCellLeftIndex(cellIndex); + setCellLeftIndex(cellIndex); return true; // If the CellRightIndex is valid // and CellLeftIndex is not // then set CellRightIndex as cellIndex - } else if (GetCellRightIndex() == INVALID_INDEX(indexType)) { + } else if (getCellRightIndex() == INVALID_INDEX(indexType)) { - SetCellRightIndex(cellIndex); + setCellRightIndex(cellIndex); return true; // If both CellLeftIndex and CellRightIndex are >= 0 @@ -133,37 +133,37 @@ bool CellConnection<indexType>::SetCellIndex(indexType cellIndex){ } template<typename indexType> -indexType CellConnection<indexType>::GetCellRightIndex() const { - return CellRightIndex; +indexType CellConnection<indexType>::getCellRightIndex() const { + return cellRightIndex; } template<typename indexType> -indexType CellConnection<indexType>::GetCellLeftIndex() const { - return CellLeftIndex; +indexType CellConnection<indexType>::getCellLeftIndex() const { + return cellLeftIndex; } template<typename indexType> -indexType CellConnection<indexType>::GetOtherCellIndex(indexType cellIndex) const{ - if (cellIndex == GetCellLeftIndex()) { - return GetCellRightIndex(); - } else if (cellIndex == GetCellRightIndex()){ - return GetCellLeftIndex(); +indexType CellConnection<indexType>::getOtherCellIndex(indexType cellIndex) const{ + if (cellIndex == getCellLeftIndex()) { + return getCellRightIndex(); + } else if (cellIndex == getCellRightIndex()){ + return getCellLeftIndex(); } return INVALID_INDEX(indexType); } template<typename indexType> -bool CellConnection<indexType>::CellsOK() const { - return GetCellRightIndex() != INVALID_INDEX(indexType) && GetCellLeftIndex() != INVALID_INDEX(indexType); +bool CellConnection<indexType>::cellsOK() const { + return getCellRightIndex() != INVALID_INDEX(indexType) && getCellLeftIndex() != INVALID_INDEX(indexType); } template<typename indexType> -void CellConnection<indexType>::SwapCellsLR() { +void CellConnection<indexType>::swapCellsLR() { - indexType cellLeftIndex = GetCellRightIndex(); - SetCellRightIndex(GetCellLeftIndex()); - SetCellLeftIndex(cellLeftIndex); + indexType cellLeftIndex = getCellRightIndex(); + setCellRightIndex(getCellLeftIndex()); + setCellLeftIndex(cellLeftIndex); } diff --git a/Unstructured_mesh/computationaly_significant_element.h b/Unstructured_mesh/computationaly_significant_element.h index 678e9fa..5471536 100644 --- a/Unstructured_mesh/computationaly_significant_element.h +++ b/Unstructured_mesh/computationaly_significant_element.h @@ -6,32 +6,32 @@ template <unsigned int MeshDim, typename Real> class ComputationallySignificantElement { protected: - Vertex<MeshDim, Real> Center; - int Flag; + Vertex<MeshDim, Real> center; + int flag; public: ComputationallySignificantElement() { - Center = {}; - Flag = int(); + center = {}; + flag = int(); } - Vertex<MeshDim, Real>& GetCenter(){ - return Center; + Vertex<MeshDim, Real>& getCenter(){ + return center; } - const Vertex<MeshDim, Real>& GetCenter() const { - return Center; + const Vertex<MeshDim, Real>& getCenter() const { + return center; } - void SetCenter(const Vertex<MeshDim, Real>& v) { - Center = v; + void setCenter(const Vertex<MeshDim, Real>& v) { + center = v; } - int& GetFlag() { - return Flag; + int& getFlag() { + return flag; } - const int& GetFlag() const { - return Flag; + const int& getFlag() const { + return flag; } }; diff --git a/Unstructured_mesh/main.cpp b/Unstructured_mesh/main.cpp index e0bd621..cd48d54 100644 --- a/Unstructured_mesh/main.cpp +++ b/Unstructured_mesh/main.cpp @@ -32,46 +32,46 @@ void cube(UnstructuredMesh<3, size_t, double, 6>& mesh3){ mesh3.GetEdges().push_back({11,4,6}); DBGCHECK; mesh3.GetFaces().push_back(0); - mesh3.GetFaces().at(0).GetSubelements().AddSubelement(0,true); - mesh3.GetFaces().at(0).GetSubelements().AddSubelement(1,true); - mesh3.GetFaces().at(0).GetSubelements().AddSubelement(2,true); - mesh3.GetFaces().at(0).GetSubelements().AddSubelement(3,true); + mesh3.GetFaces().at(0).getSubelements().addSubelement(0,true); + mesh3.GetFaces().at(0).getSubelements().addSubelement(1,true); + mesh3.GetFaces().at(0).getSubelements().addSubelement(2,true); + mesh3.GetFaces().at(0).getSubelements().addSubelement(3,true); mesh3.GetFaces().push_back(1); - mesh3.GetFaces().at(1).GetSubelements().AddSubelement(0,true); - mesh3.GetFaces().at(1).GetSubelements().AddSubelement(5,true); - mesh3.GetFaces().at(1).GetSubelements().AddSubelement(8,true); - mesh3.GetFaces().at(1).GetSubelements().AddSubelement(4,true); + mesh3.GetFaces().at(1).getSubelements().addSubelement(0,true); + mesh3.GetFaces().at(1).getSubelements().addSubelement(5,true); + mesh3.GetFaces().at(1).getSubelements().addSubelement(8,true); + mesh3.GetFaces().at(1).getSubelements().addSubelement(4,true); mesh3.GetFaces().push_back(2); - mesh3.GetFaces().at(2).GetSubelements().AddSubelement(1,true); - mesh3.GetFaces().at(2).GetSubelements().AddSubelement(4,true); - mesh3.GetFaces().at(2).GetSubelements().AddSubelement(11,true); - mesh3.GetFaces().at(2).GetSubelements().AddSubelement(7,true); + mesh3.GetFaces().at(2).getSubelements().addSubelement(1,true); + mesh3.GetFaces().at(2).getSubelements().addSubelement(4,true); + mesh3.GetFaces().at(2).getSubelements().addSubelement(11,true); + mesh3.GetFaces().at(2).getSubelements().addSubelement(7,true); mesh3.GetFaces().push_back(3); - mesh3.GetFaces().at(3).GetSubelements().AddSubelement(3,true); - mesh3.GetFaces().at(3).GetSubelements().AddSubelement(6,true); - mesh3.GetFaces().at(3).GetSubelements().AddSubelement(10,true); - mesh3.GetFaces().at(3).GetSubelements().AddSubelement(7,true); + mesh3.GetFaces().at(3).getSubelements().addSubelement(3,true); + mesh3.GetFaces().at(3).getSubelements().addSubelement(6,true); + mesh3.GetFaces().at(3).getSubelements().addSubelement(10,true); + mesh3.GetFaces().at(3).getSubelements().addSubelement(7,true); mesh3.GetFaces().push_back(4); - mesh3.GetFaces().at(4).GetSubelements().AddSubelement(2,true); - mesh3.GetFaces().at(4).GetSubelements().AddSubelement(6,true); - mesh3.GetFaces().at(4).GetSubelements().AddSubelement(9,true); - mesh3.GetFaces().at(4).GetSubelements().AddSubelement(5,true); + mesh3.GetFaces().at(4).getSubelements().addSubelement(2,true); + mesh3.GetFaces().at(4).getSubelements().addSubelement(6,true); + mesh3.GetFaces().at(4).getSubelements().addSubelement(9,true); + mesh3.GetFaces().at(4).getSubelements().addSubelement(5,true); mesh3.GetFaces().push_back(5); - mesh3.GetFaces().at(5).GetSubelements().AddSubelement(8,true); - mesh3.GetFaces().at(5).GetSubelements().AddSubelement(9,true); - mesh3.GetFaces().at(5).GetSubelements().AddSubelement(10,true); - mesh3.GetFaces().at(5).GetSubelements().AddSubelement(11,true); + mesh3.GetFaces().at(5).getSubelements().addSubelement(8,true); + mesh3.GetFaces().at(5).getSubelements().addSubelement(9,true); + mesh3.GetFaces().at(5).getSubelements().addSubelement(10,true); + mesh3.GetFaces().at(5).getSubelements().addSubelement(11,true); DBGCHECK; - mesh3.GetFaces().at(0).SetNextBElem(1,0); - mesh3.GetFaces().at(1).SetNextBElem(2,0); - mesh3.GetFaces().at(2).SetNextBElem(3,0); - mesh3.GetFaces().at(3).SetNextBElem(4,0); - mesh3.GetFaces().at(4).SetNextBElem(5,0); - mesh3.GetFaces().at(5).SetNextBElem(0,0); + mesh3.GetFaces().at(0).setNextBElem(1,0); + mesh3.GetFaces().at(1).setNextBElem(2,0); + mesh3.GetFaces().at(2).setNextBElem(3,0); + mesh3.GetFaces().at(3).setNextBElem(4,0); + mesh3.GetFaces().at(4).setNextBElem(5,0); + mesh3.GetFaces().at(5).setNextBElem(0,0); mesh3.GetCells().push_back(0); - mesh3.GetCells().at(0).SetBoundaryElementIndex(3); + mesh3.GetCells().at(0).setBoundaryElementIndex(3); DBGCHECK; } @@ -103,63 +103,63 @@ void twoPrisms(UnstructuredMesh<3, size_t, double, 6>& mesh3){ DBGCHECK; size_t index = 0; mesh3.GetFaces().push_back(index); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(0,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(1,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(13,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(0,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(1,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(13,true); mesh3.GetFaces().push_back(++index); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(13,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(2,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(3,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(13,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(2,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(3,true); mesh3.GetFaces().push_back(++index); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(0,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(5,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(8,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(4,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(0,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(5,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(8,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(4,true); mesh3.GetFaces().push_back(++index); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(1,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(4,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(11,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(7,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(1,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(4,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(11,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(7,true); mesh3.GetFaces().push_back(++index); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(3,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(6,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(10,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(7,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(3,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(6,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(10,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(7,true); mesh3.GetFaces().push_back(++index); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(2,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(6,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(9,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(5,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(2,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(6,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(9,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(5,true); mesh3.GetFaces().push_back(++index); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(8,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(12,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(11,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(8,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(12,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(11,true); mesh3.GetFaces().push_back(++index); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(9,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(10,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(12,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(9,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(10,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(12,true); mesh3.GetFaces().push_back(++index); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(12,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(7,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(13,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(5,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(12,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(7,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(13,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(5,true); DBGCHECK; - mesh3.GetFaces().at(0).SetNextBElem(2,0); - mesh3.GetFaces().at(2).SetNextBElem(3,0); - mesh3.GetFaces().at(3).SetNextBElem(8,0); - mesh3.GetFaces().at(8).SetNextBElem(6,0); - mesh3.GetFaces().at(6).SetNextBElem(0,0); + mesh3.GetFaces().at(0).setNextBElem(2,0); + mesh3.GetFaces().at(2).setNextBElem(3,0); + mesh3.GetFaces().at(3).setNextBElem(8,0); + mesh3.GetFaces().at(8).setNextBElem(6,0); + mesh3.GetFaces().at(6).setNextBElem(0,0); mesh3.GetCells().push_back(0); - mesh3.GetCells().at(0).SetBoundaryElementIndex(0); + mesh3.GetCells().at(0).setBoundaryElementIndex(0); - mesh3.GetFaces().at(1).SetNextBElem(5,1); - mesh3.GetFaces().at(5).SetNextBElem(4,1); - mesh3.GetFaces().at(4).SetNextBElem(8,1); - mesh3.GetFaces().at(8).SetNextBElem(7,1); - mesh3.GetFaces().at(7).SetNextBElem(1,1); + mesh3.GetFaces().at(1).setNextBElem(5,1); + mesh3.GetFaces().at(5).setNextBElem(4,1); + mesh3.GetFaces().at(4).setNextBElem(8,1); + mesh3.GetFaces().at(8).setNextBElem(7,1); + mesh3.GetFaces().at(7).setNextBElem(1,1); mesh3.GetCells().push_back(1); - mesh3.GetCells().at(1).SetBoundaryElementIndex(1); + mesh3.GetCells().at(1).setBoundaryElementIndex(1); DBGCHECK; } @@ -192,63 +192,63 @@ void twoDeformedPrisms(UnstructuredMesh<3, size_t, double, 6>& mesh3){ DBGCHECK; size_t index = 0; mesh3.GetFaces().push_back(index); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(0,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(1,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(13,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(0,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(1,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(13,true); mesh3.GetFaces().push_back(++index); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(13,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(2,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(3,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(13,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(2,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(3,true); mesh3.GetFaces().push_back(++index); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(0,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(5,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(8,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(4,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(0,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(5,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(8,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(4,true); mesh3.GetFaces().push_back(++index); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(1,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(4,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(11,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(7,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(1,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(4,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(11,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(7,true); mesh3.GetFaces().push_back(++index); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(3,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(6,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(10,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(7,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(3,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(6,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(10,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(7,true); mesh3.GetFaces().push_back(++index); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(2,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(6,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(9,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(5,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(2,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(6,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(9,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(5,true); mesh3.GetFaces().push_back(++index); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(8,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(12,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(11,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(8,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(12,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(11,true); mesh3.GetFaces().push_back(++index); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(9,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(10,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(12,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(9,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(10,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(12,true); mesh3.GetFaces().push_back(++index); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(12,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(7,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(13,true); - mesh3.GetFaces().at(index).GetSubelements().AddSubelement(5,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(12,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(7,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(13,true); + mesh3.GetFaces().at(index).getSubelements().addSubelement(5,true); DBGCHECK; - mesh3.GetFaces().at(0).SetNextBElem(2,0); - mesh3.GetFaces().at(2).SetNextBElem(3,0); - mesh3.GetFaces().at(3).SetNextBElem(8,0); - mesh3.GetFaces().at(8).SetNextBElem(6,0); - mesh3.GetFaces().at(6).SetNextBElem(0,0); + mesh3.GetFaces().at(0).setNextBElem(2,0); + mesh3.GetFaces().at(2).setNextBElem(3,0); + mesh3.GetFaces().at(3).setNextBElem(8,0); + mesh3.GetFaces().at(8).setNextBElem(6,0); + mesh3.GetFaces().at(6).setNextBElem(0,0); mesh3.GetCells().push_back(0); - mesh3.GetCells().at(0).SetBoundaryElementIndex(0); + mesh3.GetCells().at(0).setBoundaryElementIndex(0); - mesh3.GetFaces().at(1).SetNextBElem(5,1); - mesh3.GetFaces().at(5).SetNextBElem(4,1); - mesh3.GetFaces().at(4).SetNextBElem(8,1); - mesh3.GetFaces().at(8).SetNextBElem(7,1); - mesh3.GetFaces().at(7).SetNextBElem(1,1); + mesh3.GetFaces().at(1).setNextBElem(5,1); + mesh3.GetFaces().at(5).setNextBElem(4,1); + mesh3.GetFaces().at(4).setNextBElem(8,1); + mesh3.GetFaces().at(8).setNextBElem(7,1); + mesh3.GetFaces().at(7).setNextBElem(1,1); mesh3.GetCells().push_back(1); - mesh3.GetCells().at(1).SetBoundaryElementIndex(1); + mesh3.GetCells().at(1).setBoundaryElementIndex(1); DBGCHECK; } @@ -283,19 +283,19 @@ void testMesh2D() { for(size_t i = 0; i < 5; i++) mesh.GetFaces().at(i).SetIndex(i); - mesh.GetFaces().at(0).SetNextBElem(1,0); - mesh.GetFaces().at(1).SetNextBElem(2,0); - mesh.GetFaces().at(2).SetNextBElem(0,0); + mesh.GetFaces().at(0).setNextBElem(1,0); + mesh.GetFaces().at(1).setNextBElem(2,0); + mesh.GetFaces().at(2).setNextBElem(0,0); - mesh.GetFaces().at(2).SetNextBElem(3,1); - mesh.GetFaces().at(3).SetNextBElem(4,1); - mesh.GetFaces().at(4).SetNextBElem(2,1); + mesh.GetFaces().at(2).setNextBElem(3,1); + mesh.GetFaces().at(3).setNextBElem(4,1); + mesh.GetFaces().at(4).setNextBElem(2,1); mesh.GetCells().resize(2); - mesh.GetCells().at(0).SetBoundaryElementIndex(0); + mesh.GetCells().at(0).setBoundaryElementIndex(0); mesh.GetCells().at(0).SetIndex(0); - mesh.GetCells().at(1).SetBoundaryElementIndex(2); + mesh.GetCells().at(1).setBoundaryElementIndex(2); mesh.GetCells().at(1).SetIndex(1); mesh.InitializeCenters(); @@ -307,18 +307,18 @@ void testMesh2D() { DBGMSG("cell boundary iterator test"); - for(auto i : cell.GetSubelements()){ + for(auto i : cell.getSubelements()){ DBGVAR(i) } - for(auto i : mesh.GetElement<2>(1).GetSubelements()){ + for(auto i : mesh.GetElement<2>(1).getSubelements()){ DBGVAR(i) } DBGMSG("cell vertices using iterator"); for(size_t i = 0; i < mesh.GetCells().size(); i++){ - for(auto j : mesh.GetElement<2>(i).GetSubelements()){ + for(auto j : mesh.GetElement<2>(i).getSubelements()){ auto e = mesh.GetElement<1>(j); DBGVAR(e.GetElement().GetVertexAIndex(), e.GetElement().GetVertexBIndex()) } @@ -387,25 +387,25 @@ void testMesh3D() { using sit3 = UnstructuredMesh<3, size_t, double, 6>; UnstructuredMesh<3, size_t, double, 6> mesh3; twoPrisms(mesh3); - size_t tmp_face = mesh3.GetCells().at(0).GetBoundaryElementIndex(); + size_t tmp_face = mesh3.GetCells().at(0).getBoundaryElementIndex(); do { DBGVAR(tmp_face) - for (auto& sube : mesh3.GetFaces().at(tmp_face).GetSubelements()) { + for (auto& sube : mesh3.GetFaces().at(tmp_face).getSubelements()) { DBGVAR(sube.index) if (sube.index != INVALID_INDEX(size_t) ){ DBGVAR(sube.index, mesh3.GetVertices().at(mesh3.GetEdges().at(sube.index).GetVertexAIndex()),mesh3.GetVertices().at(mesh3.GetEdges().at(sube.index).GetVertexBIndex())) } } - tmp_face = mesh3.GetFaces().at(tmp_face).GetNextBElem(0); - } while (tmp_face != mesh3.GetCells().at(0).GetBoundaryElementIndex()); + tmp_face = mesh3.GetFaces().at(tmp_face).getNextBElem(0); + } while (tmp_face != mesh3.GetCells().at(0).getBoundaryElementIndex()); // mesh3.GetElements<0>().at(0).; DBGMSG("Iterator wrapper test"); sit3::MeshElementWrap<2> elem(&mesh3, mesh3.GetFaces().at(0)); - for(auto i : elem.GetSubelements()){ + for(auto i : elem.getSubelements()){ DBGVAR(i.index) } @@ -434,13 +434,13 @@ void testMesh3D() { auto centers = ComputeCenters(mesh3); for(auto& face : mesh3.GetFaces()) { - face.SetCenter(centers.template GetDataDim<2>().at(face.GetIndex())); - DBGVAR(face.GetCenter()) + face.setCenter(centers.template GetDataDim<2>().at(face.GetIndex())); + DBGVAR(face.getCenter()) } DBGMSG("cellCenter"); for(auto& cell : mesh3.GetCells()) { - cell.SetCenter(centers.template GetDataDim<3>().at(cell.GetIndex())); - DBGVAR(cell.GetCenter()) + cell.setCenter(centers.template GetDataDim<3>().at(cell.GetIndex())); + DBGVAR(cell.getCenter()) } DBGMSG("measure computation"); @@ -517,13 +517,13 @@ void test3DMeshDeformedPrisms() { auto centers = ComputeCenters(mesh3); for(auto& face : mesh3.GetFaces()) { - face.SetCenter(centers[face]); - DBGVAR(face.GetCenter()) + face.setCenter(centers[face]); + DBGVAR(face.getCenter()) } DBGMSG("cellCenter"); for(auto& cell : mesh3.GetCells()) { - cell.SetCenter(centers[cell]); - DBGVAR(cell.GetCenter()) + cell.setCenter(centers[cell]); + DBGVAR(cell.getCenter()) } DBGMSG("measure computation"); diff --git a/Unstructured_mesh/mesh_element.h b/Unstructured_mesh/mesh_element.h index d18a6ff..b2cb42b 100644 --- a/Unstructured_mesh/mesh_element.h +++ b/Unstructured_mesh/mesh_element.h @@ -61,12 +61,12 @@ class SubelementContainer : public std::array<Subelement<IndexType>, Reserve>{ unsigned char numberOfElements = 0; public: - unsigned char GetNumberOfSubElements(){ + unsigned char getNumberOfSubElements(){ return numberOfElements; } - void AddSubelement(IndexType index, bool isLeft) { + void addSubelement(IndexType index, bool isLeft) { if (numberOfElements < Reserve){ this->at(numberOfElements).index = index; this->at(numberOfElements).isLeft = isLeft; @@ -79,7 +79,7 @@ public: } - void RemoveSubelement(unsigned char atIndex){ + void removeSubelement(unsigned char atIndex){ if (atIndex < numberOfElements){ for(unsigned char i = atIndex; i < numberOfElements - 1; i++){ this->at(i) = this->at(i+1); @@ -94,11 +94,11 @@ public: } 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(){ - return this->cbegin() + GetNumberOfSubElements(); + return this->cbegin() + getNumberOfSubElements(); } }; @@ -118,11 +118,11 @@ class MeshElement : public MeshElementBase<IndexType>, SubelementContainer<IndexType, Reserve> subelements; public: - SubelementContainer<IndexType, Reserve>& GetSubelements(){ + SubelementContainer<IndexType, Reserve>& getSubelements(){ return subelements; } - const SubelementContainer<IndexType, Reserve>& GetSubelements() const { + const SubelementContainer<IndexType, Reserve>& getSubelements() const { return subelements; } @@ -221,11 +221,11 @@ public: } - IndexType GetBoundaryElementIndex(){ + IndexType getBoundaryElementIndex(){ return boundaryElementIndex; } - void SetBoundaryElementIndex(IndexType index){ + void setBoundaryElementIndex(IndexType index){ boundaryElementIndex = index; } @@ -346,7 +346,7 @@ public: void SetupBoundaryCellsCenters() { for(Cell& cell : BoundaryCells){ - cell.SetCenter(GetFaces().at(cell.GetBoundaryElementIndex()).GetCenter()); + cell.SetCenter(GetFaces().at(cell.getBoundaryElementIndex()).GetCenter()); } } @@ -363,8 +363,8 @@ public: actual = firstBElem; 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++ (int) {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;} IndexType operator* (){return actual;} bool operator== (CellSubelementIterator& it) {return actual == it.actual;} bool operator!= (CellSubelementIterator& it) {return actual != it.actual;} @@ -380,7 +380,7 @@ public: } CellSubelementIterator begin() { - return CellSubelementIterator(cellIndex, parentMesh->GetCells()[cellIndex].GetBoundaryElementIndex(), parentMesh); + return CellSubelementIterator(cellIndex, parentMesh->GetCells()[cellIndex].getBoundaryElementIndex(), parentMesh); } CellSubelementIterator end() { @@ -408,8 +408,8 @@ public: return elementIndex; } - SubelementContainer<IndexType, reserve<ElementDim>()>& GetSubelements(){ - return parentMesh->template GetElements<ElementDim>()[elementIndex].GetSubelements(); + SubelementContainer<IndexType, reserve<ElementDim>()>& getSubelements(){ + return parentMesh->template GetElements<ElementDim>()[elementIndex].getSubelements(); } }; @@ -433,7 +433,7 @@ public: return elementIndex; } - CellSubelements GetSubelements(){ + CellSubelements getSubelements(){ return CellSubelements(parentMesh, elementIndex); } }; diff --git a/Unstructured_mesh/mesh_functions.h b/Unstructured_mesh/mesh_functions.h index da7f3a1..200d42f 100644 --- a/Unstructured_mesh/mesh_functions.h +++ b/Unstructured_mesh/mesh_functions.h @@ -42,7 +42,7 @@ struct _ComputeCenters{ auto& element = mesh.template GetElements<dim>().at(i); Real subElemCnt = 0; - for(auto& sub : element.GetSubelements()){ + for(auto& sub : element.getSubelements()){ elemCenters.at(i) += subElemCenters.at(sub.index); subElemCnt++; } @@ -68,12 +68,12 @@ struct _ComputeCenters<Dimension, Dimension>{ auto& element = mesh.template GetElements<Dimension>().at(i); Real subElemCnt = 0; - IndexType tmpFaceIndex = element.GetBoundaryElementIndex(); + IndexType tmpFaceIndex = element.getBoundaryElementIndex(); do { elemCenters.at(i) += subElemCenters.at(tmpFaceIndex); subElemCnt++; - tmpFaceIndex = mesh.GetFaces()[tmpFaceIndex].GetNextBElem(i); - } while (tmpFaceIndex != element.GetBoundaryElementIndex()); + tmpFaceIndex = mesh.GetFaces()[tmpFaceIndex].getNextBElem(i); + } while (tmpFaceIndex != element.getBoundaryElementIndex()); elemCenters.at(i) /= subElemCnt; } @@ -155,17 +155,17 @@ struct _ComputeMeasures<3, 3>{ auto& cellMeasures = measures.template GetDataDim<3>(); for (typename MeshElements<3, IndexType, Real, Reserve...>::template ElemType<3>::type& cell : mesh.GetCells()) { - IndexType tmpFace = cell.GetBoundaryElementIndex(); + IndexType tmpFace = cell.getBoundaryElementIndex(); Real measure = Real(); - Vertex<3,Real>& cellCenter = cell.GetCenter(); + Vertex<3,Real>& cellCenter = cell.getCenter(); do { // select 3 different vertices - IndexType vAIndex = mesh.GetEdges().at(mesh.GetFaces().at(tmpFace).GetSubelements()[0].index).GetVertexAIndex(); - IndexType vBIndex = mesh.GetEdges().at(mesh.GetFaces().at(tmpFace).GetSubelements()[0].index).GetVertexBIndex(); - IndexType vCIndex = mesh.GetEdges().at(mesh.GetFaces().at(tmpFace).GetSubelements()[1].index).GetVertexAIndex(); + IndexType vAIndex = mesh.GetEdges().at(mesh.GetFaces().at(tmpFace).getSubelements()[0].index).GetVertexAIndex(); + IndexType vBIndex = mesh.GetEdges().at(mesh.GetFaces().at(tmpFace).getSubelements()[0].index).GetVertexBIndex(); + IndexType vCIndex = mesh.GetEdges().at(mesh.GetFaces().at(tmpFace).getSubelements()[1].index).GetVertexAIndex(); if(vCIndex == vAIndex || vCIndex == vBIndex) { - vCIndex = mesh.GetEdges().at(mesh.GetFaces().at(tmpFace).GetSubelements()[1].index).GetVertexBIndex(); + vCIndex = mesh.GetEdges().at(mesh.GetFaces().at(tmpFace).getSubelements()[1].index).GetVertexBIndex(); } Vertex<3,Real>& a = mesh.GetVertices().at(vAIndex); @@ -176,8 +176,8 @@ struct _ComputeMeasures<3, 3>{ Vertex<3,Real> vAmcC = (a-cellCenter); Vertex<3,Real> vBmA = (b-a); Vertex<3,Real> vCmA = (c-a); - Real inv_sqrBmA = 1.0 / vBmA.SumOfSquares(); - Real inv_sqrCmA = 1.0 / vCmA.SumOfSquares(); + Real inv_sqrBmA = 1.0 / vBmA.sumOfSquares(); + Real inv_sqrCmA = 1.0 / vCmA.sumOfSquares(); Real denominator = 1.0 / (1.0 - (pow(vCmA*vBmA,2) * inv_sqrBmA * inv_sqrCmA)); @@ -186,13 +186,13 @@ struct _ComputeMeasures<3, 3>{ //param_t *= inv_sqrBmA; Real param_s = -denominator * (((vAmcC*vCmA) * inv_sqrCmA) - (inv_sqrBmA*inv_sqrCmA*(vAmcC * vBmA)*(vCmA*vBmA))); - Real distance = (vAmcC + (vBmA * param_t) + (vCmA * param_s)).NormEukleid(); + Real distance = (vAmcC + (vBmA * param_t) + (vCmA * param_s)).normEukleid(); Real tmp = distance * measures.template GetDataDim<2>().at(tmpFace); measure += tmp / 3.0; - tmpFace = mesh.GetFaces().at(tmpFace).GetNextBElem(cell.GetIndex()); - } while (tmpFace != cell.GetBoundaryElementIndex()); + tmpFace = mesh.GetFaces().at(tmpFace).getNextBElem(cell.GetIndex()); + } while (tmpFace != cell.getBoundaryElementIndex()); cellMeasures.at(cell.GetIndex()) = measure; } @@ -207,9 +207,9 @@ struct _ComputeMeasures<2, 2>{ auto& surfaceMeasures = measures.template GetDataDim<2>(); for (typename MeshElements<2, IndexType, Real, Reserve...>::template ElemType<2>::type& cell : mesh.GetCells()) { - IndexType tmpEdge = cell.GetBoundaryElementIndex(); + IndexType tmpEdge = cell.getBoundaryElementIndex(); Real measure = Real(); - Vertex<2,Real>& cellCenter = cell.GetCenter(); + Vertex<2,Real>& cellCenter = cell.getCenter(); do { Vertex<2,Real>& a = mesh.GetVertices().at(mesh.GetEdges().at(tmpEdge).GetVertexAIndex()); Vertex<2,Real>& b = mesh.GetVertices().at(mesh.GetEdges().at(tmpEdge).GetVertexBIndex()); @@ -217,8 +217,8 @@ struct _ComputeMeasures<2, 2>{ tmp -= (cellCenter[1] - a[1]) * (b[0] - a[0]); measure += 0.5 * fabs(tmp); - tmpEdge = mesh.GetEdges().at(tmpEdge).GetNextBElem(cell.GetIndex()); - } while (tmpEdge != cell.GetBoundaryElementIndex()); + tmpEdge = mesh.GetEdges().at(tmpEdge).getNextBElem(cell.GetIndex()); + } while (tmpEdge != cell.getBoundaryElementIndex()); surfaceMeasures.at(cell.GetIndex()) = measure; } @@ -237,17 +237,17 @@ struct _ComputeMeasures<2, 3>{ for (typename MeshElements<3, IndexType, Real, Reserve...>::template ElemType<2>::type& face : mesh.template GetElements<2>()) { Real measure = Real(); - Vertex<3,Real>& faceCenter = face.GetCenter(); - for(auto sube : face.GetSubelements()){ + Vertex<3,Real>& faceCenter = face.getCenter(); + for(auto sube : face.getSubelements()){ Vertex<3,Real>& a = mesh.GetVertices().at(mesh.GetEdges().at(sube.index).GetVertexAIndex()); Vertex<3,Real>& b = mesh.GetVertices().at(mesh.GetEdges().at(sube.index).GetVertexBIndex()); Real distance = Real(); - Real param = -1.0*(((a-faceCenter)*(b-a))/((b-a).SumOfSquares())); + Real param = -1.0*(((a-faceCenter)*(b-a))/((b-a).sumOfSquares())); - distance = (a-faceCenter+(b-a)*param).NormEukleid(); + distance = (a-faceCenter+(b-a)*param).normEukleid(); Real tmp = distance * measures.template GetDataDim<1>().at(sube.index); measure += tmp * 0.5; @@ -273,7 +273,7 @@ struct _ComputeMeasures<1, Dimension>{ for (auto& edge : mesh.GetEdges()) { edgeLengths.at(edge.GetIndex()) = (mesh.GetVertices().at(edge.GetVertexAIndex()) - - mesh.GetVertices().at(edge.GetVertexBIndex())).NormEukleid(); + mesh.GetVertices().at(edge.GetVertexBIndex())).normEukleid(); } _ComputeMeasures<2, Dimension>::compute(measures, mesh); @@ -317,7 +317,7 @@ struct _ComputeNormals<2>{ Vertex<2,Real> dif = b-a; normals[face][0] = dif[1]; normals[face][1] = -dif[0]; - normals[face] /= dif.NormEukleid(); + normals[face] /= dif.normEukleid(); } } }; @@ -330,24 +330,24 @@ struct _ComputeNormals<3>{ for (auto& face : mesh.GetFaces()) { bool vectorSign = true; - IndexType cellIndex = face.GetCellLeftIndex(); + IndexType cellIndex = face.getCellLeftIndex(); if ( cellIndex == INVALID_INDEX(IndexType) || (cellIndex & BOUNDARY_INDEX(IndexType)) == BOUNDARY_INDEX(IndexType) ) { vectorSign = false; - cellIndex = face.GetCellRightIndex(); + cellIndex = face.getCellRightIndex(); } - Vertex<3,Real>& cellCenter = mesh.GetCells().at(cellIndex).GetCenter(); + Vertex<3,Real>& cellCenter = mesh.GetCells().at(cellIndex).getCenter(); // select 3 different vertices - IndexType vAIndex = mesh.GetEdges().at(face.GetSubelements()[0].index).GetVertexAIndex(); - IndexType vBIndex = mesh.GetEdges().at(face.GetSubelements()[0].index).GetVertexBIndex(); - IndexType vCIndex = mesh.GetEdges().at(face.GetSubelements()[1].index).GetVertexAIndex(); + IndexType vAIndex = mesh.GetEdges().at(face.getSubelements()[0].index).GetVertexAIndex(); + IndexType vBIndex = mesh.GetEdges().at(face.getSubelements()[0].index).GetVertexBIndex(); + IndexType vCIndex = mesh.GetEdges().at(face.getSubelements()[1].index).GetVertexAIndex(); if(vCIndex == vAIndex || vCIndex == vBIndex) { - vCIndex = mesh.GetEdges().at(face.GetSubelements()[1].index).GetVertexBIndex(); + vCIndex = mesh.GetEdges().at(face.getSubelements()[1].index).GetVertexBIndex(); } Vertex<3,Real>& a = mesh.GetVertices().at(vAIndex); @@ -358,8 +358,8 @@ struct _ComputeNormals<3>{ Vertex<3,Real> vAmcC = (a-cellCenter); Vertex<3,Real> vBmA = (b-a); Vertex<3,Real> vCmA = (c-a); - Real inv_sqrBmA = 1.0 / vBmA.SumOfSquares(); - Real inv_sqrCmA = 1.0 / vCmA.SumOfSquares(); + Real inv_sqrBmA = 1.0 / vBmA.sumOfSquares(); + Real inv_sqrCmA = 1.0 / vCmA.sumOfSquares(); Real denominator = 1.0 / (1.0 - (pow(vCmA*vBmA,2) * inv_sqrBmA * inv_sqrCmA)); @@ -369,7 +369,7 @@ struct _ComputeNormals<3>{ Real param_s = -denominator * (((vAmcC*vCmA) * inv_sqrCmA) - (inv_sqrBmA*inv_sqrCmA*(vAmcC * vBmA)*(vCmA*vBmA))); Vertex<3, Real> faceNormal = vAmcC + (vBmA * param_t) + (vCmA * param_s); - faceNormal /= faceNormal.NormEukleid(); + faceNormal /= faceNormal.normEukleid(); if (!vectorSign) { faceNormal *= -1; @@ -404,37 +404,37 @@ MeshDataContainer<Real, Dimension-1> ComputeCellsDistance(MeshElements<Dimension if(mesh.GetBoundaryCells().empty()){ for(auto& face : mesh.GetFaces()) { - if (face.GetCellLeftIndex() != INVALID_INDEX(IndexType) && - face.GetCellRightIndex() != INVALID_INDEX(IndexType)){ + if (face.getCellLeftIndex() != INVALID_INDEX(IndexType) && + face.getCellRightIndex() != INVALID_INDEX(IndexType)){ - distances.at(face) = (mesh.GetCells().at(face.GetCellLeftIndex()).GetCenter() - - mesh.GetCells().at(face.GetCellRightIndex()).GetCenter()).NormEukleid(); + distances.at(face) = (mesh.GetCells().at(face.getCellLeftIndex()).getCenter() - + mesh.GetCells().at(face.getCellRightIndex()).getCenter()).normEukleid(); - } else if(face.GetCellLeftIndex() != INVALID_INDEX(IndexType) && - face.GetCellRightIndex() == INVALID_INDEX(IndexType)){ + } else if(face.getCellLeftIndex() != INVALID_INDEX(IndexType) && + face.getCellRightIndex() == INVALID_INDEX(IndexType)){ - distances.at(face) = (mesh.GetCells().at(face.GetCellLeftIndex()).GetCenter() - - face.GetCenter()).NormEukleid(); + distances.at(face) = (mesh.GetCells().at(face.getCellLeftIndex()).getCenter() - + face.getCenter()).normEukleid(); - } else if(face.GetCellLeftIndex() == INVALID_INDEX(IndexType) && - face.GetCellRightIndex() != INVALID_INDEX(IndexType)){ + } else if(face.getCellLeftIndex() == INVALID_INDEX(IndexType) && + face.getCellRightIndex() != INVALID_INDEX(IndexType)){ - distances.at(face) = (mesh.GetCells().at(face.GetCellRightIndex()).GetCenter() - - face.GetCenter()).NormEukleid(); + distances.at(face) = (mesh.GetCells().at(face.getCellRightIndex()).getCenter() - + face.getCenter()).normEukleid(); } } } else { for(auto& face : mesh.GetFaces()) { - auto& cellLeft = (face.GetCellLeftIndex() & BOUNDARY_INDEX(IndexType)) == BOUNDARY_INDEX(IndexType)? - mesh.GetBoundaryCells().at(face.GetCellLeftIndex()&EXTRACTING_INDEX(IndexType)): - mesh.GetCells().at(face.GetCellLeftIndex()); - auto& cellRight = (face.GetCellRightIndex() & BOUNDARY_INDEX(IndexType)) == BOUNDARY_INDEX(IndexType)? - mesh.GetBoundaryCells().at(face.GetCellRightIndex()&EXTRACTING_INDEX(IndexType)): - mesh.GetCells().at(face.GetCellRightIndex()); - - distances.at(face) = (cellLeft.GetCenter() - cellRight.GetCenter()).NormEukleid(); + auto& cellLeft = (face.getCellLeftIndex() & BOUNDARY_INDEX(IndexType)) == BOUNDARY_INDEX(IndexType)? + mesh.GetBoundaryCells().at(face.getCellLeftIndex()&EXTRACTING_INDEX(IndexType)): + mesh.GetCells().at(face.getCellLeftIndex()); + auto& cellRight = (face.getCellRightIndex() & BOUNDARY_INDEX(IndexType)) == BOUNDARY_INDEX(IndexType)? + mesh.GetBoundaryCells().at(face.getCellRightIndex()&EXTRACTING_INDEX(IndexType)): + mesh.GetCells().at(face.getCellRightIndex()); + + distances.at(face) = (cellLeft.getCenter() - cellRight.getCenter()).normEukleid(); } } @@ -460,7 +460,7 @@ struct MeshRun { auto i = mesh.template GetElements<CurrentDimension>().at(index); - for (auto sube: mesh.template GetElement<CurrentDimension>(i.GetIndex()).GetSubelements()) + for (auto sube: mesh.template GetElement<CurrentDimension>(i.GetIndex()).getSubelements()) MeshRun< CurrentDimension - 1, StartDimension, TargetDimension, MeshDimension, TargetDimension == CurrentDimension - 1, Ascend>::run(mesh, origElementIndex, sube.index, fun); @@ -477,11 +477,11 @@ struct MeshRun<MeshDimension, StartDimension, TargetDimension, MeshDimension, fa Func fun){ auto& cell = mesh.GetCells().at(index); - IndexType tmpFace = cell.GetBoundaryElementIndex(); + IndexType tmpFace = cell.getBoundaryElementIndex(); do { MeshRun<MeshDimension - 1, StartDimension, TargetDimension, MeshDimension, TargetDimension == MeshDimension - 1, Ascend>::run(mesh, origElementIndex, tmpFace, fun); - tmpFace = mesh.GetFaces().at(tmpFace).GetNextBElem(cell.GetIndex()); - } while (tmpFace != cell.GetBoundaryElementIndex()); + tmpFace = mesh.GetFaces().at(tmpFace).getNextBElem(cell.GetIndex()); + } while (tmpFace != cell.getBoundaryElementIndex()); } }; diff --git a/Unstructured_mesh/unstructuredmesh.h b/Unstructured_mesh/unstructuredmesh.h index 59f6ea5..a944da4 100644 --- a/Unstructured_mesh/unstructuredmesh.h +++ b/Unstructured_mesh/unstructuredmesh.h @@ -14,10 +14,10 @@ public: auto centers = ComputeCenters(*this); for (auto& face : this->GetFaces()){ - face.SetCenter(centers[face]); + face.setCenter(centers[face]); } for (auto& cell : this->GetCells()){ - cell.SetCenter(centers[cell]); + cell.setCenter(centers[cell]); } } diff --git a/Unstructured_mesh/vector.h b/Unstructured_mesh/vector.h index 1847db1..8626ecb 100644 --- a/Unstructured_mesh/vector.h +++ b/Unstructured_mesh/vector.h @@ -23,7 +23,7 @@ public: Vector<Dim, Real>& operator =(std::initializer_list<Real> l); - void SetCoordinate(Real coord, unsigned int pos){ + void setCoordinate(Real coord, unsigned int pos){ Coordinates[pos] = coord; } @@ -35,9 +35,9 @@ public: return Coordinates[pos]; } - Real NormEukleid(); + Real normEukleid(); - inline Real SumOfSquares() { + inline Real sumOfSquares() { return inlineScalarProduct<Dim, Real>::computation(Coordinates, Coordinates); } @@ -90,7 +90,7 @@ Vector<Dim, Real>& Vector<Dim, Real>::operator =(std::initializer_list<Real> l){ } template <typename Real> -Vector<3, Real> VectorProduct(const Vector<3, Real>& v1, const Vector<3, Real>& v2){ +Vector<3, Real> vectorProduct(const Vector<3, Real>& v1, const Vector<3, Real>& v2){ Vector<3,Real> res = {}; res[0] = v1[1]*v2[2] - v1[2]*v2[1]; res[1] = v1[2]*v2[0] - v1[0]*v2[2]; @@ -105,8 +105,8 @@ Vector<3, Real> VectorProduct(const Vector<3, Real>& v1, const Vector<3, Real>& ** Calculates the Eucleid norm of the point */ template <unsigned int Dim, typename Real> -Real Vector<Dim, Real>::NormEukleid(){ - return sqrt(SumOfSquares()); +Real Vector<Dim, Real>::normEukleid(){ + return sqrt(sumOfSquares()); } diff --git a/Unstructured_mesh/vertex.h b/Unstructured_mesh/vertex.h index 2821302..07c0682 100644 --- a/Unstructured_mesh/vertex.h +++ b/Unstructured_mesh/vertex.h @@ -9,9 +9,10 @@ template <unsigned int Dim, typename Real = double> class Vertex { /** - * @brief Coordinates + * @brief coordinates<HR> + * coordinates of the vertex in the space */ - Real Coordinates[Dim] = {}; + Real coordinates[Dim] = {}; public: Vertex(){} @@ -21,22 +22,22 @@ public: Vertex<Dim, Real>& operator =(std::initializer_list<Real> l); - void SetCoordinate(Real coord, unsigned int pos){ - Coordinates[pos] = coord; + void setCoordinate(Real coord, unsigned int pos){ + coordinates[pos] = coord; } Real& operator[](unsigned int pos){ - return Coordinates[pos]; + return coordinates[pos]; } const Real& operator[](unsigned int pos) const { - return Coordinates[pos]; + return coordinates[pos]; } - Real NormEukleid(); + Real normEukleid(); - inline Real SumOfSquares() { - return inlineScalarProduct<Dim, Real>::computation(Coordinates, Coordinates); + inline Real sumOfSquares() { + return inlineScalarProduct<Dim, Real>::computation(coordinates, coordinates); } Vertex<Dim, Real> operator-(const Vertex<Dim, Real>&) const; @@ -73,7 +74,7 @@ Vertex<Dim, Real>& Vertex<Dim, Real>::operator =(std::initializer_list<Real> l){ for(Real x : l){ if (i < Dim){ - Coordinates[i] = x; + coordinates[i] = x; }else{ break; } @@ -81,7 +82,7 @@ Vertex<Dim, Real>& Vertex<Dim, Real>::operator =(std::initializer_list<Real> l){ } if (i < Dim){ for (; i < Dim; i++) { - Coordinates[i] = Real(); + coordinates[i] = Real(); } } return *this; @@ -90,8 +91,8 @@ Vertex<Dim, Real>& Vertex<Dim, Real>::operator =(std::initializer_list<Real> l){ ** Calculates the Eucleid norm of the point */ template <unsigned int Dim, typename Real> -Real Vertex<Dim, Real>::NormEukleid(){ - return sqrt(SumOfSquares()); +Real Vertex<Dim, Real>::normEukleid(){ + return sqrt(sumOfSquares()); } @@ -104,7 +105,7 @@ Real Vertex<Dim, Real>::NormEukleid(){ template <unsigned int Dim, typename Real> Vertex<Dim, Real> Vertex<Dim, Real>::operator -(const Vertex<Dim, Real>& v) const { Vertex<Dim, Real> res; - inlineSubtraction<Dim, Real>::computation(res.Coordinates, this->Coordinates, v.Coordinates); + inlineSubtraction<Dim, Real>::computation(res.coordinates, this->coordinates, v.coordinates); return res; } @@ -112,7 +113,7 @@ Vertex<Dim, Real> Vertex<Dim, Real>::operator -(const Vertex<Dim, Real>& v) cons template <unsigned int Dim, typename Real> Vertex<Dim, Real> Vertex<Dim, Real>::operator +(const Vertex<Dim, Real>& v) const { Vertex<Dim, Real> res; - inlineAddition<Dim, Real>::computation(res.Coordinates, this->Coordinates, v.Coordinates); + inlineAddition<Dim, Real>::computation(res.coordinates, this->coordinates, v.coordinates); return res; } @@ -120,7 +121,7 @@ Vertex<Dim, Real> Vertex<Dim, Real>::operator +(const Vertex<Dim, Real>& v) cons template <unsigned int Dim, typename Real> Vertex<Dim, Real> Vertex<Dim, Real>::operator *(const Real& x) const { Vertex<Dim, Real> res; - inlineMultiplication<Dim, Real>::computation(res.Coordinates, this->Coordinates, x); + inlineMultiplication<Dim, Real>::computation(res.coordinates, this->coordinates, x); return res; } @@ -135,7 +136,7 @@ Vertex<Dim, Real> Vertex<Dim, Real>::operator /(const Real& x) const { template<unsigned int Dim, typename Real> Real Vertex<Dim, Real>::operator*(const Vertex<Dim, Real> &v) { - return inlineScalarProduct<Dim, Real>::computation(Coordinates, v.Coordinates); + return inlineScalarProduct<Dim, Real>::computation(coordinates, v.coordinates); } @@ -143,14 +144,14 @@ Real Vertex<Dim, Real>::operator*(const Vertex<Dim, Real> &v) // Adds value of coordinates of another Point template <unsigned int Dim, typename Real> Vertex<Dim, Real>& Vertex<Dim, Real>::operator +=(const Vertex<Dim, Real>& v){ - inlineAddition<Dim, Real>::computation(Coordinates, v.Coordinates); + inlineAddition<Dim, Real>::computation(coordinates, v.coordinates); return *this; } // Subtracts value of coordinates of another Point template <unsigned int Dim, typename Real> Vertex<Dim, Real>& Vertex<Dim, Real>::operator -=(const Vertex<Dim, Real>& v){ - inlineSubtraction<Dim, Real>::computation(Coordinates, v.Coordinates); + inlineSubtraction<Dim, Real>::computation(coordinates, v.coordinates); return *this; } @@ -158,7 +159,7 @@ Vertex<Dim, Real>& Vertex<Dim, Real>::operator -=(const Vertex<Dim, Real>& v){ // Adds value of coordinates of another Point template <unsigned int Dim, typename Real> Vertex<Dim, Real>& Vertex<Dim, Real>::operator *=(const Real& x){ - inlineMultiplication<Dim, Real>::computation(Coordinates, x); + inlineMultiplication<Dim, Real>::computation(coordinates, x); return *this; } -- GitLab