Skip to content

Commit 42ac1a3

Browse files
author
Max Aehle
committed
Store GlobalIndex,DomainElement in common unsigned long variable
Only one of them is used for each instance. This is currently checked, I'll remove checks later.
1 parent f44ff80 commit 42ac1a3

3 files changed

Lines changed: 16 additions & 13 deletions

File tree

Common/include/geometry/primal_grid/CPrimalGrid.hpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,15 @@
4747
class CPrimalGrid {
4848
protected:
4949
vector<unsigned long> Nodes; /*!< \brief Global node indices of the element. */
50-
unsigned long GlobalIndex; /*!< \brief The global index of an element. */
50+
/*! If this is a domain element, store the global index.
51+
* If this is a boundary element, store the index of the incident domain element. */
52+
unsigned long GlobalIndex_DomainElement;
53+
bool gi;
5154
vector<long> Neighbor_Elements; /*!< \brief Vector to store the elements surronding an element. */
5255
vector<short> PeriodIndexNeighbors; /*!< \brief Vector to store the periodic index of a neighbor.
5356
A -1 indicates no periodic transformation to the neighbor. */
5457
su2double Coord_CG[3] = {0.0}; /*!< \brief Coordinates of the center-of-gravity of the element. */
55-
unsigned long DomainElement; /*!< \brief Only for boundaries, in this variable the 3D elements which
56-
correspond with a boundary element is stored. */
58+
5759
su2double Volume; /*!< \brief Volume of the element. */
5860
su2double LenScale; /*!< \brief Length scale of the element. */
5961
unsigned short TimeLevel; /*!< \brief Time level of the element for time accurate local time stepping. */
@@ -245,25 +247,24 @@ class CPrimalGrid {
245247
* \brief Get the element global index in a parallel computation.
246248
* \return Global index of the element in a parallel computation.
247249
*/
248-
inline unsigned long GetGlobalIndex(void) const { return GlobalIndex; }
250+
inline unsigned long GetGlobalIndex() const { if(gi) SU2_MPI::Error("gi",CURRENT_FUNCTION); return GlobalIndex_DomainElement; }
249251

250252
/*!
251253
* \brief Set the global index for an element in a parallel computation.
252254
* \return Global index of an element in a parallel computation.
253255
*/
254-
inline void SetGlobalIndex(unsigned long val_globalindex) { GlobalIndex = val_globalindex; }
256+
inline void SetGlobalIndex(unsigned long val_globalindex) { gi=true; GlobalIndex_DomainElement = val_globalindex; }
255257

256258
/*!
257-
* \brief A virtual member.
258-
* \param[in] val_domainelement Index of the domain element which has a face shared by this boundary element.
259+
* \brief Set the index of the domain element of which this boundary element is a face.
260+
* \param[in] val_domainelement - Value to set.
259261
*/
260-
inline virtual void SetDomainElement(unsigned long val_domainelement) { DomainElement = val_domainelement; }
262+
inline void SetDomainElement(unsigned long val_domainelement) { gi=false; GlobalIndex_DomainElement = val_domainelement; }
261263

262264
/*!
263-
* \brief A virtual member.
264-
* \return Relate the boundary element which a face of a domain element.
265+
* \brief Get the index of the domain element of which this boundary element is a face.
265266
*/
266-
inline virtual unsigned long GetDomainElement(void) const{ return DomainElement; }
267+
inline unsigned long GetDomainElement() const{ if(!gi) SU2_MPI::Error("gi",CURRENT_FUNCTION); return GlobalIndex_DomainElement; }
267268

268269
/*!
269270
* \brief A pure virtual member.

Common/src/geometry/primal_grid/CPrimalGrid.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929

3030
CPrimalGrid::CPrimalGrid(bool FEM) : FEM(FEM) {
3131

32-
GlobalIndex = 0;
32+
GlobalIndex_DomainElement = 0;
33+
gi =true;
3334

3435
}
3536

Common/src/geometry/primal_grid/CPrimalGridBoundFEM.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ CPrimalGridBoundFEM::CPrimalGridBoundFEM(unsigned long val_elemGlobalID,
4141
nDOFsGrid = val_nDOFsGrid;
4242

4343
boundElemIDGlobal = val_elemGlobalID;
44-
DomainElement = val_domainElementID;
44+
GlobalIndex_DomainElement = val_domainElementID;
45+
gi = false;
4546

4647
/*--- Allocate the memory for the global nodes of the element to define
4748
the geometry and copy them from val_nodes. ---*/

0 commit comments

Comments
 (0)