Skip to content

Commit

Permalink
Merge branch 'GetSubsetForAvailableComponentIDs' into 'master'
Browse files Browse the repository at this point in the history
[MeshComponentMap] Don't loop over all available component ids

See merge request ogs/ogs!5107
  • Loading branch information
wenqing committed Sep 23, 2024
2 parents 1d84dcd + 6978e0a commit bb92bc6
Show file tree
Hide file tree
Showing 12 changed files with 16,440 additions and 65 deletions.
8 changes: 4 additions & 4 deletions NumLib/DOF/LocalToGlobalIndexMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ LocalToGlobalIndexMap::deriveBoundaryConstrainedMap(
[&](auto const component_id)
{ return getGlobalComponent(variable_id, component_id); });

auto mesh_component_map = _mesh_component_map.getSubset(
_mesh_subsets, new_mesh_subset, global_component_ids);
auto mesh_component_map =
_mesh_component_map.getSubset(_mesh_subsets, new_mesh_subset);

// Create copies of the new_mesh_subset for each of the global components.
// The last component is moved after the for-loop.
Expand Down Expand Up @@ -294,8 +294,8 @@ LocalToGlobalIndexMap::deriveBoundaryConstrainedMap(
std::vector<MeshLib::Element*> const& elements =
new_mesh_subset.getMesh().getElements();

auto mesh_component_map = _mesh_component_map.getSubset(
_mesh_subsets, new_mesh_subset, global_component_ids);
auto mesh_component_map =
_mesh_component_map.getSubset(_mesh_subsets, new_mesh_subset);

// Create copies of the new_mesh_subset for each of the global components.
// The last component is moved after the for-loop.
Expand Down
5 changes: 2 additions & 3 deletions NumLib/DOF/MeshComponentMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ MeshComponentMap::MeshComponentMap(

MeshComponentMap MeshComponentMap::getSubset(
std::vector<MeshLib::MeshSubset> const& bulk_mesh_subsets,
MeshLib::MeshSubset const& new_mesh_subset,
std::vector<int> const& new_global_component_ids) const
MeshLib::MeshSubset const& new_mesh_subset) const
{
{ // Testing first an assumption met later in the code that the meshes for
// all the bulk_mesh_subsets are equal.
Expand Down Expand Up @@ -107,7 +106,7 @@ MeshComponentMap MeshComponentMap::getSubset(
bulk_mesh_subsets.front().getMeshID(), MeshLib::MeshItemType::Node,
bulk_node_ids_map[node_id]};

for (auto component_id : new_global_component_ids)
for (auto component_id : getComponentIDs(bulk_location))
{
auto const global_index =
getGlobalIndex(bulk_location, component_id);
Expand Down
5 changes: 1 addition & 4 deletions NumLib/DOF/MeshComponentMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,9 @@ class MeshComponentMap final
/// subset, one for each global component.
/// \param new_mesh_subset The constraining mesh subset with a mapping of
/// node ids to the bulk mesh nodes.
/// \param new_global_component_ids The components for which the
/// bulk_mesh_subsets should be intersected with the new_mesh_subset.
MeshComponentMap getSubset(
std::vector<MeshLib::MeshSubset> const& bulk_mesh_subsets,
MeshLib::MeshSubset const& new_mesh_subset,
std::vector<int> const& new_global_component_ids) const;
MeshLib::MeshSubset const& new_mesh_subset) const;

/// The number of dofs including the those located in the ghost nodes.
std::size_t dofSizeWithGhosts() const { return _dict.size(); }
Expand Down
18 changes: 18 additions & 0 deletions ProcessLib/HeatTransportBHE/Tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,24 @@ AddTest(
3D_2U_BHE_ts_10_t_600.000000.vtu 3D_2U_BHE_ts_10_t_600.000000.vtu temperature_soil temperature_soil 1e-12 1e-13
)

AddTest(
NAME HeatTransportBHE_3D_3BHEs
PATH Parabolic/T/3D_3BHEs
RUNTIME 14
EXECUTABLE ogs
EXECUTABLE_ARGS 3bhes.prj
WRAPPER time
TESTER vtkdiff
REQUIREMENTS NOT OGS_USE_MPI
DIFF_DATA
3bhes_ts_10_t_600.000000.vtu 3bhes_ts_10_t_600.000000.vtu temperature_BHE1 temperature_BHE1 0 1e-12
3bhes_ts_10_t_600.000000.vtu 3bhes_ts_10_t_600.000000.vtu temperature_BHE2 temperature_BHE2 0 1e-12
3bhes_ts_10_t_600.000000.vtu 3bhes_ts_10_t_600.000000.vtu temperature_BHE3 temperature_BHE3 0 1e-12
3bhes_ts_10_t_600.000000.vtu 3bhes_ts_10_t_600.000000.vtu temperature_soil temperature_soil 0 1e-12
3bhes_1_ts_10_t_600.000000.vtu 3bhes_1_ts_10_t_600.000000.vtu temperature_BHE1 temperature_BHE1 2e-13 1e-12
3bhes_1_ts_10_t_600.000000.vtu 3bhes_1U_BHE_1_mesh_ts_10_t_600.000000.vtu temperature_BHE1 temperature_BHE1 2e-13 1e-12
)

AddTest(
NAME HeatTransportBHE_3D_BHE_groundwater_advection
PATH Parabolic/T/3D_BHE_GW_advection
Expand Down
43 changes: 43 additions & 0 deletions Tests/Data/Parabolic/T/3D_3BHEs/3bhes.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="OpenGeoSysGLI.xsl"?>

<OpenGeoSysGLI xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.opengeosys.org/images/xsd/OpenGeoSysGLI.xsd" xmlns:ogs="http://www.opengeosys.org">
<name>3bhes</name>
<points>
<point id="0" x="-25.0" y="0.0" z="0.0" name="TOP_left_down"/>
<point id="1" x="-25.0" y="50.0" z="0.0" name="TOP_left_upper"/>
<point id="2" x="25.0" y="50.0" z="0.0" name="TOP_right_upper"/>
<point id="3" x="25.0" y="0.0" z="0.0" name="TOP_right_down"/>
<point id="4" x="-25.0" y="0.0" z="-72.0" name="bottom_left_down"/>
<point id="5" x="-25.0" y="50.0" z="-72.0" name="bottom_left_upper"/>
<point id="6" x="25.0" y="50.0" z="-72.0" name="bottom_right_uppert"/>
<point id="7" x="25.0" y="0.0" z="-72.0" name="bottom_right_down"/>

<point id="8" x="-6.0" y="25.0" z="-52.0" name="BHE1_BOTTOM"/>
<point id="9" x="-6.0" y="25.0" z="-2.0" name="BHE1_TOP"/>
<point id="10" x="0.0" y="25.0" z="-52.0" name="BHE2_BOTTOM"/>
<point id="11" x="0.0" y="25.0" z="-2.0" name="BHE2_TOP"/>
<point id="12" x="6.0" y="25.0" z="-52.0" name="BHE3_BOTTOM"/>
<point id="13" x="6.0" y="25.0" z="-2.0" name="BHE3_TOP"/>
</points>
<polylines>
<polyline id="0" name="BHE_1">
<pnt>9</pnt>
<pnt>8</pnt>
</polyline>
<polyline id="1" name="BHE_2">
<pnt>11</pnt>
<pnt>10</pnt>
</polyline>
<polyline id="2" name="BHE_3">
<pnt>13</pnt>
<pnt>12</pnt>
</polyline>
</polylines>
<surfaces>
<surface id="0" name="top">
<element p1="0" p2="1" p3="2"/>
<element p1="0" p2="3" p3="2"/>
</surface>
</surfaces>
</OpenGeoSysGLI>
Loading

0 comments on commit bb92bc6

Please sign in to comment.