Skip to content

Commit 5271d3e

Browse files
committed
Created some fem toolbox classes
1 parent 5db56f9 commit 5271d3e

22 files changed

+1011
-723
lines changed

Common/include/fem/fem_geometry_structure.hpp

Lines changed: 2 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -32,152 +32,10 @@
3232
#include "fem_standard_element.hpp"
3333
#include "../wall_model.hpp"
3434
#include "../linear_algebra/blas_structure.hpp"
35+
#include "../toolboxes/fem/CFaceOfElement.hpp"
3536

3637
using namespace std;
3738

38-
/*!
39-
* \class CLong3T
40-
* \brief Help class used to store three longs as one entity.
41-
* \version 8.1.0 "Harrier"
42-
*/
43-
struct CLong3T {
44-
long long0 = 0; /*!< \brief First long to store in this class. */
45-
long long1 = 0; /*!< \brief Second long to store in this class. */
46-
long long2 = 0; /*!< \brief Third long to store in this class. */
47-
48-
CLong3T() = default;
49-
50-
CLong3T(const long a, const long b, const long c) {
51-
long0 = a;
52-
long1 = b;
53-
long2 = c;
54-
}
55-
56-
bool operator<(const CLong3T& other) const;
57-
};
58-
59-
/*!
60-
* \class CReorderElements
61-
* \brief Class, used to reorder the owned elements after the partitioning.
62-
* \author E. van der Weide
63-
* \version 8.1.0 "Harrier"
64-
*/
65-
class CReorderElements {
66-
private:
67-
unsigned long globalElemID; /*!< \brief Global element ID of the element. */
68-
unsigned short timeLevel; /*!< \brief Time level of the element. Only relevant
69-
for time accurate local time stepping. */
70-
bool commSolution; /*!< \brief Whether or not the solution must be
71-
communicated to other ranks. */
72-
unsigned short elemType; /*!< \brief Short hand for the element type, Which
73-
stored info of the VTK_Type, polynomial
74-
degree of the solution and whether or
75-
not the Jacobian is constant. */
76-
public:
77-
/*!
78-
* \brief Constructor of the class, set the member variables to the arguments.
79-
*/
80-
CReorderElements(const unsigned long val_GlobalElemID, const unsigned short val_TimeLevel,
81-
const bool val_CommSolution, const unsigned short val_VTK_Type, const unsigned short val_nPolySol,
82-
const bool val_JacConstant);
83-
84-
/*!
85-
* \brief Default constructor of the class. Disabled.
86-
*/
87-
CReorderElements(void) = delete;
88-
89-
/*!
90-
* \brief Less than operator of the class. Needed for the sorting.
91-
*/
92-
bool operator<(const CReorderElements& other) const;
93-
94-
/*!
95-
* \brief Function to make available the variable commSolution.
96-
* \return Whether or not the solution of the element must be communicated.
97-
*/
98-
inline bool GetCommSolution(void) const { return commSolution; }
99-
100-
/*!
101-
* \brief Function to make available the element type of the element.
102-
* \return The value of elemType, which stores the VTK type, polynomial degree
103-
and whether or not the Jacobian is constant.
104-
*/
105-
inline unsigned short GetElemType(void) const { return elemType; }
106-
107-
/*!
108-
* \brief Function to make available the global element ID.
109-
* \return The global element ID of the element.
110-
*/
111-
inline unsigned long GetGlobalElemID(void) const { return globalElemID; }
112-
113-
/*!
114-
* \brief Function to make available the time level.
115-
* \return The time level of the element.
116-
*/
117-
inline unsigned short GetTimeLevel(void) const { return timeLevel; }
118-
119-
/*!
120-
* \brief Function, which sets the value of commSolution.
121-
* \param[in] val_CommSolution - value to which commSolution must be set.
122-
*/
123-
inline void SetCommSolution(const bool val_CommSolution) { commSolution = val_CommSolution; }
124-
};
125-
126-
/*!
127-
* \class CSortFaces
128-
* \brief Functor, used for a different sorting of the faces than the < operator
129-
* of CFaceOfElement.
130-
* \author E. van der Weide
131-
* \version 8.1.0 "Harrier"
132-
*/
133-
class CVolumeElementFEM; // Forward declaration to avoid problems.
134-
class CSortFaces {
135-
private:
136-
unsigned long nVolElemOwned; /*!< \brief Number of locally owned volume elements. */
137-
unsigned long nVolElemTot; /*!< \brief Total number of local volume elements . */
138-
139-
const CVolumeElementFEM* volElem; /*!< \brief The locally stored volume elements. */
140-
141-
public:
142-
/*!
143-
* \brief Constructor of the class. Set the values of the member variables.
144-
*/
145-
CSortFaces(unsigned long val_nVolElemOwned, unsigned long val_nVolElemTot, const CVolumeElementFEM* val_volElem) {
146-
nVolElemOwned = val_nVolElemOwned;
147-
nVolElemTot = val_nVolElemTot;
148-
volElem = val_volElem;
149-
}
150-
151-
/*!
152-
* \brief Default constructor of the class. Disabled.
153-
*/
154-
CSortFaces(void) = delete;
155-
156-
/*!
157-
* \brief Operator used for the comparison.
158-
* \param[in] f0 - First face in the comparison.
159-
* \param[in] f1 - Second face in the comparison.
160-
*/
161-
bool operator()(const CFaceOfElement& f0, const CFaceOfElement& f1);
162-
};
163-
164-
/*!
165-
* \class CSortBoundaryFaces
166-
* \brief Functor, used for a different sorting of the faces than the < operator
167-
* of CSurfaceElementFEM.
168-
* \author E. van der Weide
169-
* \version 8.1.0 "Harrier"
170-
*/
171-
struct CSurfaceElementFEM; // Forward declaration to avoid problems.
172-
struct CSortBoundaryFaces {
173-
/*!
174-
* \brief Operator used for the comparison.
175-
* \param[in] f0 - First boundary face in the comparison.
176-
* \param[in] f1 - Second boundary face in the comparison.
177-
*/
178-
bool operator()(const CSurfaceElementFEM& f0, const CSurfaceElementFEM& f1);
179-
};
180-
18139
/*!
18240
* \class CVolumeElementFEM
18341
* \brief Class to store a volume element for the FEM solver.
@@ -271,7 +129,7 @@ class CVolumeElementFEM {
271129

272130
/*!
273131
* \class CPointFEM
274-
* \brief Class to a point for the FEM solver.
132+
* \brief Class to store a point for the FEM solver.
275133
* \author E. van der Weide
276134
* \version 8.1.0 "Harrier"
277135
*/

