OGS
anonymous_namespace{AssemblyMixin.cpp} Namespace Reference

Functions

void checkResiduumNamesVsProcessVariables (std::vector< std::vector< std::string > > const &per_process_residuum_names, std::vector< std::vector< std::reference_wrapper< ProcessLib::ProcessVariable > > > const &per_process_pvs)
 
std::vector< std::vector< std::reference_wrapper< MeshLib::PropertyVector< double > > > > createResiduumVectors (MeshLib::Mesh &mesh, std::vector< std::vector< std::string > > const &per_process_residuum_names, std::vector< std::vector< std::reference_wrapper< ProcessLib::ProcessVariable > > > const &per_process_pvs)
 

Function Documentation

◆ checkResiduumNamesVsProcessVariables()

void anonymous_namespace{AssemblyMixin.cpp}::checkResiduumNamesVsProcessVariables ( std::vector< std::vector< std::string > > const & per_process_residuum_names,
std::vector< std::vector< std::reference_wrapper< ProcessLib::ProcessVariable > > > const & per_process_pvs )

Definition at line 26 of file AssemblyMixin.cpp.

31{
32 if (per_process_pvs.size() != per_process_residuum_names.size())
33 {
35 "The number of passed residuum names ({}) does not match the "
36 "number of processes ({}).",
37 per_process_residuum_names.size(), per_process_pvs.size());
38 }
39
40 auto check_sizes = [](std::size_t const process_id, auto const& rns_pvs)
41 {
42 auto const& [rns, pvs] = rns_pvs;
43
44 if (rns.size() != pvs.size())
45 {
47 "The number of passed residuum names ({}) does not match the "
48 "number of process variables ({}) for process {}.",
49 rns.size(), pvs.size(), process_id);
50 }
51 };
52 for (auto const& [process_id, rns_pvs] :
53 ranges::views::zip(per_process_residuum_names, per_process_pvs) |
54 ranges::views::enumerate)
55 {
56 check_sizes(process_id, rns_pvs);
57 }
58}
#define OGS_FATAL(...)
Definition Error.h:26

References OGS_FATAL.

Referenced by createResiduumVectors().

◆ createResiduumVectors()

std::vector< std::vector< std::reference_wrapper< MeshLib::PropertyVector< double > > > > anonymous_namespace{AssemblyMixin.cpp}::createResiduumVectors ( MeshLib::Mesh & mesh,
std::vector< std::vector< std::string > > const & per_process_residuum_names,
std::vector< std::vector< std::reference_wrapper< ProcessLib::ProcessVariable > > > const & per_process_pvs )

Definition at line 62 of file AssemblyMixin.cpp.

68{
69 checkResiduumNamesVsProcessVariables(per_process_residuum_names,
70 per_process_pvs);
71
72 auto create_mesh_property_for_residuum =
73 [&mesh](std::pair<std::string const&,
74 ProcessLib::ProcessVariable const&> const&
75 residuum_name_process_variable)
76 -> std::reference_wrapper<MeshLib::PropertyVector<double>>
77 {
78 auto const& [rn, pv] = residuum_name_process_variable;
81 pv.getNumberOfGlobalComponents());
82 };
83
84 auto create_mesh_properties =
85 [&create_mesh_property_for_residuum](auto const& rns_pvs)
86 {
87 auto const& [rns, pvs] = rns_pvs;
88 return ranges::views::zip(rns, pvs) |
89 ranges::views::transform(create_mesh_property_for_residuum) |
90 ranges::to<std::vector<
91 std::reference_wrapper<MeshLib::PropertyVector<double>>>>;
92 };
93
94 return ranges::views::zip(per_process_residuum_names, per_process_pvs) |
95 ranges::views::transform(create_mesh_properties) |
96 ranges::to<std::vector<std::vector<
97 std::reference_wrapper<MeshLib::PropertyVector<double>>>>>;
98}
PropertyVector< T > * getOrCreateMeshProperty(Mesh &mesh, std::string const &property_name, MeshItemType const item_type, int const number_of_components)
void checkResiduumNamesVsProcessVariables(std::vector< std::vector< std::string > > const &per_process_residuum_names, std::vector< std::vector< std::reference_wrapper< ProcessLib::ProcessVariable > > > const &per_process_pvs)

References checkResiduumNamesVsProcessVariables(), MeshLib::getOrCreateMeshProperty(), and MeshLib::Node.