31#include "../../containers/C2DContainer.hpp"
32#include "../../containers/container_decorators.hpp"
33#include "../../toolboxes/graph_toolbox.hpp"
35#include "../../toolboxes/ndflattener.hpp"
51 const unsigned long nDim = 0;
59 vector<vector<long> > Vertex;
94 vector<vector<unsigned long> >
123 void MinimalAllocation(
unsigned long npoint);
133 CPoint(
unsigned long npoint,
unsigned long ndim,
unsigned short imesh,
const CConfig* config);
140 CPoint(
unsigned long npoint,
unsigned long ndim);
158 inline su2double GetCoord(
unsigned long iPoint,
unsigned long iDim)
const {
return Coord(iPoint, iDim); }
178 inline void SetCoord(
unsigned long iPoint,
unsigned long iDim,
su2double coord) { Coord(iPoint, iDim) = coord; }
186 inline void AddCoord(
unsigned long iPoint,
unsigned long iDim,
su2double coord) { Coord(iPoint, iDim) += coord; }
194 for (
unsigned long iDim = 0; iDim < nDim; iDim++) Coord(iPoint, iDim) = coord[iDim];
201 void SetElems(
const vector<vector<long> >& elemsMatrix);
221 inline unsigned long GetElem(
unsigned long iPoint,
unsigned long nelem)
const {
228 inline CCompressedSparsePatternL::CInnerIter
GetElems(
unsigned long iPoint)
const {
236 void SetPoints(
const vector<vector<unsigned long> >& pointsMatrix);
264 inline unsigned long GetPoint(
unsigned long iPoint,
unsigned long npoint)
const {
271 inline CCompressedSparsePatternUL::CInnerIter
GetPoints(
unsigned long iPoint)
const {
281 inline void SetEdge(
unsigned long iPoint,
long iedge,
unsigned long nedge) {
291 inline long GetEdge(
unsigned long iPoint,
unsigned long nedge)
const {
return Edge.
getInnerIdx(iPoint, nedge); }
296 inline CCompressedSparsePatternL::CInnerIter
GetEdges(
unsigned long iPoint)
const {
306 inline void SetVertex(
unsigned long iPoint,
long iVertex,
unsigned long iMarker) {
307 if (Boundary(iPoint)) Vertex[iPoint][iMarker] = iVertex;
316 inline long GetVertex(
unsigned long iPoint,
unsigned long iMarker)
const {
317 if (Boundary(iPoint))
return Vertex[iPoint][iMarker];
327 inline void SetBoundary(
unsigned long iPoint,
unsigned short nMarker) {
328 if (!Boundary(iPoint)) Vertex[iPoint].resize(nMarker, -1);
329 Boundary(iPoint) =
true;
337 Vertex[iPoint].clear();
338 Boundary(iPoint) =
false;
346 inline void SetBoundary(
unsigned long iPoint,
bool boundary) { Boundary(iPoint) = boundary; }
353 inline bool GetBoundary(
unsigned long iPoint)
const {
return Boundary(iPoint); }
360 inline void SetPhysicalBoundary(
unsigned long iPoint,
bool boundary) { PhysicalBoundary(iPoint) = boundary; }
374 inline void SetSolidBoundary(
unsigned long iPoint,
bool boundary) { SolidBoundary(iPoint) = boundary; }
388 inline void SetViscousBoundary(
unsigned long iPoint,
bool boundary) { ViscousBoundary(iPoint) = boundary; }
402 inline void SetPeriodicBoundary(
unsigned long iPoint,
bool boundary) { PeriodicBoundary(iPoint) = boundary; }
416 inline void SetDomain(
unsigned long iPoint,
bool domain) { Domain(iPoint) = domain; }
423 inline bool GetDomain(
unsigned long iPoint)
const {
return Domain(iPoint); }
431 inline void SetColor(
unsigned long iPoint,
unsigned long color) { Color(iPoint) = color; }
438 inline unsigned long GetColor(
unsigned long iPoint)
const {
return Color(iPoint); }
445 inline void SetGlobalIndex(
unsigned long iPoint,
unsigned long globalindex) { GlobalIndex(iPoint) = globalindex; }
452 inline unsigned long GetGlobalIndex(
unsigned long iPoint)
const {
return GlobalIndex(iPoint); }
459 inline void SetnNeighbor(
unsigned long iPoint,
unsigned short nneighbor) { nNeighbor(iPoint) = nneighbor; }
466 inline unsigned short GetnNeighbor(
unsigned long iPoint)
const {
return nNeighbor(iPoint); }
478 unsigned short markerID,
unsigned long elemID) {
479 Wall_Distance(iPoint) = distance;
480 ClosestWall_Rank(iPoint) = rankID;
481 ClosestWall_Zone(iPoint) = zoneID;
482 ClosestWall_Marker(iPoint) = markerID;
483 ClosestWall_Elem(iPoint) = elemID;
643 inline void SetParent_CV(
unsigned long iPoint,
unsigned long parent_CV) {
644 Parent_CV(iPoint) = parent_CV;
645 Agglomerate(iPoint) =
true;
654 inline void SetChildren_CV(
unsigned long iPoint,
unsigned long nchildren_CV,
unsigned long children_CV) {
655 Children_CV[iPoint].resize(nchildren_CV + 1);
656 Children_CV[iPoint][nchildren_CV] = children_CV;
664 inline void SetChildren_CV(
unsigned long iPoint,
const vector<unsigned long>& children_CV) {
665 Children_CV[iPoint] = children_CV;
673 inline unsigned long GetParent_CV(
unsigned long iPoint)
const {
return Parent_CV(iPoint); }
681 inline unsigned long GetChildren_CV(
unsigned long iPoint,
unsigned short nchildren_CV)
const {
682 return Children_CV[iPoint][nchildren_CV];
691 inline const vector<unsigned long>&
GetChildren_CV(
unsigned long iPoint)
const {
return Children_CV[iPoint]; }
698 inline bool GetAgglomerate(
unsigned long iPoint)
const {
return Agglomerate(iPoint); }
713 Agglomerate_Indirect(iPoint) = agglomerate;
721 inline unsigned short GetnChildren_CV(
unsigned long iPoint)
const {
return nChildren_CV(iPoint); }
729 nChildren_CV(iPoint) = nchildren_CV;
769 for (
unsigned long iDim = 0; iDim < nDim; iDim++) Coord_n(iPoint, iDim) = coord[iDim];
778 for (
unsigned long iDim = 0; iDim < nDim; iDim++) Coord_n1(iPoint, iDim) = coord[iDim];
787 for (
unsigned long iDim = 0; iDim < nDim; iDim++) Coord_p1(iPoint, iDim) = coord[iDim];
803 for (
unsigned long iDim = 0; iDim < nDim; iDim++) Coord_Old(iPoint, iDim) = coord_old[iDim];
830 GridVel(iPoint, iDim) = gridvel;
839 for (
unsigned long iDim = 0; iDim < nDim; iDim++) GridVel(iPoint, iDim) = gridvel[iDim];
860 for (
unsigned long iDim = 0; iDim < nDim; iDim++)
879 for (
unsigned long iDim = 0; iDim < nDim; iDim++) {
882 AD::SetIndex(AD_InputIndex(iPoint, iDim), Coord(iPoint, iDim));
885 AD::SetIndex(AD_OutputIndex(iPoint, iDim), Coord(iPoint, iDim));
894 template <
typename Roughness_type>
896 for (
unsigned long iPoint = 0; iPoint < GlobalIndex.
size(); ++iPoint) {
897 auto rankID = ClosestWall_Rank[iPoint];
898 auto zoneID = ClosestWall_Zone[iPoint];
899 auto markerID = ClosestWall_Marker[iPoint];
A templated matrix/vector-like object.
Definition C2DContainer.hpp:374
size_t size() const noexcept
Definition C2DContainer.hpp:222
CInnerIter getInnerIter(Index_t iOuterIdx) const
Definition graph_toolbox.hpp:226
Index_t getInnerIdx(Index_t iOuterIdx, Index_t iNonZero) const
Definition graph_toolbox.hpp:207
Index_t getNumNonZeros() const
Definition graph_toolbox.hpp:194
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
Class to represent a matrix (without owning the data, this just wraps a pointer).
Definition container_decorators.hpp:40
Class for reading a defining the primal grid which is read from the grid file in ....
Definition CPhysicalGeometry.hpp:41
Class for point definition (dual control volumes).
Definition CPoint.hpp:47
void SetPeriodicVolume(unsigned long iPoint, su2double volume)
Set the missing component of area or volume for a control volume on a periodic marker.
Definition CPoint.hpp:587
CMatrixView< const su2double > GetGridVel_Grad(unsigned long iPoint) const
Get the value of the grid velocity gradient at the point.
Definition CPoint.hpp:852
void SetCoord_Old()
Set the value of the vector Coord_Old to Coord.
Definition CPoint.cpp:184
void SetPeriodicBoundary(unsigned long iPoint, bool boundary)
Set if a point belongs to a periodic boundary.
Definition CPoint.hpp:402
su2double * GetCoord_p1(unsigned long iPoint)
Get the coordinates of the control volume at time n+1.
Definition CPoint.hpp:751
void SetPhysicalBoundary(unsigned long iPoint, bool boundary)
Set if a point belong to the boundary.
Definition CPoint.hpp:360
const su2double & GetPeriodicVolume(unsigned long iPoint) const
Definition CPoint.hpp:580
void SetCoord(unsigned long iPoint, const su2double *coord)
Set the point coordinates.
Definition CPoint.hpp:193
su2double * GetCoord_n(unsigned long iPoint)
Get the coordinates of the control volume at time n.
Definition CPoint.hpp:737
void SetMaxLength(unsigned long iPoint, su2double max_length)
Set the max cell-center to cell-center length.
Definition CPoint.hpp:543
void SetBoundary(unsigned long iPoint, unsigned short nMarker)
Set if a point belong to the boundary.
Definition CPoint.hpp:327
void SetCoord_Old(unsigned long iPoint, const su2double *coord_old)
Set the value of the vector Coord_Old.
Definition CPoint.hpp:802
void SetViscousBoundary(unsigned long iPoint, bool boundary)
Set if a point belong to the boundary.
Definition CPoint.hpp:388
void SetnChildren_CV(unsigned long iPoint, unsigned short nchildren_CV)
Set the number of children of an agglomerated control volume.
Definition CPoint.hpp:728
void SetVolume_n()
Set the volume of the control volume at time n.
Definition CPoint.cpp:139
const CCompressedSparsePatternUL & GetPoints() const
Get the entire point adjacency information in compressed format (CSR).
Definition CPoint.hpp:241
void SetnNeighbor(unsigned long iPoint, unsigned short nneighbor)
Set the number of neighbor (artificial dissipation).
Definition CPoint.hpp:459
void SetCoord_n1()
Set the coordinates of the control volume at time n-1 to the ones in Coord_n.
Definition CPoint.cpp:179
void SetPoints(const vector< vector< unsigned long > > &pointsMatrix)
Set the points that compose the control volume.
Definition CPoint.cpp:134
const su2activematrix & GetGridVel() const
Get the grid velocity matrix for the entire domain.
Definition CPoint.hpp:821
void SetWallRoughness(Roughness_type const &roughness)
Set wall roughnesses according to stored closest wall information.
Definition CPoint.hpp:895
CCompressedSparsePatternL::CInnerIter GetEdges(unsigned long iPoint) const
Get inner iterator to loop over neighbor edges.
Definition CPoint.hpp:296
void SetGridVel(unsigned long iPoint, const su2double *gridvel)
Set the value of the grid velocity at the point.
Definition CPoint.hpp:838
void SetCoord_n(unsigned long iPoint, const su2double *coord)
Set the coordinates of the control volume at time n, for restart cases.
Definition CPoint.hpp:768
CCompressedSparsePatternUL::CInnerIter GetPoints(unsigned long iPoint) const
Get inner iterator to loop over neighbor points.
Definition CPoint.hpp:271
CCompressedSparsePatternL::CInnerIter GetElems(unsigned long iPoint) const
Get inner iterator to loop over neighbor elements.
Definition CPoint.hpp:228
CPoint()=delete
Default construction is not allowed.
su2double & GetPeriodicVolume(unsigned long iPoint)
Get the missing component of area or volume for a control volume on a periodic marker.
Definition CPoint.hpp:579
unsigned long GetElem(unsigned long iPoint, unsigned long nelem) const
Get all the elements that compose the control volume.
Definition CPoint.hpp:221
unsigned short GetnNeighbor(unsigned long iPoint) const
Get the number of neighbor of a point.
Definition CPoint.hpp:466
void SetRoughnessHeight(unsigned long iPoint, su2double roughheight)
Set the value of the distance to the nearest wall.
Definition CPoint.hpp:500
void AddCoord(unsigned long iPoint, unsigned long iDim, su2double coord)
Set the coordinates for the control volume.
Definition CPoint.hpp:186
void SetVolume_Old()
Set the Volume to Volume_Old.
Definition CPoint.cpp:149
void SetAgglomerate_Indirect(unsigned long iPoint, bool agglomerate)
Set information about if the indirect neighbors can be agglomerated.
Definition CPoint.hpp:712
void SetChildren_CV(unsigned long iPoint, const vector< unsigned long > &children_CV)
Set all the children control volumes of an agglomerated control volume at once.
Definition CPoint.hpp:664
su2double GetCurvature(unsigned long iPoint) const
Get the value of the curvature at a surface node.
Definition CPoint.hpp:536
su2double GetRoughnessHeight(unsigned long iPoint) const
Get the value of the distance to the nearest wall.
Definition CPoint.hpp:507
unsigned long GetChildren_CV(unsigned long iPoint, unsigned short nchildren_CV) const
Get the children control volume of an agglomerated control volume.
Definition CPoint.hpp:681
void SetCoord_p1(unsigned long iPoint, const su2double *coord)
Set the coordinates of the control volume at time n+1.
Definition CPoint.hpp:786
void SetSolidBoundary(unsigned long iPoint, bool boundary)
Set if a point belong to the solid wall boundary.
Definition CPoint.hpp:374
const su2activematrix & GetCoord() const
Get the entire matrix of coordinates of the control volumes.
Definition CPoint.hpp:170
void SetGlobalIndex(unsigned long iPoint, unsigned long globalindex)
Set the global index in a parallel computation.
Definition CPoint.hpp:445
void SetCurvature(unsigned long iPoint, su2double curvature)
Set the value of the curvature at a surface node.
Definition CPoint.hpp:529
void SetVolume_nM1_Old()
Set the Volume_nM1 to Volume_nM1_Old.
Definition CPoint.cpp:159
unsigned long GetPoint(unsigned long iPoint, unsigned long npoint) const
Get all the points that compose the control volume.
Definition CPoint.hpp:264
void SetVolume_n_Old()
Set the Volume_n to Volume_n_Old.
Definition CPoint.cpp:154
long GetEdge(unsigned long iPoint, unsigned long nedge) const
Get all the edges that compose the control volume.
Definition CPoint.hpp:291
unsigned long GetColor(unsigned long iPoint) const
Get the color of a point, the color indicates to which subdomain the point belong to.
Definition CPoint.hpp:438
void SetChildren_CV(unsigned long iPoint, unsigned long nchildren_CV, unsigned long children_CV)
Set the children control volumes of an agglomerated control volume.
Definition CPoint.hpp:654
void SetDomain(unsigned long iPoint, bool domain)
For parallel computation, its indicates if a point must be computed or not.
Definition CPoint.hpp:416
CVectorOfMatrix & GetGridVel_Grad()
Get the grid velocity gradients for the entire domain.
Definition CPoint.hpp:845
void SetVolume_n_from_OldnM1()
Set the volume of the control volume at time n using n-1.
Definition CPoint.cpp:164
bool GetPeriodicBoundary(unsigned long iPoint) const
Provides information about if a point belongs to a periodic boundary (without MPI).
Definition CPoint.hpp:409
unsigned long GetGlobalIndex(unsigned long iPoint) const
Get the global index in a parallel computation.
Definition CPoint.hpp:452
su2double * GetCoord(unsigned long iPoint)
Get the coordinates of the control volume.
Definition CPoint.hpp:165
void SetVolume_nM1()
Set the volume of the control volume at time n-1.
Definition CPoint.cpp:144
bool GetAgglomerate(unsigned long iPoint) const
Get information about if a control volume has been agglomerated.
Definition CPoint.hpp:698
void SetAdjointSolution(unsigned long iPoint, const su2double *adj_sol)
Set the adjoint values of the (geometric) coordinates.
Definition CPoint.hpp:859
void SetVolume_from_Oldn()
Set the volume of the control volume at current time using time n.
Definition CPoint.cpp:169
void RegisterCoordinates(unsigned long iPoint, bool input)
Register coordinates of a point.
Definition CPoint.hpp:878
su2double GetAdjointSolution(unsigned long iPoint, unsigned long iDim) const
Get the adjoint values of the (geometric) coordinates.
Definition CPoint.hpp:869
long GetVertex(unsigned long iPoint, unsigned long iMarker) const
Get the vertex that compose the control volume for a marker.
Definition CPoint.hpp:316
const su2double & GetSharpEdge_Distance(unsigned long iPoint) const
Definition CPoint.hpp:522
void SetElems(const vector< vector< long > > &elemsMatrix)
Set the elements that are connected to each point.
Definition CPoint.cpp:132
bool GetDomain(unsigned long iPoint) const
For parallel computation, its indicates if a point must be computed or not.
Definition CPoint.hpp:423
const su2double & GetVolume(unsigned long iPoint) const
Definition CPoint.hpp:558
void FullAllocation(unsigned short imesh, const CConfig *config)
Allocate the variables not covered by the minimal constructor.
Definition CPoint.cpp:52
void SetBoundary(unsigned long iPoint, bool boundary)
Mark the point as boundary.
Definition CPoint.hpp:346
unsigned long GetParent_CV(unsigned long iPoint) const
Get the parent control volume of an agglomerated control volume.
Definition CPoint.hpp:673
bool GetPhysicalBoundary(unsigned long iPoint) const
Provides information about if a point belong to the physical boundaries (without MPI).
Definition CPoint.hpp:367
void SetWall_Distance(unsigned long iPoint, su2double distance)
Definition CPoint.hpp:485
su2double GetCoord(unsigned long iPoint, unsigned long iDim) const
Get the coordinates dor the control volume.
Definition CPoint.hpp:158
void AddVolume(unsigned long iPoint, su2double volume)
Adds some area or volume of the CV.
Definition CPoint.hpp:572
void ResetPoints()
Reset the points that compose the control volume.
Definition CPoint.hpp:246
bool GetSolidBoundary(unsigned long iPoint) const
Provides information about if a point belong to the physical boundaries (without MPI).
Definition CPoint.hpp:381
su2double & GetVolume(unsigned long iPoint)
Get area or volume of the control volume.
Definition CPoint.hpp:557
void SetGridVel(unsigned long iPoint, unsigned long iDim, su2double gridvel)
Set the value of the grid velocity at the point.
Definition CPoint.hpp:829
unsigned short GetnPoint(unsigned long iPoint) const
Get the number of points that compose the control volume.
Definition CPoint.hpp:256
bool GetAgglomerate_Indirect(unsigned long iPoint) const
Get information about if the indirect neighbors can be agglomerated.
Definition CPoint.hpp:705
void SetWall_Distance(unsigned long iPoint, su2double distance, int rankID, unsigned short zoneID, unsigned short markerID, unsigned long elemID)
Set the value of the distance to the nearest wall.
Definition CPoint.hpp:477
void SetEdge(unsigned long iPoint, long iedge, unsigned long nedge)
Set the edges that compose the control volume.
Definition CPoint.hpp:281
su2double GetMaxLength(unsigned long iPoint) const
Get the maximum cell-center to cell-center length.
Definition CPoint.hpp:550
su2double GetVolume_n(unsigned long iPoint) const
Get the volume of the control volume at time n.
Definition CPoint.hpp:594
su2double * GetGridVel(unsigned long iPoint)
Get the value of the grid velocity at the point.
Definition CPoint.hpp:816
su2double GetVolume_nM1(unsigned long iPoint) const
Get the volume of the control volume at time n+1.
Definition CPoint.hpp:601
su2double & GetSharpEdge_Distance(unsigned long iPoint)
Get the value of the distance to a sharp edge.
Definition CPoint.hpp:521
void SetVertex(unsigned long iPoint, long iVertex, unsigned long iMarker)
Set the boundary vertex that compose the control volume.
Definition CPoint.hpp:306
void SetColor(unsigned long iPoint, unsigned long color)
Set a color to the point that comes from the grid partitioning.
Definition CPoint.hpp:431
void SetCoord_n()
Set the coordinates of the control volume at time n to the ones in Coord.
Definition CPoint.cpp:174
su2double * GetCoord_Old(unsigned long iPoint)
Get the value of the old coordinates.
Definition CPoint.hpp:795
su2double * GetCoord_n1(unsigned long iPoint)
Get the coordinates of the control volume at time n-1.
Definition CPoint.hpp:744
void ResetElems()
Reset the elements of a control volume.
Definition CPoint.hpp:206
const vector< unsigned long > & GetChildren_CV(unsigned long iPoint) const
Get the children control volumes of an agglomerated control volume. Only the first GetnChildren_CV en...
Definition CPoint.hpp:691
void ResetBoundary(unsigned long iPoint)
Reset the boundary of a control volume.
Definition CPoint.hpp:336
unsigned short GetnElem(unsigned long iPoint) const
Get the number of elements that compose the control volume.
Definition CPoint.hpp:213
su2double & GetWall_Distance(unsigned long iPoint)
Get the value of the distance to the nearest wall.
Definition CPoint.hpp:492
bool GetBoundary(unsigned long iPoint) const
Provides information about if a point belong to the boundaries.
Definition CPoint.hpp:353
bool GetViscousBoundary(unsigned long iPoint) const
Provides information about if a point belong to the physical boundaries (without MPI).
Definition CPoint.hpp:395
void SetCoord(unsigned long iPoint, unsigned long iDim, su2double coord)
Set the coordinates for the control volume.
Definition CPoint.hpp:178
unsigned short GetnChildren_CV(unsigned long iPoint) const
Get the number of children of an agglomerated control volume.
Definition CPoint.hpp:721
void SetParent_CV(unsigned long iPoint, unsigned long parent_CV)
Set the parent control volume of an agglomerated control volume.
Definition CPoint.hpp:643
void SetSharpEdge_Distance(unsigned long iPoint, su2double distance)
Set the value of the distance to a sharp edge.
Definition CPoint.hpp:514
const su2double & GetWall_Distance(unsigned long iPoint) const
Definition CPoint.hpp:493
void SetVolume(unsigned long iPoint, su2double volume)
Set the volume of the control volume.
Definition CPoint.hpp:565
void SetCoord_n1(unsigned long iPoint, const su2double *coord)
Set the coordinates of the control volume at time n-1, for restart cases.
Definition CPoint.hpp:777
passivedouble su2double
Definition code_config.hpp:181
CCompressedSparsePattern< su2int > CCompressedSparsePatternL
Definition graph_toolbox.hpp:338
CCompressedSparsePattern< su2uint > CCompressedSparsePatternUL
Definition graph_toolbox.hpp:337
void RegisterInput(su2double &data)
Registers the variable as an input. I.e. as a leaf of the computational graph.
Definition ad_structure.hpp:101
double GetDerivative(Identifier index)
Extracts the adjoint value at index.
Definition ad_structure.hpp:139
void SetDerivative(Identifier index, const double val)
Sets the adjoint value at index to val.
Definition ad_structure.hpp:132
void SetIndex(Identifier &index, const su2double &data)
Evaluates and saves gradient data from a variable.
Definition ad_structure.hpp:296
void RegisterOutput(su2double &data)
Registers the variable as an output. I.e. as the root of the computational graph.
Definition ad_structure.hpp:107
passivedouble GetValue(const su2double &data)
Get the (primitive) value of the datatype (needs to be specialized for active types).
Definition datatype_structure.hpp:113