From 8922b830d3464b1b6ac3e906460c1b12f45c543b Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <github@naumov.de> Date: Sun, 10 Oct 2021 12:45:14 +0200 Subject: [PATCH] [PL] clang-format. --- .../CompareJacobiansJacobianAssembler.cpp | 6 ++- .../CoupledSolutionsForStaggeredScheme.cpp | 15 +++---- ProcessLib/CreateDeactivatedSubdomain.cpp | 26 +++++------ ProcessLib/CreateProcessData.cpp | 5 +-- ProcessLib/CreateTimeLoop.cpp | 5 +-- ProcessLib/HeatTransportBHE/BHE/BHE_1U.cpp | 5 +-- ProcessLib/HeatTransportBHE/BHE/BHE_2U.cpp | 5 +-- ProcessLib/HeatTransportBHE/BHE/MeshUtils.cpp | 18 ++++---- .../CreateHeatTransportBHEProcess.cpp | 5 +-- .../HydroMechanics/HydroMechanicsProcess.cpp | 10 +++-- ProcessLib/LIE/Common/LevelSetFunction.cpp | 10 ++--- ProcessLib/LIE/Common/MeshUtils.cpp | 27 +++++------ ProcessLib/LIE/Common/PostUtils.cpp | 15 +++---- .../CreateHydroMechanicsProcess.cpp | 5 +-- .../HydroMechanics/HydroMechanicsProcess.cpp | 14 +++--- .../CreateSmallDeformationProcess.cpp | 5 +-- .../SmallDeformationProcess.cpp | 3 +- ProcessLib/Output/IntegrationPointWriter.cpp | 6 +-- ProcessLib/Process.cpp | 45 ++++++++++--------- ...reateRichardsComponentTransportProcess.cpp | 4 +- .../SmallDeformationProcess.cpp | 3 +- .../StokesFlow/CreateStokesFlowProcess.cpp | 2 +- ProcessLib/StokesFlow/StokesFlowProcess.cpp | 4 +- ProcessLib/TES/TESProcess.cpp | 15 ++++--- ProcessLib/TES/TESReactionAdaptor.cpp | 6 ++- .../ThermoMechanicsProcess.cpp | 6 ++- .../CreateSimplifiedElasticityModel.cpp | 2 +- .../CreateThermoRichardsFlowProcess.cpp | 16 +++---- .../ThermoRichardsFlowProcess.cpp | 16 +++---- ...TwoPhaseFlowWithPrhoMaterialProperties.cpp | 11 ++--- ProcessLib/Utils/ProcessUtils.cpp | 5 +-- ProcessLib/VectorMatrixAssembler.cpp | 12 ++--- 32 files changed, 165 insertions(+), 167 deletions(-) diff --git a/ProcessLib/CompareJacobiansJacobianAssembler.cpp b/ProcessLib/CompareJacobiansJacobianAssembler.cpp index 2eab4201b76..1e758971fc3 100644 --- a/ProcessLib/CompareJacobiansJacobianAssembler.cpp +++ b/ProcessLib/CompareJacobiansJacobianAssembler.cpp @@ -133,7 +133,8 @@ void CompareJacobiansJacobianAssembler::assembleWithJacobian( ++_counter; auto const num_dof = local_x.size(); - auto to_mat = [num_dof](std::vector<double> const& data) { + auto to_mat = [num_dof](std::vector<double> const& data) + { if (data.empty()) { return Eigen::Map<Eigen::Matrix< @@ -222,7 +223,8 @@ void CompareJacobiansJacobianAssembler::assembleWithJacobian( } // basic consistency check if something went terribly wrong - auto check_equality = [&fatal_error](auto mat_or_vec1, auto mat_or_vec2) { + auto check_equality = [&fatal_error](auto mat_or_vec1, auto mat_or_vec2) + { if (mat_or_vec1.size() == 0 || mat_or_vec2.size() == 0) { return; diff --git a/ProcessLib/CoupledSolutionsForStaggeredScheme.cpp b/ProcessLib/CoupledSolutionsForStaggeredScheme.cpp index d4d706b0036..29463ebea66 100644 --- a/ProcessLib/CoupledSolutionsForStaggeredScheme.cpp +++ b/ProcessLib/CoupledSolutionsForStaggeredScheme.cpp @@ -38,14 +38,13 @@ std::vector<double> getCoupledLocalSolutions( return {}; } - std::size_t const local_solutions_size = std::accumulate( - cbegin(indices), - cend(indices), - std::size_t(0), - [](GlobalIndexType const size, - std::vector<GlobalIndexType> const& process_indices) { - return size + process_indices.size(); - }); + std::size_t const local_solutions_size = + std::accumulate(cbegin(indices), + cend(indices), + std::size_t(0), + [](GlobalIndexType const size, + std::vector<GlobalIndexType> const& process_indices) + { return size + process_indices.size(); }); std::vector<double> local_solutions; local_solutions.reserve(local_solutions_size); diff --git a/ProcessLib/CreateDeactivatedSubdomain.cpp b/ProcessLib/CreateDeactivatedSubdomain.cpp index 711999fc702..1cfe5c6725b 100644 --- a/ProcessLib/CreateDeactivatedSubdomain.cpp +++ b/ProcessLib/CreateDeactivatedSubdomain.cpp @@ -48,7 +48,8 @@ extractInnerAndOuterNodes(MeshLib::Mesh const& mesh, std::partition_copy( begin(sub_mesh.getNodes()), end(sub_mesh.getNodes()), back_inserter(inner_nodes), back_inserter(outer_nodes), - [&](MeshLib::Node* const n) { + [&](MeshLib::Node* const n) + { auto const bulk_node = mesh.getNode((*bulk_node_ids)[n->getID()]); const auto& connected_elements = mesh.getElementsConnectedToNode(*bulk_node); @@ -65,9 +66,8 @@ static std::unique_ptr<DeactivatedSubdomainMesh> createDeactivatedSubdomainMesh( { // An element is active if its material id matches the selected material id. auto is_active = [material_id, material_ids = *materialIDs(mesh)]( - MeshLib::Element const* const e) { - return material_id == material_ids[e->getID()]; - }; + MeshLib::Element const* const e) + { return material_id == material_ids[e->getID()]; }; auto const& elements = mesh.getElements(); std::vector<MeshLib::Element*> deactivated_elements; @@ -255,9 +255,8 @@ std::unique_ptr<DeactivatedSubdomain const> createDeactivatedSubdomain( std::transform(begin(deactivated_subdomain_material_ids), end(deactivated_subdomain_material_ids), back_inserter(deactivated_subdomain_meshes), - [&](std::size_t const id) { - return createDeactivatedSubdomainMesh(mesh, id); - }); + [&](std::size_t const id) + { return createDeactivatedSubdomainMesh(mesh, id); }); return std::make_unique<DeactivatedSubdomain const>( std::move(time_interval), @@ -288,12 +287,13 @@ createDeactivatedSubdomains( auto const deactivated_subdomain_configs = //! \ogs_file_param{prj__process_variables__process_variable__deactivated_subdomains__deactivated_subdomain} subdomains_config->getConfigSubtreeList("deactivated_subdomain"); - std::transform( - begin(deactivated_subdomain_configs), - end(deactivated_subdomain_configs), - back_inserter(deactivated_subdomains), [&](auto const& config) { - return createDeactivatedSubdomain(config, mesh, parameters, curves); - }); + std::transform(begin(deactivated_subdomain_configs), + end(deactivated_subdomain_configs), + back_inserter(deactivated_subdomains), + [&](auto const& config) { + return createDeactivatedSubdomain( + config, mesh, parameters, curves); + }); } return deactivated_subdomains; } diff --git a/ProcessLib/CreateProcessData.cpp b/ProcessLib/CreateProcessData.cpp index 27737e26b63..3f4762a5f41 100644 --- a/ProcessLib/CreateProcessData.cpp +++ b/ProcessLib/CreateProcessData.cpp @@ -78,9 +78,8 @@ std::vector<std::unique_ptr<ProcessData>> createPerProcessData( auto const pcs_name = pcs_config.getConfigAttribute<std::string>("ref"); auto& pcs = *BaseLib::getIfOrError( processes, - [&pcs_name](std::unique_ptr<Process> const& p) { - return p->name == pcs_name; - }, + [&pcs_name](std::unique_ptr<Process> const& p) + { return p->name == pcs_name; }, "A process with the given name has not been defined."); auto const nl_slv_name = diff --git a/ProcessLib/CreateTimeLoop.cpp b/ProcessLib/CreateTimeLoop.cpp index 44138a4d5a4..84dace61b8b 100644 --- a/ProcessLib/CreateTimeLoop.cpp +++ b/ProcessLib/CreateTimeLoop.cpp @@ -79,9 +79,8 @@ std::unique_ptr<TimeLoop> createTimeLoop( per_process_data.begin(), per_process_data.end(), [](std::unique_ptr<ProcessData> const& a, - std::unique_ptr<ProcessData> const& b) { - return (a->timestepper->end() < b->timestepper->end()); - }); + std::unique_ptr<ProcessData> const& b) + { return (a->timestepper->end() < b->timestepper->end()); }); const double start_time = per_process_data[minmax_iter.first - per_process_data.begin()] ->timestepper->begin(); diff --git a/ProcessLib/HeatTransportBHE/BHE/BHE_1U.cpp b/ProcessLib/HeatTransportBHE/BHE/BHE_1U.cpp index 1f0fc430c97..e2000c8bbf0 100644 --- a/ProcessLib/HeatTransportBHE/BHE/BHE_1U.cpp +++ b/ProcessLib/HeatTransportBHE/BHE/BHE_1U.cpp @@ -134,9 +134,8 @@ std::array<double, 3> thermalResistancesGroutSoil(double const chi, compute_R_gg(chi, R_gs, R_ar, R_g); // Resulting thermal resistances. double new_chi = chi; - auto constraint = [&]() { - return 1.0 / ((1.0 / R_gg) + (1.0 / (2.0 * R_gs))); - }; + auto constraint = [&]() + { return 1.0 / ((1.0 / R_gg) + (1.0 / (2.0 * R_gs))); }; std::array<double, 3> const multiplier{chi * 2.0 / 3.0, chi * 1.0 / 3.0, 0.0}; diff --git a/ProcessLib/HeatTransportBHE/BHE/BHE_2U.cpp b/ProcessLib/HeatTransportBHE/BHE/BHE_2U.cpp index 0a9255667c9..b7622bf47f9 100644 --- a/ProcessLib/HeatTransportBHE/BHE/BHE_2U.cpp +++ b/ProcessLib/HeatTransportBHE/BHE/BHE_2U.cpp @@ -154,9 +154,8 @@ std::array<double, 4> thermalResistancesGroutSoil2U(double const chi, R_g); // Resulting thermal resistances. double chi_new = chi; - auto constraint = [&]() { - return 1.0 / ((1.0 / R_gg_1) + (1.0 / (2.0 * R_gs))); - }; + auto constraint = [&]() + { return 1.0 / ((1.0 / R_gg_1) + (1.0 / (2.0 * R_gs))); }; std::array<double, 3> const multiplier{chi * 2.0 / 3.0, chi * 1.0 / 3.0, 0.0}; diff --git a/ProcessLib/HeatTransportBHE/BHE/MeshUtils.cpp b/ProcessLib/HeatTransportBHE/BHE/MeshUtils.cpp index 3e6bf0c789f..3b9e42e3e29 100644 --- a/ProcessLib/HeatTransportBHE/BHE/MeshUtils.cpp +++ b/ProcessLib/HeatTransportBHE/BHE/MeshUtils.cpp @@ -38,9 +38,8 @@ std::vector<int> getUniqueMaterialIds( std::set<int> unique_material_ids; std::transform(begin(elements), end(elements), inserter(unique_material_ids, end(unique_material_ids)), - [&material_ids](MeshLib::Element const* const e) { - return material_ids[e->getID()]; - }); + [&material_ids](MeshLib::Element const* const e) + { return material_ids[e->getID()]; }); return {begin(unique_material_ids), end(unique_material_ids)}; } } // namespace @@ -80,9 +79,9 @@ BHEMeshData getBHEDataInMesh(MeshLib::Mesh const& mesh) const auto bhe_mat_id = bhe_material_ids[bhe_id]; std::vector<MeshLib::Element*>& vec_elements = bhe_elements[bhe_id]; copy_if(begin(all_bhe_elements), end(all_bhe_elements), - back_inserter(vec_elements), [&](MeshLib::Element* e) { - return material_ids[e->getID()] == bhe_mat_id; - }); + back_inserter(vec_elements), + [&](MeshLib::Element* e) + { return material_ids[e->getID()] == bhe_mat_id; }); DBUG("-> found {:d} elements on the BHE_{:d}", vec_elements.size(), bhe_id); } @@ -100,10 +99,9 @@ BHEMeshData getBHEDataInMesh(MeshLib::Mesh const& mesh) vec_nodes.push_back(const_cast<MeshLib::Node*>(e->getNode(i))); } } - BaseLib::makeVectorUnique( - vec_nodes, [](MeshLib::Node* node1, MeshLib::Node* node2) { - return node1->getID() < node2->getID(); - }); + BaseLib::makeVectorUnique(vec_nodes, + [](MeshLib::Node* node1, MeshLib::Node* node2) + { return node1->getID() < node2->getID(); }); DBUG("-> found {:d} nodes on the BHE_{:d}", vec_nodes.size(), bhe_id); } diff --git a/ProcessLib/HeatTransportBHE/CreateHeatTransportBHEProcess.cpp b/ProcessLib/HeatTransportBHE/CreateHeatTransportBHEProcess.cpp index a43fe46f1ed..4cc54ada635 100644 --- a/ProcessLib/HeatTransportBHE/CreateHeatTransportBHEProcess.cpp +++ b/ProcessLib/HeatTransportBHE/CreateHeatTransportBHEProcess.cpp @@ -70,9 +70,8 @@ std::unique_ptr<Process> createHeatTransportBHEProcess( "'temperature_soil' or 'temperature_BHE_X'"); } auto variable = std::find_if(variables.cbegin(), variables.cend(), - [&pv_name](ProcessVariable const& v) { - return v.getName() == pv_name; - }); + [&pv_name](ProcessVariable const& v) + { return v.getName() == pv_name; }); if (variable == variables.end()) { diff --git a/ProcessLib/HydroMechanics/HydroMechanicsProcess.cpp b/ProcessLib/HydroMechanics/HydroMechanicsProcess.cpp index 78354c832f6..f0c5fca86c4 100644 --- a/ProcessLib/HydroMechanics/HydroMechanicsProcess.cpp +++ b/ProcessLib/HydroMechanics/HydroMechanicsProcess.cpp @@ -183,7 +183,8 @@ void HydroMechanicsProcess<DisplacementDim>::initializeConcreteProcess( auto add_secondary_variable = [&](std::string const& name, int const num_components, - auto get_ip_values_function) { + auto get_ip_values_function) + { _secondary_variables.addSecondaryVariable( name, makeExtrapolator(num_components, getExtrapolator(), @@ -201,8 +202,8 @@ void HydroMechanicsProcess<DisplacementDim>::initializeConcreteProcess( DisplacementDim>::RowsAtCompileTime, &LocalAssemblerIF::getIntPtEpsilon); - add_secondary_variable( - "velocity", DisplacementDim, &LocalAssemblerIF::getIntPtDarcyVelocity); + add_secondary_variable("velocity", DisplacementDim, + &LocalAssemblerIF::getIntPtDarcyVelocity); // // enable output of internal variables defined by material models @@ -388,7 +389,8 @@ void HydroMechanicsProcess<DisplacementDim>:: _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x, xdot, dxdot_dx, dx_dx, process_id, M, K, b, Jac); - auto copyRhs = [&](int const variable_id, auto& output_vector) { + auto copyRhs = [&](int const variable_id, auto& output_vector) + { if (_use_monolithic_scheme) { transformVariableFromGlobalVector(b, variable_id, dof_tables[0], diff --git a/ProcessLib/LIE/Common/LevelSetFunction.cpp b/ProcessLib/LIE/Common/LevelSetFunction.cpp index f2ea2e51d92..0dabc458d2d 100644 --- a/ProcessLib/LIE/Common/LevelSetFunction.cpp +++ b/ProcessLib/LIE/Common/LevelSetFunction.cpp @@ -59,11 +59,11 @@ std::vector<double> uGlobalEnrichments( for (std::size_t i = 0; i < frac_props.size(); i++) { auto const* frac = frac_props[i]; - enrichments[i] = Heaviside(std::accumulate( - cbegin(frac->branches_slave), cend(frac->branches_slave), - levelsets[i], [&](bool const enrich, auto const& branch) { - return enrich & levelsetBranch(branch, x); - })); + enrichments[i] = Heaviside( + std::accumulate(cbegin(frac->branches_slave), + cend(frac->branches_slave), levelsets[i], + [&](bool const enrich, auto const& branch) + { return enrich & levelsetBranch(branch, x); })); } // junctions diff --git a/ProcessLib/LIE/Common/MeshUtils.cpp b/ProcessLib/LIE/Common/MeshUtils.cpp index 328f57613e9..be093246627 100644 --- a/ProcessLib/LIE/Common/MeshUtils.cpp +++ b/ProcessLib/LIE/Common/MeshUtils.cpp @@ -247,10 +247,10 @@ void getFractureMatrixDataInMesh( { OGS_FATAL("Could not access MaterialIDs property from mesh."); } - transform( - cbegin(all_fracture_elements), cend(all_fracture_elements), - back_inserter(vec_fracture_mat_IDs), - [&material_ids](auto const* e) { return (*material_ids)[e->getID()]; }); + transform(cbegin(all_fracture_elements), cend(all_fracture_elements), + back_inserter(vec_fracture_mat_IDs), + [&material_ids](auto const* e) + { return (*material_ids)[e->getID()]; }); BaseLib::makeVectorUnique(vec_fracture_mat_IDs); DBUG("-> found {:d} fracture material groups", vec_fracture_mat_IDs.size()); @@ -264,9 +264,8 @@ void getFractureMatrixDataInMesh( vec_fracture_elements[frac_id]; std::copy_if(all_fracture_elements.begin(), all_fracture_elements.end(), std::back_inserter(vec_elements), - [&](MeshLib::Element* e) { - return (*material_ids)[e->getID()] == frac_mat_id; - }); + [&](MeshLib::Element* e) + { return (*material_ids)[e->getID()] == frac_mat_id; }); DBUG("-> found {:d} elements on the fracture {:d}", vec_elements.size(), frac_id); } @@ -287,10 +286,9 @@ void getFractureMatrixDataInMesh( vec_nodes.push_back(const_cast<MeshLib::Node*>(e->getNode(i))); } } - BaseLib::makeVectorUnique( - vec_nodes, [](MeshLib::Node* node1, MeshLib::Node* node2) { - return node1->getID() < node2->getID(); - }); + BaseLib::makeVectorUnique(vec_nodes, + [](MeshLib::Node* node1, MeshLib::Node* node2) + { return node1->getID() < node2->getID(); }); DBUG("-> found {:d} nodes on the fracture {:d}", vec_nodes.size(), frac_id); } @@ -335,10 +333,9 @@ void getFractureMatrixDataInMesh( } } } - BaseLib::makeVectorUnique( - vec_ele, [](MeshLib::Element* e1, MeshLib::Element* e2) { - return e1->getID() < e2->getID(); - }); + BaseLib::makeVectorUnique(vec_ele, + [](MeshLib::Element* e1, MeshLib::Element* e2) + { return e1->getID() < e2->getID(); }); // second, append fracture elements std::copy(fracture_elements.begin(), fracture_elements.end(), diff --git a/ProcessLib/LIE/Common/PostUtils.cpp b/ProcessLib/LIE/Common/PostUtils.cpp index b2752eaf9ca..8adad3edaea 100644 --- a/ProcessLib/LIE/Common/PostUtils.cpp +++ b/ProcessLib/LIE/Common/PostUtils.cpp @@ -22,9 +22,9 @@ namespace bool includesNodeID(std::vector<MeshLib::Node*> const& vec_nodes, std::size_t node_id) { - return std::any_of( - vec_nodes.begin(), vec_nodes.end(), - [&](MeshLib::Node const* node) { return node->getID() == node_id; }); + return std::any_of(vec_nodes.begin(), vec_nodes.end(), + [&](MeshLib::Node const* node) + { return node->getID() == node_id; }); } std::vector<int> const& getMaterialIdsForNode( @@ -32,11 +32,10 @@ std::vector<int> const& getMaterialIdsForNode( vec_nodeID_matIDs, std::size_t nodeID) { - auto itr = std::find_if( - vec_nodeID_matIDs.begin(), vec_nodeID_matIDs.end(), - [&](std::pair<std::size_t, std::vector<int>> const& entry) { - return entry.first == nodeID; - }); + auto itr = + std::find_if(vec_nodeID_matIDs.begin(), vec_nodeID_matIDs.end(), + [&](std::pair<std::size_t, std::vector<int>> const& entry) + { return entry.first == nodeID; }); assert(itr != vec_nodeID_matIDs.end()); return itr->second; }; diff --git a/ProcessLib/LIE/HydroMechanics/CreateHydroMechanicsProcess.cpp b/ProcessLib/LIE/HydroMechanics/CreateHydroMechanicsProcess.cpp index 3903f7fc126..efcfad1cdfd 100644 --- a/ProcessLib/LIE/HydroMechanics/CreateHydroMechanicsProcess.cpp +++ b/ProcessLib/LIE/HydroMechanics/CreateHydroMechanicsProcess.cpp @@ -70,9 +70,8 @@ std::unique_ptr<Process> createHydroMechanicsProcess( "'displacement' or 'displacement_jumpN' or 'pressure'"); } auto variable = std::find_if(variables.cbegin(), variables.cend(), - [&pv_name](ProcessVariable const& v) { - return v.getName() == pv_name; - }); + [&pv_name](ProcessVariable const& v) + { return v.getName() == pv_name; }); if (variable == variables.end()) { diff --git a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp index 84f73bc5046..c2dff0b12eb 100644 --- a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp +++ b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp @@ -488,9 +488,9 @@ void HydroMechanicsProcess<GlobalDim>::postTimestepConcreteProcess( const int monolithic_process_id = 0; auto const& pvs = getProcessVariables(monolithic_process_id); auto const it = - std::find_if(pvs.begin(), pvs.end(), [](ProcessVariable const& pv) { - return pv.getName() == "displacement_jump1"; - }); + std::find_if(pvs.begin(), pvs.end(), + [](ProcessVariable const& pv) + { return pv.getName() == "displacement_jump1"; }); if (it == pvs.end()) { OGS_FATAL( @@ -530,8 +530,9 @@ void HydroMechanicsProcess<GlobalDim>::postTimestepConcreteProcess( MeshLib::PropertyVector<double>& vec_w = *_process_data.mesh_prop_nodal_w; MeshLib::PropertyVector<double>& vec_b = *_process_data.mesh_prop_nodal_b; - auto compute_nodal_aperture = [&](std::size_t const node_id, - double const w_n) { + auto compute_nodal_aperture = + [&](std::size_t const node_id, double const w_n) + { // skip aperture computation for element-wise defined b0 because there // are jumps on the nodes between the element's values. if (dynamic_cast<ParameterLib::MeshElementParameter<double> const*>( @@ -607,7 +608,8 @@ void HydroMechanicsProcess<GlobalDim>::assembleWithJacobianConcreteProcess( _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, dxdot_dx, dx_dx, process_id, M, K, b, Jac); - auto copyRhs = [&](int const variable_id, auto& output_vector) { + auto copyRhs = [&](int const variable_id, auto& output_vector) + { transformVariableFromGlobalVector(b, variable_id, *_local_to_global_index_map, output_vector, std::negate<double>()); diff --git a/ProcessLib/LIE/SmallDeformation/CreateSmallDeformationProcess.cpp b/ProcessLib/LIE/SmallDeformation/CreateSmallDeformationProcess.cpp index fdf824e4127..baa06a9111e 100644 --- a/ProcessLib/LIE/SmallDeformation/CreateSmallDeformationProcess.cpp +++ b/ProcessLib/LIE/SmallDeformation/CreateSmallDeformationProcess.cpp @@ -67,9 +67,8 @@ std::unique_ptr<Process> createSmallDeformationProcess( } auto variable = std::find_if(variables.cbegin(), variables.cend(), - [&pv_name](ProcessVariable const& v) { - return v.getName() == pv_name; - }); + [&pv_name](ProcessVariable const& v) + { return v.getName() == pv_name; }); if (variable == variables.end()) { diff --git a/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.cpp b/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.cpp index cc99fb75355..7f452d1473e 100644 --- a/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.cpp +++ b/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.cpp @@ -120,7 +120,8 @@ SmallDeformationProcess<DisplacementDim>::SmallDeformationProcess( transform(cbegin(vec_junction_nodeID_matIDs), cend(vec_junction_nodeID_matIDs), back_inserter(_vec_junction_nodes), - [&](auto& vec_junction_nodeID_matID) { + [&](auto& vec_junction_nodeID_matID) + { return const_cast<MeshLib::Node*>( _mesh.getNode(vec_junction_nodeID_matID.first)); }); diff --git a/ProcessLib/Output/IntegrationPointWriter.cpp b/ProcessLib/Output/IntegrationPointWriter.cpp index 4494b4a5346..1ff00699443 100644 --- a/ProcessLib/Output/IntegrationPointWriter.cpp +++ b/ProcessLib/Output/IntegrationPointWriter.cpp @@ -96,9 +96,9 @@ void addIntegrationPointWriter( std::vector<IntegrationPointMetaData> meta_data; meta_data.reserve(size(integration_point_writer)); transform(cbegin(integration_point_writer), cend(integration_point_writer), - back_inserter(meta_data), [&](auto const& ip_writer) { - return addIntegrationPointData(mesh, *ip_writer); - }); + back_inserter(meta_data), + [&](auto const& ip_writer) + { return addIntegrationPointData(mesh, *ip_writer); }); if (!meta_data.empty()) { addIntegrationPointMetaData(mesh, meta_data); diff --git a/ProcessLib/Process.cpp b/ProcessLib/Process.cpp index 8f67092040b..45c98309c0a 100644 --- a/ProcessLib/Process.cpp +++ b/ProcessLib/Process.cpp @@ -37,26 +37,30 @@ Process::Process( _coupled_solutions(nullptr), _integration_order(integration_order), _process_variables(std::move(process_variables)), - _boundary_conditions([&](const std::size_t number_of_process_variables) - -> std::vector<BoundaryConditionCollection> { - std::vector<BoundaryConditionCollection> pcs_BCs; - pcs_BCs.reserve(number_of_process_variables); - for (std::size_t i = 0; i < number_of_process_variables; i++) + _boundary_conditions( + [&](const std::size_t number_of_process_variables) + -> std::vector<BoundaryConditionCollection> { - pcs_BCs.emplace_back(BoundaryConditionCollection(parameters)); - } - return pcs_BCs; - }(_process_variables.size())), - _source_term_collections([&](const std::size_t number_of_processes) - -> std::vector<SourceTermCollection> { - std::vector<SourceTermCollection> pcs_sts; - pcs_sts.reserve(number_of_processes); - for (std::size_t i = 0; i < number_of_processes; i++) + std::vector<BoundaryConditionCollection> pcs_BCs; + pcs_BCs.reserve(number_of_process_variables); + for (std::size_t i = 0; i < number_of_process_variables; i++) + { + pcs_BCs.emplace_back(BoundaryConditionCollection(parameters)); + } + return pcs_BCs; + }(_process_variables.size())), + _source_term_collections( + [&](const std::size_t number_of_processes) + -> std::vector<SourceTermCollection> { - pcs_sts.emplace_back(SourceTermCollection(parameters)); - } - return pcs_sts; - }(_process_variables.size())) + std::vector<SourceTermCollection> pcs_sts; + pcs_sts.reserve(number_of_processes); + for (std::size_t i = 0; i < number_of_processes; i++) + { + pcs_sts.emplace_back(SourceTermCollection(parameters)); + } + return pcs_sts; + }(_process_variables.size())) { } @@ -285,9 +289,8 @@ void Process::constructMonolithicProcessDofTable() std::vector<int> vec_var_n_components; transform(cbegin(_process_variables[0]), cend(_process_variables[0]), back_inserter(vec_var_n_components), - [](ProcessVariable const& pv) { - return pv.getNumberOfGlobalComponents(); - }); + [](ProcessVariable const& pv) + { return pv.getNumberOfGlobalComponents(); }); _local_to_global_index_map = std::make_unique<NumLib::LocalToGlobalIndexMap>( diff --git a/ProcessLib/RichardsComponentTransport/CreateRichardsComponentTransportProcess.cpp b/ProcessLib/RichardsComponentTransport/CreateRichardsComponentTransportProcess.cpp index 50fb71cf6f0..95c523f0e16 100644 --- a/ProcessLib/RichardsComponentTransport/CreateRichardsComponentTransportProcess.cpp +++ b/ProcessLib/RichardsComponentTransport/CreateRichardsComponentTransportProcess.cpp @@ -154,9 +154,7 @@ std::unique_ptr<Process> createRichardsComponentTransportProcess( DBUG("Media properties verified."); RichardsComponentTransportProcessData process_data{ - std::move(media_map), - specific_body_force, - has_gravity}; + std::move(media_map), specific_body_force, has_gravity}; SecondaryVariableCollection secondary_variables; diff --git a/ProcessLib/SmallDeformation/SmallDeformationProcess.cpp b/ProcessLib/SmallDeformation/SmallDeformationProcess.cpp index 5bfb5e6a20f..c8ba2afd593 100644 --- a/ProcessLib/SmallDeformation/SmallDeformationProcess.cpp +++ b/ProcessLib/SmallDeformation/SmallDeformationProcess.cpp @@ -97,7 +97,8 @@ void SmallDeformationProcess<DisplacementDim>::initializeConcreteProcess( auto add_secondary_variable = [&](std::string const& name, int const num_components, - auto get_ip_values_function) { + auto get_ip_values_function) + { _secondary_variables.addSecondaryVariable( name, makeExtrapolator(num_components, getExtrapolator(), diff --git a/ProcessLib/StokesFlow/CreateStokesFlowProcess.cpp b/ProcessLib/StokesFlow/CreateStokesFlowProcess.cpp index a662a628363..aa9bf698e44 100644 --- a/ProcessLib/StokesFlow/CreateStokesFlowProcess.cpp +++ b/ProcessLib/StokesFlow/CreateStokesFlowProcess.cpp @@ -9,11 +9,11 @@ */ #include "CreateStokesFlowProcess.h" -#include "StokesFlowProcess.h" #include "MaterialLib/MPL/CreateMaterialSpatialDistributionMap.h" #include "ProcessLib/Output/CreateSecondaryVariables.h" #include "ProcessLib/Utils/ProcessUtils.h" +#include "StokesFlowProcess.h" namespace ProcessLib { diff --git a/ProcessLib/StokesFlow/StokesFlowProcess.cpp b/ProcessLib/StokesFlow/StokesFlowProcess.cpp index bb85dc1a909..9b72bf275d3 100644 --- a/ProcessLib/StokesFlow/StokesFlowProcess.cpp +++ b/ProcessLib/StokesFlow/StokesFlowProcess.cpp @@ -8,11 +8,11 @@ * */ +#include "StokesFlowProcess.h" + #include <cassert> #include "CreateLocalAssemblers.h" -#include "StokesFlowProcess.h" - #include "MeshLib/Elements/Utils.h" namespace ProcessLib diff --git a/ProcessLib/TES/TESProcess.cpp b/ProcessLib/TES/TESProcess.cpp index aa10eb083b7..b6bfb20ff78 100644 --- a/ProcessLib/TES/TESProcess.cpp +++ b/ProcessLib/TES/TESProcess.cpp @@ -155,10 +155,9 @@ void TESProcess::initializeConcreteProcess( void TESProcess::initializeSecondaryVariables() { // adds a secondary variables to the collection of all secondary variables. - auto add2nd = [&](std::string const& var_name, - SecondaryVariableFunctions&& fcts) { - _secondary_variables.addSecondaryVariable(var_name, std::move(fcts)); - }; + auto add2nd = + [&](std::string const& var_name, SecondaryVariableFunctions&& fcts) + { _secondary_variables.addSecondaryVariable(var_name, std::move(fcts)); }; // creates an extrapolator auto makeEx = @@ -169,7 +168,8 @@ void TESProcess::initializeSecondaryVariables() std::vector< NumLib::LocalToGlobalIndexMap const*> const& /*dof_table*/, std::vector<double>& /*cache*/) - const) -> SecondaryVariableFunctions { + const) -> SecondaryVariableFunctions + { return ProcessLib::makeExtrapolator(n_components, getExtrapolator(), _local_assemblers, method); }; @@ -284,8 +284,9 @@ NumLib::IterationResult TESProcess::postIterationConcreteProcess( MathLib::LinAlg::setLocalAccessibleVector(*_x_previous_timestep); - auto check_variable_bounds = [&](std::size_t id, - TESLocalAssemblerInterface& loc_asm) { + auto check_variable_bounds = + [&](std::size_t id, TESLocalAssemblerInterface& loc_asm) + { auto const r_c_indices = NumLib::getRowColumnIndices( id, *this->_local_to_global_index_map, indices_cache); local_x_cache = x.get(r_c_indices.rows); diff --git a/ProcessLib/TES/TESReactionAdaptor.cpp b/ProcessLib/TES/TESReactionAdaptor.cpp index e1c65999d7c..69a646338d2 100644 --- a/ProcessLib/TES/TESReactionAdaptor.cpp +++ b/ProcessLib/TES/TESReactionAdaptor.cpp @@ -162,7 +162,8 @@ TESFEMReactionAdaptorAdsorption::initReaction_slowDownUndershootStrategy( double TESFEMReactionAdaptorAdsorption::estimateAdsorptionEquilibrium( const double p_V0, const double C0) const { - auto f = [this, p_V0, C0](double pV) -> double { + auto f = [this, p_V0, C0](double pV) -> double + { // pV0 := _p_V const double C_eq = _d.ap.react_sys->getEquilibriumLoading(pV, _d.T, _d.ap.M_react); @@ -310,7 +311,8 @@ TESFEMReactionAdaptorCaOH2::TESFEMReactionAdaptorCaOH2( auto f = [this](const double /*t*/, MathLib::ODE::MappedConstVector<1> const y, MathLib::ODE::MappedVector<1> - ydot) -> bool { + ydot) -> bool + { ydot[0] = _react.getReactionRate(y[0]); return true; }; diff --git a/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.cpp b/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.cpp index cf5277400bd..60df8711123 100644 --- a/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.cpp +++ b/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.cpp @@ -141,7 +141,8 @@ void ThermoMechanicsProcess<DisplacementDim>::initializeConcreteProcess( auto add_secondary_variable = [&](std::string const& name, int const num_components, - auto get_ip_values_function) { + auto get_ip_values_function) + { _secondary_variables.addSecondaryVariable( name, makeExtrapolator(num_components, getExtrapolator(), @@ -324,7 +325,8 @@ void ThermoMechanicsProcess<DisplacementDim>:: dxdot_dx, dx_dx, process_id, M, K, b, Jac); // TODO (naumov): Refactor the copy rhs part. This is copy from HM. - auto copyRhs = [&](int const variable_id, auto& output_vector) { + auto copyRhs = [&](int const variable_id, auto& output_vector) + { if (_use_monolithic_scheme) { transformVariableFromGlobalVector(b, variable_id, dof_tables[0], diff --git a/ProcessLib/ThermoRichardsFlow/CreateSimplifiedElasticityModel.cpp b/ProcessLib/ThermoRichardsFlow/CreateSimplifiedElasticityModel.cpp index 0e9594f3a26..9e760f09d4c 100644 --- a/ProcessLib/ThermoRichardsFlow/CreateSimplifiedElasticityModel.cpp +++ b/ProcessLib/ThermoRichardsFlow/CreateSimplifiedElasticityModel.cpp @@ -14,9 +14,9 @@ #include "BaseLib/ConfigTree.h" #include "BaseLib/Logging.h" -#include "SimplifiedElasticityModel.h" #include "HydrostaticElasticityModel.h" #include "RigidElasticityModel.h" +#include "SimplifiedElasticityModel.h" #include "UniaxialElasticityModel.h" #include "UserDefinedElasticityModel.h" diff --git a/ProcessLib/ThermoRichardsFlow/CreateThermoRichardsFlowProcess.cpp b/ProcessLib/ThermoRichardsFlow/CreateThermoRichardsFlowProcess.cpp index 8403fb41ce9..7def25250a9 100644 --- a/ProcessLib/ThermoRichardsFlow/CreateThermoRichardsFlowProcess.cpp +++ b/ProcessLib/ThermoRichardsFlow/CreateThermoRichardsFlowProcess.cpp @@ -34,16 +34,15 @@ void checkMPLProperties( std::map<int, std::shared_ptr<MaterialPropertyLib::Medium>> const& media) { std::array const required_medium_properties = { - MaterialPropertyLib::permeability, - MaterialPropertyLib::porosity, MaterialPropertyLib::biot_coefficient, + MaterialPropertyLib::permeability, MaterialPropertyLib::porosity, + MaterialPropertyLib::biot_coefficient, MaterialPropertyLib::relative_permeability, MaterialPropertyLib::saturation}; std::array const required_liquid_properties = { MaterialPropertyLib::viscosity, MaterialPropertyLib::density, }; - std::array const required_solid_properties = { - MaterialPropertyLib::density}; + std::array const required_solid_properties = {MaterialPropertyLib::density}; // Thermal properties are not checked because they can be phase property or // meduim property (will be enabled later). @@ -146,15 +145,16 @@ std::unique_ptr<Process> createThermoRichardsFlowProcess( checkMPLProperties(media); DBUG("Media properties verified."); - //! \ogs_file_param{prj__processes__process__THERMO_RICHARDS_FLOW__mass_lumping} - bool const mass_lumping = config.getConfigParameter<bool>("mass_lumping", false); + bool const mass_lumping = + //! \ogs_file_param{prj__processes__process__THERMO_RICHARDS_FLOW__mass_lumping} + config.getConfigParameter<bool>("mass_lumping", false); std::unique_ptr<SimplifiedElasticityModel> simplified_elasticity = createElasticityModel(config); ThermoRichardsFlowProcessData process_data{ - std::move(media_map), std::move(specific_body_force), - mass_lumping, std::move(simplified_elasticity)}; + std::move(media_map), std::move(specific_body_force), mass_lumping, + std::move(simplified_elasticity)}; SecondaryVariableCollection secondary_variables; diff --git a/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowProcess.cpp b/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowProcess.cpp index 1e92b9a546f..dd5d84523ad 100644 --- a/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowProcess.cpp +++ b/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowProcess.cpp @@ -78,7 +78,8 @@ void ThermoRichardsFlowProcess::initializeConcreteProcess( auto add_secondary_variable = [&](std::string const& name, int const num_components, - auto get_ip_values_function) { + auto get_ip_values_function) + { _secondary_variables.addSecondaryVariable( name, makeExtrapolator(num_components, getExtrapolator(), @@ -178,8 +179,7 @@ void ThermoRichardsFlowProcess::setInitialConditionsConcreteProcess( } void ThermoRichardsFlowProcess::assembleConcreteProcess( - const double t, double const dt, - std::vector<GlobalVector*> const& x, + const double t, double const dt, std::vector<GlobalVector*> const& x, std::vector<GlobalVector*> const& xdot, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { @@ -217,7 +217,8 @@ void ThermoRichardsFlowProcess::assembleWithJacobianConcreteProcess( _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x, xdot, dxdot_dx, dx_dx, process_id, M, K, b, Jac); - auto copyRhs = [&](int const variable_id, auto& output_vector) { + auto copyRhs = [&](int const variable_id, auto& output_vector) + { transformVariableFromGlobalVector(b, variable_id, dof_tables[0], output_vector, std::negate<double>()); }; @@ -264,18 +265,15 @@ void ThermoRichardsFlowProcess::computeSecondaryVariableConcrete( pv.getActiveElementIDs(), dof_tables, t, dt, x, x_dot, process_id); } - std::vector<NumLib::LocalToGlobalIndexMap const*> -ThermoRichardsFlowProcess::getDOFTables( - int const number_of_processes) const +ThermoRichardsFlowProcess::getDOFTables(int const number_of_processes) const { std::vector<NumLib::LocalToGlobalIndexMap const*> dof_tables; dof_tables.reserve(number_of_processes); std::generate_n(std::back_inserter(dof_tables), number_of_processes, - [&]() { return _local_to_global_index_map.get(); }); + [&]() { return _local_to_global_index_map.get(); }); return dof_tables; } - } // namespace ThermoRichardsFlow } // namespace ProcessLib diff --git a/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoMaterialProperties.cpp b/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoMaterialProperties.cpp index 283b1813438..7a22ddd7695 100644 --- a/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoMaterialProperties.cpp +++ b/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoMaterialProperties.cpp @@ -188,16 +188,17 @@ bool TwoPhaseFlowWithPrhoMaterialProperties::computeConstitutiveRelation( LocalJacobianMatrix J_loc; Eigen::PartialPivLU<LocalJacobianMatrix> linear_solver(2); - auto const update_residual = [&](LocalResidualVector& residual) { - calculateResidual(material_id, pg, X, T, Sw, X_m, residual); - }; + auto const update_residual = [&](LocalResidualVector& residual) + { calculateResidual(material_id, pg, X, T, Sw, X_m, residual); }; - auto const update_jacobian = [&](LocalJacobianMatrix& jacobian) { + auto const update_jacobian = [&](LocalJacobianMatrix& jacobian) + { calculateJacobian(material_id, t, x, pg, X, T, jacobian, Sw, X_m); // for solution dependent Jacobians }; - auto const update_solution = [&](LocalUnknownVector const& increment) { + auto const update_solution = [&](LocalUnknownVector const& increment) + { // increment solution vectors Sw += increment[0]; X_m += increment[1]; diff --git a/ProcessLib/Utils/ProcessUtils.cpp b/ProcessLib/Utils/ProcessUtils.cpp index 936bb96b09a..8c89c9bafe2 100644 --- a/ProcessLib/Utils/ProcessUtils.cpp +++ b/ProcessLib/Utils/ProcessUtils.cpp @@ -21,9 +21,8 @@ ProcessLib::ProcessVariable& findVariableByName( { // Find corresponding variable by name. auto variable = std::find_if(variables.cbegin(), variables.cend(), - [&name](ProcessLib::ProcessVariable const& v) { - return v.getName() == name; - }); + [&name](ProcessLib::ProcessVariable const& v) + { return v.getName() == name; }); if (variable == variables.end()) { diff --git a/ProcessLib/VectorMatrixAssembler.cpp b/ProcessLib/VectorMatrixAssembler.cpp index 91810975a4c..874fe95e633 100644 --- a/ProcessLib/VectorMatrixAssembler.cpp +++ b/ProcessLib/VectorMatrixAssembler.cpp @@ -49,9 +49,9 @@ void VectorMatrixAssembler::assemble( std::vector<std::vector<GlobalIndexType>> indices_of_processes; indices_of_processes.reserve(dof_tables.size()); transform(cbegin(dof_tables), cend(dof_tables), - back_inserter(indices_of_processes), [&](auto const& dof_table) { - return NumLib::getIndices(mesh_item_id, dof_table); - }); + back_inserter(indices_of_processes), + [&](auto const& dof_table) + { return NumLib::getIndices(mesh_item_id, dof_table); }); auto const& indices = indices_of_processes[process_id]; _local_M_data.clear(); @@ -115,9 +115,9 @@ void VectorMatrixAssembler::assembleWithJacobian( std::vector<std::vector<GlobalIndexType>> indices_of_processes; indices_of_processes.reserve(dof_tables.size()); transform(cbegin(dof_tables), cend(dof_tables), - back_inserter(indices_of_processes), [&](auto const& dof_table) { - return NumLib::getIndices(mesh_item_id, dof_table); - }); + back_inserter(indices_of_processes), + [&](auto const& dof_table) + { return NumLib::getIndices(mesh_item_id, dof_table); }); auto const& indices = indices_of_processes[process_id]; -- GitLab