OGS
MathLib::WeightedPoint Class Reference

Detailed Description

Represents a point of a certain dimension that has a weight attached.

Used, e.g., in numerical quadrature.

Definition at line 21 of file WeightedPoint.h.

#include <WeightedPoint.h>

Public Member Functions

template<std::size_t dim>
 WeightedPoint (std::array< double, dim > const &coords, double const weight)
 
 WeightedPoint (double const weight)
 Constructs a 0D weighted point.
 
bool operator== (WeightedPoint const &other) const
 
bool operator!= (WeightedPoint const &other) const
 
const double * data () const
 
double getWeight () const
 
std::size_t getDimension () const
 The point dimension, i.e., the number of its coordinates.
 
double operator[] (std::size_t coord_idx) const
 Access a specific coordinate.
 

Private Attributes

double weight_
 
std::array< double, 3 > coords_
 
std::size_t dim_
 

Constructor & Destructor Documentation

◆ WeightedPoint() [1/2]

template<std::size_t dim>
MathLib::WeightedPoint::WeightedPoint ( std::array< double, dim > const &  coords,
double const  weight 
)
inline

Constructs a 0...3D weighted point depending on the passed coordinates array.

Definition at line 27 of file WeightedPoint.h.

28 : weight_{weight}, dim_{dim}
29 {
30 static_assert(dim <= 3);
31 std::size_t i = 0;
32 if constexpr (dim > 0) // avoids compiler warning
33 {
34 for (; i < dim; ++i)
35 {
36 coords_[i] = coords[i];
37 }
38 }
39 for (; i < 3; ++i)
40 {
41 // fill the rest with NaN for safety reasons
42 coords_[i] = std::numeric_limits<double>::quiet_NaN();
43 }
44 }
std::array< double, 3 > coords_
Definition: WeightedPoint.h:93
constexpr ranges::views::view_closure coords
Definition: Mesh.h:232

References coords_.

◆ WeightedPoint() [2/2]

MathLib::WeightedPoint::WeightedPoint ( double const  weight)
inlineexplicit

Constructs a 0D weighted point.

Definition at line 47 of file WeightedPoint.h.

47 : weight_{weight}, dim_{0}
48 {
49 // fill with NaN for safety reasons
50 coords_.fill(std::numeric_limits<double>::quiet_NaN());
51 }

References coords_.

Member Function Documentation

◆ data()

const double * MathLib::WeightedPoint::data ( ) const
inline

Definition at line 78 of file WeightedPoint.h.

78{ return coords_.data(); }

References coords_.

◆ getDimension()

std::size_t MathLib::WeightedPoint::getDimension ( ) const
inline

The point dimension, i.e., the number of its coordinates.

Definition at line 83 of file WeightedPoint.h.

83{ return dim_; }

References dim_.

Referenced by MeshLib::getBulkElementPoint(), and MathLib::operator<<().

◆ getWeight()

double MathLib::WeightedPoint::getWeight ( ) const
inline

Definition at line 80 of file WeightedPoint.h.

80{ return weight_; }

References weight_.

