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 19 of file AssemblyMixin.cpp.

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

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 55 of file AssemblyMixin.cpp.

61{
62 checkResiduumNamesVsProcessVariables(per_process_residuum_names,
63 per_process_pvs);
64
65 auto create_mesh_property_for_residuum =
66 [&mesh](std::pair<std::string const&,
67 ProcessLib::ProcessVariable const&> const&
68 residuum_name_process_variable)
69 -> std::reference_wrapper<MeshLib::PropertyVector<double>>
70 {
71 auto const& [rn, pv] = residuum_name_process_variable;
74 pv.getNumberOfGlobalComponents());
75 };
76
77 auto create_mesh_properties =
78 [&create_mesh_property_for_residuum](auto const& rns_pvs)
79 {
80 auto const& [rns, pvs] = rns_pvs;
81 return ranges::views::zip(rns, pvs) |
82 ranges::views::transform(create_mesh_property_for_residuum) |
83 ranges::to<std::vector<
84 std::reference_wrapper<MeshLib::PropertyVector<double>>>>;
85 };
86
87 return ranges::views::zip(per_process_residuum_names, per_process_pvs) |
88 ranges::views::transform(create_mesh_properties) |
89 ranges::to<std::vector<std::vector<
90 std::reference_wrapper<MeshLib::PropertyVector<double>>>>>;
91}
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.