Common/include/geometry/CGeometry.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ extern "C" {
6060
#include "dual_grid/CTurboVertex.hpp"
6161

6262
#include "../CConfig.hpp"
63-
#include "../fem/geometry_structure_fem_part.hpp"
6463
#include "../toolboxes/graph_toolbox.hpp"
6564
#include "../adt/CADTElemClass.hpp"
6665

Common/include/geometry/CPhysicalGeometry.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
#include "CGeometry.hpp"
3131
#include "meshreader/CMeshReaderBase.hpp"
3232
#include "../containers/C2DContainer.hpp"
33+
#include "../toolboxes/classes_multiple_integers.hpp"
34+
#include "../toolboxes/fem/CFaceOfElement.hpp"
3335

3436
/*!
3537
* \class CPhysicalGeometry

Common/include/geometry/meshreader/CMeshReaderBase.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include <string.h>
3333

3434
#include "../primal_grid/CPrimalGridFEM.hpp"
35-
#include "../../fem/geometry_structure_fem_part.hpp"
35+
#include "../../toolboxes/fem/CFaceOfElement.hpp"
3636
#include "../../parallelization/mpi_structure.hpp"
3737
#include "../../CConfig.hpp"
3838

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
/*!
2+
* \file classes_multiple_integers.hpp
3+
* \brief Header file for the classes that consists of multiple integer types.
4+
* \author E. van der Weide
5+
* \version 8.1.0 "Harrier"
6+
*
7+
* SU2 Project Website: https://su2code.github.io
8+
*
9+
* The SU2 Project is maintained by the SU2 Foundation
10+
* (http://su2foundation.org)
11+
*
12+
* Copyright 2012-2024, SU2 Contributors (cf. AUTHORS.md)
13+
*
14+
* SU2 is free software; you can redistribute it and/or
15+
* modify it under the terms of the GNU Lesser General Public
16+
* License as published by the Free Software Foundation; either
17+
* version 2.1 of the License, or (at your option) any later version.
18+
*
19+
* SU2 is distributed in the hope that it will be useful,
20+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22+
* Lesser General Public License for more details.
23+
*
24+
* You should have received a copy of the GNU Lesser General Public
25+
* License along with SU2. If not, see <http://www.gnu.org/licenses/>.
26+
*/
27+
28+
#pragma once
29+
30+
#include <iostream>
31+
32+
/*!
33+
* \struct CUnsignedLong2T
34+
* \brief Helper struct used to store two integral types as one entity.
35+
*/
36+
struct CUnsignedLong2T {
37+
unsigned long long0; /*!< \brief First integer to store in this class. */
38+
unsigned long long1; /*!< \brief Second integer to store in this class. */
39+
40+
CUnsignedLong2T(unsigned long a = 0, unsigned long b = 0) : long0(a), long1(b) {}
41+
42+
inline bool operator<(const CUnsignedLong2T& other) const {
43+
if (long0 != other.long0) return (long0 < other.long0);
44+
return (long1 < other.long1);
45+
}
46+
47+
inline bool operator==(const CUnsignedLong2T& other) const {
48+
return (long0 == other.long0) && (long1 == other.long1);
49+
}
50+
};
51+
52+
/*!
53+
* \struct CUnsignedShort2T
54+
* \brief Help struct used to store two integral types as one entity.
55+
*/
56+
struct CUnsignedShort2T {
57+
unsigned short short0; /*!< \brief First integer to store in this class. */
58+
unsigned short short1; /*!< \brief Second integer to store in this class. */
59+
60+
CUnsignedShort2T(unsigned short a = 0, unsigned short b = 0) : short0(a), short1(b) {}
61+
62+
inline bool operator<(const CUnsignedShort2T& other) const {
63+
if (short0 != other.short0) return (short0 < other.short0);
64+
return (short1 < other.short1);
65+
}
66+
67+
inline bool operator==(const CUnsignedShort2T& other) const {
68+
return (short0 == other.short0) && (short1 == other.short1);
69+
}
70+
};
71+
72+
/*!
73+
* \class CLong3T
74+
* \brief Help class used to store three longs as one entity.
75+
* \version 8.1.0 "Harrier"
76+
*/
77+
struct CLong3T {
78+
long long0 = 0; /*!< \brief First long to store in this class. */
79+
long long1 = 0; /*!< \brief Second long to store in this class. */
80+
long long2 = 0; /*!< \brief Third long to store in this class. */
81+
82+
CLong3T() = default;
83+
84+
CLong3T(const long a, const long b, const long c) {
85+
long0 = a;
86+
long1 = b;
87+
long2 = c;
88+
}
89+
90+
bool operator<(const CLong3T& other) const {
91+
if (long0 != other.long0) return (long0 < other.long0);
92+
if (long1 != other.long1) return (long1 < other.long1);
93+
if (long2 != other.long2) return (long2 < other.long2);
94+
95+
return false;
96+
}
97+
};

0 commit comments

Comments
 (0)