Referenced by ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::HeatTransportBHELocalAssemblerBHE(), ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerSoil< ShapeFunction >::HeatTransportBHELocalAssemblerSoil(), ProcessLib::HT::HTFEM< ShapeFunction, GlobalDim >::HTFEM(), ProcessLib::HydroMechanics::HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::HydroMechanicsLocalAssembler(), ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerFracture< ShapeFunctionDisplacement, ShapeFunctionPressure, GlobalDim >::HydroMechanicsLocalAssemblerFracture(), ProcessLib::LIE::HydroMechanics::HydroMechanicsLocalAssemblerMatrix< ShapeFunctionDisplacement, ShapeFunctionPressure, GlobalDim >::HydroMechanicsLocalAssemblerMatrix(), ProcessLib::LargeDeformation::LargeDeformationLocalAssembler< ShapeFunction, DisplacementDim >::LargeDeformationLocalAssembler(), ProcessLib::LiquidFlow::LiquidFlowLocalAssembler< ShapeFunction, GlobalDim >::LiquidFlowLocalAssembler(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::LocalAssemblerData(), ProcessLib::RichardsComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::LocalAssemblerData(), ProcessLib::RichardsFlow::LocalAssemblerData< ShapeFunction, GlobalDim >::LocalAssemblerData(), ProcessLib::StokesFlow::LocalAssemblerData< ShapeFunctionLiquidVelocity, ShapeFunctionPressure, GlobalDim >::LocalAssemblerData(), ProcessLib::NormalTractionBoundaryCondition::NormalTractionBoundaryConditionLocalAssembler< ShapeFunctionDisplacement, GlobalDim >::NormalTractionBoundaryConditionLocalAssembler(), ProcessLib::PhaseField::PhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::PhaseFieldLocalAssembler(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::RichardsMechanicsLocalAssembler(), ProcessLib::SmallDeformation::SmallDeformationLocalAssembler< ShapeFunction, DisplacementDim >::SmallDeformationLocalAssembler(), ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerFracture< ShapeFunction, DisplacementDim >::SmallDeformationLocalAssemblerFracture(), ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerMatrix< ShapeFunction, DisplacementDim >::SmallDeformationLocalAssemblerMatrix(), ProcessLib::LIE::SmallDeformation::SmallDeformationLocalAssemblerMatrixNearFracture< ShapeFunction, DisplacementDim >::SmallDeformationLocalAssemblerMatrixNearFracture(), ProcessLib::SmallDeformationNonlocal::SmallDeformationNonlocalLocalAssembler< ShapeFunction, DisplacementDim >::SmallDeformationNonlocalLocalAssembler(), ProcessLib::TH2M::TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::TH2MLocalAssembler(), ProcessLib::ThermalTwoPhaseFlowWithPP::ThermalTwoPhaseFlowWithPPLocalAssembler< ShapeFunction, GlobalDim >::ThermalTwoPhaseFlowWithPPLocalAssembler(), ProcessLib::ThermoHydroMechanics::ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::ThermoHydroMechanicsLocalAssembler(), ProcessLib::ThermoMechanicalPhaseField::ThermoMechanicalPhaseFieldLocalAssembler< ShapeFunction, DisplacementDim >::ThermoMechanicalPhaseFieldLocalAssembler(), ProcessLib::ThermoMechanics::ThermoMechanicsLocalAssembler< ShapeFunction, DisplacementDim >::ThermoMechanicsLocalAssembler(), ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowLocalAssembler< ShapeFunction, GlobalDim >::ThermoRichardsFlowLocalAssembler(), ProcessLib::ThermoRichardsMechanics::ThermoRichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunction, DisplacementDim, ConstitutiveTraits >::ThermoRichardsMechanicsLocalAssembler(), ProcessLib::TwoPhaseFlowWithPP::TwoPhaseFlowWithPPLocalAssembler< ShapeFunction, GlobalDim >::TwoPhaseFlowWithPPLocalAssembler(), ProcessLib::TwoPhaseFlowWithPrho::TwoPhaseFlowWithPrhoLocalAssembler< ShapeFunction, GlobalDim >::TwoPhaseFlowWithPrhoLocalAssembler(), ProcessLib::VolumetricSourceTermLocalAssembler< ShapeFunction, GlobalDim >::VolumetricSourceTermLocalAssembler(), ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleWithJacobian(), ProcessLib::GenericNaturalBoundaryConditionLocalAssembler< ShapeFunction, GlobalDim >::initNsAndWeights(), and MathLib::operator<<().

◆ operator!=()

bool MathLib::WeightedPoint::operator!= ( WeightedPoint const &  other) const
inline

Definition at line 73 of file WeightedPoint.h.

74 {
75 return !(*this == other);
76 }

◆ operator==()

bool MathLib::WeightedPoint::operator== ( WeightedPoint const &  other) const
inline

Definition at line 53 of file WeightedPoint.h.

54 {
55 if (weight_ != other.weight_)
56 {
57 return false;
58 }
59 if (dim_ != other.dim_)
60 {
61 return false;
62 }
63 for (std::size_t comp = 0; comp < dim_; ++comp)
64 {
65 if (coords_[comp] != other.coords_[comp])
66 {
67 return false;
68 }
69 }
70 return true;
71 }

References coords_, dim_, and weight_.

◆ operator[]()

double MathLib::WeightedPoint::operator[] ( std::size_t  coord_idx) const
inline

Access a specific coordinate.

Definition at line 86 of file WeightedPoint.h.

87 {
88 return coords_[coord_idx];
89 }

References coords_.

Member Data Documentation

◆ coords_

std::array<double, 3> MathLib::WeightedPoint::coords_
private

Definition at line 93 of file WeightedPoint.h.

Referenced by WeightedPoint(), data(), operator==(), and operator[]().

◆ dim_

std::size_t MathLib::WeightedPoint::dim_
private

Definition at line 94 of file WeightedPoint.h.

Referenced by getDimension(), and operator==().

◆ weight_

double MathLib::WeightedPoint::weight_
private

Definition at line 92 of file WeightedPoint.h.

Referenced by getWeight(), and operator==().


The documentation for this class was generated from the following file: