OGS
MaterialPropertyLib::MaterialSpatialDistributionMap Class Reference

Detailed Description

Definition at line 28 of file MaterialSpatialDistributionMap.h.

#include <MaterialSpatialDistributionMap.h>

Collaboration diagram for MaterialPropertyLib::MaterialSpatialDistributionMap:
[legend]

Public Member Functions

 MaterialSpatialDistributionMap (std::map< int, std::shared_ptr< Medium > > const &media, MeshLib::PropertyVector< int > const *const material_ids)
 
MediumgetMedium (std::size_t element_id)
 
Medium const * getMedium (std::size_t element_id) const
 
void checkElementHasMedium (std::size_t const element_id) const
 

Private Attributes

std::map< int, std::shared_ptr< Medium > > const & media_
 
MeshLib::PropertyVector< int > const *const material_ids_
 

Constructor & Destructor Documentation

◆ MaterialSpatialDistributionMap()

MaterialPropertyLib::MaterialSpatialDistributionMap::MaterialSpatialDistributionMap ( std::map< int, std::shared_ptr< Medium > > const & media,
MeshLib::PropertyVector< int > const *const material_ids )
inline

Definition at line 31 of file MaterialSpatialDistributionMap.h.

34 : media_(media), material_ids_(material_ids)
35 {
36 }
MeshLib::PropertyVector< int > const *const material_ids_
std::map< int, std::shared_ptr< Medium > > const & media_

Member Function Documentation

◆ checkElementHasMedium()

void MaterialPropertyLib::MaterialSpatialDistributionMap::checkElementHasMedium ( std::size_t const element_id) const

Definition at line 68 of file MaterialSpatialDistributionMap.cpp.

70{
71 auto const material_id =
72 material_ids_ == nullptr ? 0 : (*material_ids_)[element_id];
73 if (media_.find(material_id) == media_.end())
74 {
76 "There is no medium definition for element {:d} with material "
77 "ID {:d}. Please define a medium for each material.",
78 element_id, material_id);
79 }
80}
#define OGS_FATAL(...)
Definition Error.h:26

References material_ids_, media_, and OGS_FATAL.

◆ getMedium() [1/2]

Medium * MaterialPropertyLib::MaterialSpatialDistributionMap::getMedium ( std::size_t element_id)

Definition at line 23 of file MaterialSpatialDistributionMap.cpp.

24{
25 return const_cast<Medium*>(
26 static_cast<MaterialSpatialDistributionMap const&>(*this).getMedium(
27 element_id));
28}
MaterialSpatialDistributionMap(std::map< int, std::shared_ptr< Medium > > const &media, MeshLib::PropertyVector< int > const *const material_ids)

References getMedium().

Referenced by ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::LocalAssemblerData(), ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowLocalAssembler< ShapeFunction, GlobalDim >::ThermoRichardsFlowLocalAssembler(), ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::WellboreSimulatorFEM(), ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::assemble(), ProcessLib::RichardsFlow::LocalAssemblerData< ShapeFunction, GlobalDim >::assemble(), ProcessLib::SteadyStateDiffusion::LocalAssemblerData< ShapeFunction, GlobalDim >::assemble(), ProcessLib::StokesFlow::LocalAssemblerData< ShapeFunctionLiquidVelocity, ShapeFunctionPressure, GlobalDim >::assemble(), ProcessLib::WellboreCompensateNeumannBoundaryConditionLocalAssembler< ShapeFunction, GlobalDim >::assemble(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleBlockMatrices(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleComponentTransportEquation(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleHeatTransportEquation(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleHydraulicEquation(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleKCmCn(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleReactionEquationConcrete(), ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleWithJacobian(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleWithJacobianComponentTransportEquation(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleWithJacobianHydraulicEquation(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::calculateIntPtDarcyVelocity(), MaterialPropertyLib::checkMaterialSpatialDistributionMap(), ProcessLib::ComponentTransport::checkMPLProperties(), ProcessLib::RichardsComponentTransport::anonymous_namespace{CreateRichardsComponentTransportProcess.cpp}::checkMPLProperties(), ProcessLib::StokesFlow::anonymous_namespace{CreateStokesFlowProcess.cpp}::checkMPLProperties(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::computeReactionRelatedSecondaryVariable(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::getFlux(), ProcessLib::HT::HTFEM< ShapeFunction, GlobalDim >::getFlux(), ProcessLib::SteadyStateDiffusion::LocalAssemblerData< ShapeFunction, GlobalDim >::getFlux(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::getHeatEnergyCoefficient(), ProcessLib::HT::HTFEM< ShapeFunction, GlobalDim >::getHeatEnergyCoefficient(), ProcessLib::RichardsFlow::LocalAssemblerData< ShapeFunction, GlobalDim >::getIntPtDarcyVelocity(), ProcessLib::SteadyStateDiffusion::LocalAssemblerData< ShapeFunction, GlobalDim >::getIntPtDarcyVelocity(), ProcessLib::HT::HTFEM< ShapeFunction, GlobalDim >::getIntPtDarcyVelocityLocal(), ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::getIntPtHeatFlux(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::getIntPtMolarFlux(), getMedium(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::getThermalConductivityDispersivity(), ProcessLib::HT::HTFEM< ShapeFunction, GlobalDim >::getThermalConductivityDispersivity(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::initializeChemicalSystemConcrete(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::postSpeciationCalculation(), and ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::setChemicalSystemConcrete().

◆ getMedium() [2/2]

Medium const * MaterialPropertyLib::MaterialSpatialDistributionMap::getMedium ( std::size_t element_id) const

Definition at line 30 of file MaterialSpatialDistributionMap.cpp.

32{
33 auto const material_id =
34 material_ids_ == nullptr ? 0 : (*material_ids_)[element_id];
35
36 assert(!media_.empty());
37
38 if (auto const it = media_.find(material_id); it != media_.end())
39 {
40 return it->second.get();
41 }
42
43 //
44 // Error handling until end of the function.
45 //
46
47 if (material_ids_ == nullptr)
48 {
49 assert(material_id == 0);
50 ERR("No MaterialIDs given in the mesh therefore default material id = "
51 "0 is used.");
52 }
53 auto keys = media_ | ranges::views::keys;
54
55 if (media_.size() == 1)
56 {
57 ERR("Single medium for material id {} is defined.",
58 fmt::join(keys, ", "));
59 }
60 else
61 {
62 ERR("Media for material ids {} are defined.", fmt::join(keys, ", "));
63 }
64 OGS_FATAL("No medium for material id {} found for element {}.", material_id,
65 element_id);
66}
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:45

References ERR(), material_ids_, media_, and OGS_FATAL.

Member Data Documentation

◆ material_ids_

MeshLib::PropertyVector<int> const* const MaterialPropertyLib::MaterialSpatialDistributionMap::material_ids_
private

Definition at line 44 of file MaterialSpatialDistributionMap.h.

Referenced by checkElementHasMedium(), and getMedium().

◆ media_

std::map<int, std::shared_ptr<Medium> > const& MaterialPropertyLib::MaterialSpatialDistributionMap::media_
private

Definition at line 43 of file MaterialSpatialDistributionMap.h.

Referenced by checkElementHasMedium(), and getMedium().


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