From b142baf8e5978be3e4ebae6f59b86f3f95939c59 Mon Sep 17 00:00:00 2001 From: Thomas Fischer <thomas.fischer@ufz.de> Date: Mon, 27 Jul 2020 15:43:16 +0200 Subject: [PATCH] [NL] LocalToGlobalIndexMap: Rename for readability. Rename a the method from getNumberOfComponents() to getNumberOfGlobalComponents() in class LocalToGlobalIndexMap. --- Applications/ApplicationsLib/ProjectData.cpp | 2 +- .../Utils/MeshEdit/UnityPreprocessing.cpp | 4 ++-- .../PartitionMesh/NodeWiseMeshPartitioner.cpp | 10 ++++----- .../PorousMedium/Permeability/Permeability.h | 5 +++-- .../Permeability/createPermeabilityModel.cpp | 14 +++++++------ MeshLib/MeshEditing/ConvertToLinearMesh.cpp | 2 +- MeshLib/MeshSurfaceExtraction.cpp | 2 +- MeshLib/Properties-impl.h | 10 ++++----- MeshLib/PropertyVector.h | 6 +++--- MeshLib/Vtk/VtkMappedMeshSource.cpp | 2 +- NumLib/DOF/ComputeSparsityPattern.cpp | 4 ++-- NumLib/DOF/DOFTableUtil.cpp | 4 ++-- NumLib/DOF/LocalToGlobalIndexMap.cpp | 6 +++--- NumLib/DOF/LocalToGlobalIndexMap.h | 2 +- .../LocalLinearLeastSquaresExtrapolator.cpp | 2 +- ...ConvergenceCriterionPerComponentDeltaX.cpp | 2 +- ...nvergenceCriterionPerComponentResidual.cpp | 2 +- ParameterLib/ConstantParameter.h | 4 ++-- ParameterLib/CoordinateSystem.cpp | 10 ++++----- ParameterLib/CurveScaledParameter.h | 6 +++--- ParameterLib/FunctionParameter.h | 4 ++-- ParameterLib/GroupBasedParameter.h | 2 +- ParameterLib/MeshElementParameter.h | 8 +++---- ParameterLib/MeshNodeParameter.h | 8 +++---- ParameterLib/Parameter.h | 4 ++-- .../TimeDependentHeterogeneousParameter.cpp | 9 ++++---- .../TimeDependentHeterogeneousParameter.h | 4 ++-- ParameterLib/Utils.h | 5 +++-- .../PythonBoundaryConditionLocalAssembler.h | 2 +- .../ComponentTransportProcess.cpp | 4 ++-- .../CreateComponentTransportProcess.cpp | 4 ++-- .../CreateHydroMechanicsProcess.cpp | 8 +++---- .../HydroMechanics/HydroMechanicsProcess.cpp | 16 +++++++------- ProcessLib/LIE/Common/PostUtils.cpp | 9 ++++---- .../CreateHydroMechanicsProcess.cpp | 4 ++-- .../HydroMechanics/HydroMechanicsProcess.cpp | 2 +- .../CreateSmallDeformationProcess.cpp | 4 ++-- ProcessLib/Output/ProcessOutput.cpp | 4 ++-- .../PhaseField/CreatePhaseFieldProcess.cpp | 8 +++---- ProcessLib/Process.cpp | 19 +++++++++-------- ProcessLib/ProcessVariable.h | 2 +- .../CreateRichardsMechanicsProcess.cpp | 8 +++---- .../RichardsMechanicsProcess.cpp | 16 +++++++------- .../CreateSmallDeformationProcess.cpp | 4 ++-- .../SmallDeformationProcess.cpp | 5 +++-- .../CreateSmallDeformationNonlocalProcess.cpp | 4 ++-- .../SmallDeformationNonlocalProcess.cpp | 7 ++++--- .../Python/PythonSourceTermLocalAssembler.h | 2 +- ProcessLib/SurfaceFlux/SurfaceFluxData.h | 10 +++++---- .../SurfaceFlux/SurfaceFluxLocalAssembler.h | 4 ++-- .../CreateThermoHydroMechanicsProcess.cpp | 12 +++++------ .../ThermoHydroMechanicsProcess.cpp | 11 +++++----- ...reateThermoMechanicalPhaseFieldProcess.cpp | 12 +++++------ .../CreateThermoMechanicsProcess.cpp | 8 +++---- .../ThermoMechanicsProcess.cpp | 5 +++-- Tests/MeshLib/MeshProperties.cpp | 9 ++++---- Tests/MeshLib/TestVtkMappedMeshSource.cpp | 16 +++++++------- Tests/NumLib/LocalToGlobalIndexMap.cpp | 8 +++---- .../LocalToGlobalIndexMapMultiComponent.cpp | 21 ++++++++++--------- 59 files changed, 205 insertions(+), 186 deletions(-) diff --git a/Applications/ApplicationsLib/ProjectData.cpp b/Applications/ApplicationsLib/ProjectData.cpp index 38684db5536..5e45b588975 100644 --- a/Applications/ApplicationsLib/ProjectData.cpp +++ b/Applications/ApplicationsLib/ProjectData.cpp @@ -221,7 +221,7 @@ boost::optional<ParameterLib::CoordinateSystem> parseLocalCoordinateSystem( *config, //! \ogs_file_param_special{prj__local_coordinate_system__basis_vector_0} "basis_vector_0", parameters, 0 /* any dimension */); - int const dimension = basis_vector_0.getNumberOfComponents(); + int const dimension = basis_vector_0.getNumberOfGlobalComponents(); // check dimension if (dimension != 2 && dimension != 3) diff --git a/Applications/Utils/MeshEdit/UnityPreprocessing.cpp b/Applications/Utils/MeshEdit/UnityPreprocessing.cpp index 9700ffeb354..2e92f8e67f0 100644 --- a/Applications/Utils/MeshEdit/UnityPreprocessing.cpp +++ b/Applications/Utils/MeshEdit/UnityPreprocessing.cpp @@ -58,7 +58,7 @@ void fillPropVec(MeshLib::PropertyVector<T> const& property, std::vector<std::vector<std::size_t>> const& node_map, std::size_t const total_nodes) { - assert(property.getNumberOfComponents() == 1); + assert(property.getNumberOfGlobalComponents() == 1); MeshLib::PropertyVector<T>* new_property = new_props.createNewPropertyVector<T>(property.getPropertyName(), MeshLib::MeshItemType::Node, 1); @@ -103,7 +103,7 @@ MeshLib::Properties constructProperties( Properties new_properties; for (auto [name, property] : properties) { - if (property->getNumberOfComponents() != 1) + if (property->getNumberOfGlobalComponents() != 1) { INFO("Ignoring array '{:s}' (more than one component).", name); continue; diff --git a/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp b/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp index a0786362f27..fc9a80b8a62 100644 --- a/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp +++ b/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp @@ -337,7 +337,7 @@ std::size_t copyNodePropertyVectorValues( { auto const& nodes = p.nodes; auto const nnodes = nodes.size(); - auto const n_components = pv.getNumberOfComponents(); + auto const n_components = pv.getNumberOfGlobalComponents(); for (std::size_t i = 0; i < nnodes; ++i) { const auto global_id = nodes[i]->getID(); @@ -358,7 +358,7 @@ std::size_t copyCellPropertyVectorValues( MeshLib::PropertyVector<T>& partitioned_pv) { std::size_t const n_regular(p.regular_elements.size()); - auto const n_components = pv.getNumberOfComponents(); + auto const n_components = pv.getNumberOfGlobalComponents(); for (std::size_t i = 0; i < n_regular; ++i) { const auto id = p.regular_elements[i]->getID(); @@ -398,9 +398,9 @@ bool copyPropertyVector( auto partitioned_pv = partitioned_properties.createNewPropertyVector<T>( pv->getPropertyName(), pv->getMeshItemType(), - pv->getNumberOfComponents()); + pv->getNumberOfGlobalComponents()); partitioned_pv->resize(total_number_of_tuples.at(item_type) * - pv->getNumberOfComponents()); + pv->getNumberOfGlobalComponents()); auto copy_property_vector_values = [&](Partition const& p, std::size_t offset) { @@ -729,7 +729,7 @@ bool writePropertyVectorBinary(MeshLib::PropertyVector<T> const* const pv, MeshLib::IO::PropertyVectorMetaData pvmd; pvmd.property_name = pv->getPropertyName(); pvmd.fillPropertyVectorMetaDataTypeInfo<T>(); - pvmd.number_of_components = pv->getNumberOfComponents(); + pvmd.number_of_components = pv->getNumberOfGlobalComponents(); pvmd.number_of_tuples = pv->getNumberOfTuples(); writePropertyVectorValuesBinary(out_val, *pv); MeshLib::IO::writePropertyVectorMetaDataBinary(out_meta, pvmd); diff --git a/MaterialLib/PorousMedium/Permeability/Permeability.h b/MaterialLib/PorousMedium/Permeability/Permeability.h index 612e89bcd09..62330bbd2a9 100644 --- a/MaterialLib/PorousMedium/Permeability/Permeability.h +++ b/MaterialLib/PorousMedium/Permeability/Permeability.h @@ -29,13 +29,14 @@ public: int const dimension) : _permeability_parameter(permeability_parameter), _dimension(dimension) { - if (permeability_parameter.getNumberOfComponents() != + if (permeability_parameter.getNumberOfGlobalComponents() != _dimension * _dimension) { OGS_FATAL( "The given parameter has {:d} components, but the permeability " "tensor is defined for a {:d} dimensional problem.", - permeability_parameter.getNumberOfComponents(), _dimension); + permeability_parameter.getNumberOfGlobalComponents(), + _dimension); } } diff --git a/MaterialLib/PorousMedium/Permeability/createPermeabilityModel.cpp b/MaterialLib/PorousMedium/Permeability/createPermeabilityModel.cpp index 88e11635865..1c34f657285 100644 --- a/MaterialLib/PorousMedium/Permeability/createPermeabilityModel.cpp +++ b/MaterialLib/PorousMedium/Permeability/createPermeabilityModel.cpp @@ -43,14 +43,15 @@ std::unique_ptr<Permeability> createPermeabilityModel( "permeability_tensor_entries", parameters, 0); int dimension = static_cast<int>( - std::sqrt(permeability_parameter.getNumberOfComponents())); - if (permeability_parameter.getNumberOfComponents() != + std::sqrt(permeability_parameter.getNumberOfGlobalComponents())); + if (permeability_parameter.getNumberOfGlobalComponents() != dimension * dimension) { OGS_FATAL( "The given parameter has {:d} components, but the permeability " "tensor is defined for a {:d} dimensional problem.", - permeability_parameter.getNumberOfComponents(), dimension); + permeability_parameter.getNumberOfGlobalComponents(), + dimension); } return std::make_unique<Permeability>( @@ -66,14 +67,15 @@ std::unique_ptr<Permeability> createPermeabilityModel( "permeability_tensor_entries", parameters, 0); int dimension = static_cast<int>( - std::sqrt(permeability_parameter.getNumberOfComponents())); - if (permeability_parameter.getNumberOfComponents() != + std::sqrt(permeability_parameter.getNumberOfGlobalComponents())); + if (permeability_parameter.getNumberOfGlobalComponents() != dimension * dimension) { OGS_FATAL( "The given parameter has {:d} components, but the permeability " "tensor is defined for a {:d} dimensional problem.", - permeability_parameter.getNumberOfComponents(), dimension); + permeability_parameter.getNumberOfGlobalComponents(), + dimension); } return std::make_unique<DupuitPermeability>(permeability_parameter, diff --git a/MeshLib/MeshEditing/ConvertToLinearMesh.cpp b/MeshLib/MeshEditing/ConvertToLinearMesh.cpp index 2637d29e313..6df78cfd0f6 100644 --- a/MeshLib/MeshEditing/ConvertToLinearMesh.cpp +++ b/MeshLib/MeshEditing/ConvertToLinearMesh.cpp @@ -115,7 +115,7 @@ std::unique_ptr<MeshLib::Mesh> convertToLinearMesh( { continue; } - auto const n_src_comp = double_property->getNumberOfComponents(); + auto const n_src_comp = double_property->getNumberOfGlobalComponents(); auto new_prop = new_mesh->getProperties().createNewPropertyVector<double>( name, MeshLib::MeshItemType::Node, n_src_comp); diff --git a/MeshLib/MeshSurfaceExtraction.cpp b/MeshLib/MeshSurfaceExtraction.cpp index ea5797f5de5..fea2a63c8d4 100644 --- a/MeshLib/MeshSurfaceExtraction.cpp +++ b/MeshLib/MeshSurfaceExtraction.cpp @@ -34,7 +34,7 @@ void processPropertyVector(MeshLib::PropertyVector<T> const& property, std::vector<std::size_t> const& id_map, MeshLib::Mesh& sfc_mesh) { - auto const number_of_components = property.getNumberOfComponents(); + auto const number_of_components = property.getNumberOfGlobalComponents(); auto sfc_prop = getOrCreateMeshProperty<T>( sfc_mesh, property.getPropertyName(), property.getMeshItemType(), diff --git a/MeshLib/Properties-impl.h b/MeshLib/Properties-impl.h index c1ad9e8ac29..df40fcbdf51 100644 --- a/MeshLib/Properties-impl.h +++ b/MeshLib/Properties-impl.h @@ -108,7 +108,7 @@ bool Properties::existsPropertyVector(std::string const& name, { return false; } - if (property->getNumberOfComponents() != number_of_components) + if (property->getNumberOfGlobalComponents() != number_of_components) { return false; } @@ -183,12 +183,12 @@ PropertyVector<T> const* Properties::getPropertyVector( "requested.", name, toString(property->getMeshItemType()), toString(item_type)); } - if (property->getNumberOfComponents() != n_components) + if (property->getNumberOfGlobalComponents() != n_components) { OGS_FATAL( "PropertyVector '{:s}' has {:d} components, {:d} components are " "needed.", - name, property->getNumberOfComponents(), n_components); + name, property->getNumberOfGlobalComponents(), n_components); } return property; } @@ -221,12 +221,12 @@ PropertyVector<T>* Properties::getPropertyVector(std::string const& name, "requested.", name, toString(property->getMeshItemType()), toString(item_type)); } - if (property->getNumberOfComponents() != n_components) + if (property->getNumberOfGlobalComponents() != n_components) { OGS_FATAL( "PropertyVector '{:s}' has {:d} components, {:d} components are " "needed.", - name, property->getNumberOfComponents(), n_components); + name, property->getNumberOfGlobalComponents(), n_components); } return property; } diff --git a/MeshLib/PropertyVector.h b/MeshLib/PropertyVector.h index e7563d7d93b..b0817d6efc1 100644 --- a/MeshLib/PropertyVector.h +++ b/MeshLib/PropertyVector.h @@ -30,7 +30,7 @@ public: MeshItemType getMeshItemType() const { return _mesh_item_type; } std::string const& getPropertyName() const { return _property_name; } - int getNumberOfComponents() const { return _n_components; } + int getNumberOfGlobalComponents() const { return _n_components; } protected: PropertyVectorBase(std::string property_name, @@ -68,7 +68,7 @@ public: { assert(component < _n_components); assert(tuple_index < getNumberOfTuples()); - return this->operator[](tuple_index* getNumberOfComponents() + + return this->operator[](tuple_index* getNumberOfGlobalComponents() + component); } @@ -78,7 +78,7 @@ public: { assert(component < _n_components); assert(tuple_index < getNumberOfTuples()); - return this->operator[](tuple_index* getNumberOfComponents() + + return this->operator[](tuple_index* getNumberOfGlobalComponents() + component); } diff --git a/MeshLib/Vtk/VtkMappedMeshSource.cpp b/MeshLib/Vtk/VtkMappedMeshSource.cpp index 29080324452..9bbc45d8a84 100644 --- a/MeshLib/Vtk/VtkMappedMeshSource.cpp +++ b/MeshLib/Vtk/VtkMappedMeshSource.cpp @@ -219,7 +219,7 @@ void VtkMappedMeshSource::addProperty( dataArray->SetArray(const_cast<T*>(property.data()), static_cast<vtkIdType>(property.size()), static_cast<int>(!hasArrayOwnership)); - dataArray->SetNumberOfComponents(property.getNumberOfComponents()); + dataArray->SetNumberOfComponents(property.getNumberOfGlobalComponents()); dataArray->SetName(property.getPropertyName().c_str()); if (property.getMeshItemType() == MeshLib::MeshItemType::Node) diff --git a/NumLib/DOF/ComputeSparsityPattern.cpp b/NumLib/DOF/ComputeSparsityPattern.cpp index fe67cc7f30f..3488a380895 100644 --- a/NumLib/DOF/ComputeSparsityPattern.cpp +++ b/NumLib/DOF/ComputeSparsityPattern.cpp @@ -26,8 +26,8 @@ GlobalSparsityPattern computeSparsityPatternPETSc( auto const& npmesh = *static_cast<MeshLib::NodePartitionedMesh const*>(&mesh); - auto const max_nonzeroes = dof_table.getNumberOfComponents() - * npmesh.getMaximumNConnectedNodesToNode(); + auto const max_nonzeroes = dof_table.getNumberOfGlobalComponents() * + npmesh.getMaximumNConnectedNodesToNode(); // The sparsity pattern is misused here in the sense that it will only // contain a single value. diff --git a/NumLib/DOF/DOFTableUtil.cpp b/NumLib/DOF/DOFTableUtil.cpp index 98cf783fa8f..04f1e9e4f01 100644 --- a/NumLib/DOF/DOFTableUtil.cpp +++ b/NumLib/DOF/DOFTableUtil.cpp @@ -130,7 +130,7 @@ std::vector<GlobalIndexType> getIndices( // Local matrices and vectors will always be ordered by component // no matter what the order of the global matrix is. - for (int c = 0; c < dof_table.getNumberOfComponents(); ++c) + for (int c = 0; c < dof_table.getNumberOfGlobalComponents(); ++c) { auto const& idcs = dof_table(mesh_item_id, c).rows; indices.reserve(indices.size() + idcs.size()); @@ -150,7 +150,7 @@ NumLib::LocalToGlobalIndexMap::RowColumnIndices getRowColumnIndices( // Local matrices and vectors will always be ordered by component, // no matter what the order of the global matrix is. - for (int c = 0; c < dof_table.getNumberOfComponents(); ++c) + for (int c = 0; c < dof_table.getNumberOfGlobalComponents(); ++c) { auto const& idcs = dof_table(id, c).rows; indices.reserve(indices.size() + idcs.size()); diff --git a/NumLib/DOF/LocalToGlobalIndexMap.cpp b/NumLib/DOF/LocalToGlobalIndexMap.cpp index dffd9c1efe1..8644d435817 100644 --- a/NumLib/DOF/LocalToGlobalIndexMap.cpp +++ b/NumLib/DOF/LocalToGlobalIndexMap.cpp @@ -278,7 +278,7 @@ LocalToGlobalIndexMap::deriveBoundaryConstrainedMap( // Create a subset of the current mesh component map. std::vector<int> global_component_ids; - for (int i = 0; i < getNumberOfComponents(); ++i) + for (int i = 0; i < getNumberOfGlobalComponents(); ++i) { global_component_ids.push_back(i); } @@ -327,7 +327,7 @@ int LocalToGlobalIndexMap::getNumberOfVariableComponents(int variable_id) const _variable_component_offsets[variable_id]; } -int LocalToGlobalIndexMap::getNumberOfComponents() const +int LocalToGlobalIndexMap::getNumberOfGlobalComponents() const { return _mesh_subsets.size(); } @@ -454,7 +454,7 @@ std::ostream& operator<<(std::ostream& os, LocalToGlobalIndexMap const& map) for (std::size_t e=0; e<map.size(); ++e) { os << "== e " << e << " ==\n"; - for (int c = 0; c < map.getNumberOfComponents(); ++c) + for (int c = 0; c < map.getNumberOfGlobalComponents(); ++c) { auto const& line = map._rows(e, c); diff --git a/NumLib/DOF/LocalToGlobalIndexMap.h b/NumLib/DOF/LocalToGlobalIndexMap.h index a05df32aab4..60ea873fa2d 100644 --- a/NumLib/DOF/LocalToGlobalIndexMap.h +++ b/NumLib/DOF/LocalToGlobalIndexMap.h @@ -121,7 +121,7 @@ public: int getNumberOfVariableComponents(int variable_id) const; - int getNumberOfComponents() const; + int getNumberOfGlobalComponents() const; RowColumnIndices operator()(std::size_t const mesh_item_id, const int component_id) const; diff --git a/NumLib/Extrapolation/LocalLinearLeastSquaresExtrapolator.cpp b/NumLib/Extrapolation/LocalLinearLeastSquaresExtrapolator.cpp index 9319ed11657..1b260acfce1 100644 --- a/NumLib/Extrapolation/LocalLinearLeastSquaresExtrapolator.cpp +++ b/NumLib/Extrapolation/LocalLinearLeastSquaresExtrapolator.cpp @@ -33,7 +33,7 @@ LocalLinearLeastSquaresExtrapolator::LocalLinearLeastSquaresExtrapolator( * likely too simplistic. You better adapt the extrapolation code from * some more advanced process, like the TES process. */ - if (dof_table.getNumberOfComponents() != 1) + if (dof_table.getNumberOfGlobalComponents() != 1) { OGS_FATAL( "The d.o.f. table passed must be for one variable that has " diff --git a/NumLib/ODESolver/ConvergenceCriterionPerComponentDeltaX.cpp b/NumLib/ODESolver/ConvergenceCriterionPerComponentDeltaX.cpp index 24ed7af779c..0dc492ec55a 100644 --- a/NumLib/ODESolver/ConvergenceCriterionPerComponentDeltaX.cpp +++ b/NumLib/ODESolver/ConvergenceCriterionPerComponentDeltaX.cpp @@ -81,7 +81,7 @@ void ConvergenceCriterionPerComponentDeltaX::setDOFTable( _dof_table = &dof_table; _mesh = &mesh; - if (_dof_table->getNumberOfComponents() != + if (_dof_table->getNumberOfGlobalComponents() != static_cast<int>(_abstols.size())) { OGS_FATAL( diff --git a/NumLib/ODESolver/ConvergenceCriterionPerComponentResidual.cpp b/NumLib/ODESolver/ConvergenceCriterionPerComponentResidual.cpp index d266ec8ec80..e6fcb6929f5 100644 --- a/NumLib/ODESolver/ConvergenceCriterionPerComponentResidual.cpp +++ b/NumLib/ODESolver/ConvergenceCriterionPerComponentResidual.cpp @@ -119,7 +119,7 @@ void ConvergenceCriterionPerComponentResidual::setDOFTable( _dof_table = &dof_table; _mesh = &mesh; - if (_dof_table->getNumberOfComponents() != + if (_dof_table->getNumberOfGlobalComponents() != static_cast<int>(_abstols.size())) { OGS_FATAL( diff --git a/ParameterLib/ConstantParameter.h b/ParameterLib/ConstantParameter.h index 0bd7380f010..349349c48ae 100644 --- a/ParameterLib/ConstantParameter.h +++ b/ParameterLib/ConstantParameter.h @@ -34,7 +34,7 @@ struct ConstantParameter final : public Parameter<T> bool isTimeDependent() const override { return false; } - int getNumberOfComponents() const override + int getNumberOfGlobalComponents() const override { return static_cast<int>(_values.size()); } @@ -55,7 +55,7 @@ struct ConstantParameter final : public Parameter<T> { auto const n_nodes = element.getNumberOfNodes(); Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> result( - n_nodes, getNumberOfComponents()); + n_nodes, getNumberOfGlobalComponents()); // Column vector of values, copied for each node. auto const row_values = diff --git a/ParameterLib/CoordinateSystem.cpp b/ParameterLib/CoordinateSystem.cpp index 510e8172971..1b9d0e548a6 100644 --- a/ParameterLib/CoordinateSystem.cpp +++ b/ParameterLib/CoordinateSystem.cpp @@ -33,8 +33,8 @@ CoordinateSystem::CoordinateSystem(Parameter<double> const& e0, { OGS_FATAL("The parameters for the basis must not be time dependent."); } - if (_base[0]->getNumberOfComponents() != 2 || - _base[1]->getNumberOfComponents() != 2) + if (_base[0]->getNumberOfGlobalComponents() != 2 || + _base[1]->getNumberOfGlobalComponents() != 2) { OGS_FATAL("The parameters for the 2D basis must have two components."); } @@ -61,9 +61,9 @@ CoordinateSystem::CoordinateSystem(Parameter<double> const& e0, { OGS_FATAL("The parameters for the basis must not be time dependent."); } - if (_base[0]->getNumberOfComponents() != 3 || - _base[1]->getNumberOfComponents() != 3 || - _base[2]->getNumberOfComponents() != 3) + if (_base[0]->getNumberOfGlobalComponents() != 3 || + _base[1]->getNumberOfGlobalComponents() != 3 || + _base[2]->getNumberOfGlobalComponents() != 3) { OGS_FATAL( "The parameters for the 3D basis must have three components."); diff --git a/ParameterLib/CurveScaledParameter.h b/ParameterLib/CurveScaledParameter.h index 29d2905d44d..b6fdbaebb07 100644 --- a/ParameterLib/CurveScaledParameter.h +++ b/ParameterLib/CurveScaledParameter.h @@ -39,9 +39,9 @@ struct CurveScaledParameter final : public Parameter<T> ParameterBase::_mesh = _parameter->mesh(); } - int getNumberOfComponents() const override + int getNumberOfGlobalComponents() const override { - return _parameter->getNumberOfComponents(); + return _parameter->getNumberOfGlobalComponents(); } std::vector<T> operator()(double const t, @@ -56,7 +56,7 @@ struct CurveScaledParameter final : public Parameter<T> auto const& tup = (*_parameter)(t, pos); auto const scaling = _curve.getValue(t); - auto const num_comp = _parameter->getNumberOfComponents(); + auto const num_comp = _parameter->getNumberOfGlobalComponents(); std::vector<T> cache(num_comp); for (int c = 0; c < num_comp; ++c) { diff --git a/ParameterLib/FunctionParameter.h b/ParameterLib/FunctionParameter.h index 2dbb884c894..202a255dbc4 100644 --- a/ParameterLib/FunctionParameter.h +++ b/ParameterLib/FunctionParameter.h @@ -101,7 +101,7 @@ struct FunctionParameter final : public Parameter<T> bool isTimeDependent() const override { return true; } - int getNumberOfComponents() const override + int getNumberOfGlobalComponents() const override { return _vec_expression.size(); } @@ -109,7 +109,7 @@ struct FunctionParameter final : public Parameter<T> std::vector<T> operator()(double const t, SpatialPosition const& pos) const override { - std::vector<T> cache(getNumberOfComponents()); + std::vector<T> cache(getNumberOfGlobalComponents()); auto& x = _symbol_table.get_variable("x")->ref(); auto& y = _symbol_table.get_variable("y")->ref(); auto& z = _symbol_table.get_variable("z")->ref(); diff --git a/ParameterLib/GroupBasedParameter.h b/ParameterLib/GroupBasedParameter.h index 833ab79289e..71bf31cdaab 100644 --- a/ParameterLib/GroupBasedParameter.h +++ b/ParameterLib/GroupBasedParameter.h @@ -51,7 +51,7 @@ struct GroupBasedParameter final : public Parameter<T> bool isTimeDependent() const override { return false; } - int getNumberOfComponents() const override + int getNumberOfGlobalComponents() const override { return _vec_values.empty() ? 0 diff --git a/ParameterLib/MeshElementParameter.h b/ParameterLib/MeshElementParameter.h index 19bfb148452..528519fbe5e 100644 --- a/ParameterLib/MeshElementParameter.h +++ b/ParameterLib/MeshElementParameter.h @@ -33,9 +33,9 @@ struct MeshElementParameter final : public Parameter<T> bool isTimeDependent() const override { return false; } - int getNumberOfComponents() const override + int getNumberOfGlobalComponents() const override { - return _property.getNumberOfComponents(); + return _property.getNumberOfGlobalComponents(); } std::vector<T> operator()(double const /*t*/, @@ -48,7 +48,7 @@ struct MeshElementParameter final : public Parameter<T> "Trying to access a MeshElementParameter but the element id is " "not specified."); } - auto const num_comp = _property.getNumberOfComponents(); + auto const num_comp = _property.getNumberOfGlobalComponents(); std::vector<T> cache(num_comp); for (int c = 0; c < num_comp; ++c) { @@ -68,7 +68,7 @@ struct MeshElementParameter final : public Parameter<T> { auto const n_nodes = element.getNumberOfNodes(); Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> result( - n_nodes, getNumberOfComponents()); + n_nodes, getNumberOfGlobalComponents()); // Column vector of values, copied for each node. SpatialPosition x_position; diff --git a/ParameterLib/MeshNodeParameter.h b/ParameterLib/MeshNodeParameter.h index 9d09ef84842..1609fdc1cb4 100644 --- a/ParameterLib/MeshNodeParameter.h +++ b/ParameterLib/MeshNodeParameter.h @@ -37,9 +37,9 @@ struct MeshNodeParameter final : public Parameter<T> bool isTimeDependent() const override { return false; } - int getNumberOfComponents() const override + int getNumberOfGlobalComponents() const override { - return _property.getNumberOfComponents(); + return _property.getNumberOfGlobalComponents(); } std::vector<T> operator()(double const /*t*/, @@ -52,7 +52,7 @@ struct MeshNodeParameter final : public Parameter<T> "Trying to access a MeshNodeParameter but the node id is not " "specified."); } - auto const num_comp = _property.getNumberOfComponents(); + auto const num_comp = _property.getNumberOfGlobalComponents(); std::vector<T> cache(num_comp); for (int c = 0; c < num_comp; ++c) { @@ -72,7 +72,7 @@ struct MeshNodeParameter final : public Parameter<T> { auto const n_nodes = element.getNumberOfNodes(); Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> result( - n_nodes, getNumberOfComponents()); + n_nodes, getNumberOfGlobalComponents()); SpatialPosition x_position; auto const nodes = element.getNodes(); diff --git a/ParameterLib/Parameter.h b/ParameterLib/Parameter.h index f8f4521b7c8..fd302d5f526 100644 --- a/ParameterLib/Parameter.h +++ b/ParameterLib/Parameter.h @@ -146,7 +146,7 @@ struct Parameter : public ParameterBase //! Returns the number of components this Parameter has at every position //! and point in time. - virtual int getNumberOfComponents() const = 0; + virtual int getNumberOfGlobalComponents() const = 0; //! Returns the parameter value at the given time and position. virtual std::vector<T> operator()(double const t, @@ -166,7 +166,7 @@ struct Parameter : public ParameterBase double const t) const { auto const n_nodes = static_cast<int>(element.getNumberOfNodes()); - auto const n_components = getNumberOfComponents(); + auto const n_components = getNumberOfGlobalComponents(); Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> result(n_nodes, n_components); diff --git a/ParameterLib/TimeDependentHeterogeneousParameter.cpp b/ParameterLib/TimeDependentHeterogeneousParameter.cpp index 7c3e3be59d9..a8645bfecd7 100644 --- a/ParameterLib/TimeDependentHeterogeneousParameter.cpp +++ b/ParameterLib/TimeDependentHeterogeneousParameter.cpp @@ -25,9 +25,9 @@ TimeDependentHeterogeneousParameter::TimeDependentHeterogeneousParameter( { } -int TimeDependentHeterogeneousParameter::getNumberOfComponents() const +int TimeDependentHeterogeneousParameter::getNumberOfGlobalComponents() const { - return _time_parameter_mapping[0].second->getNumberOfComponents(); + return _time_parameter_mapping[0].second->getNumberOfGlobalComponents(); } bool TimeDependentHeterogeneousParameter::isTimeDependent() const @@ -89,11 +89,12 @@ void TimeDependentHeterogeneousParameter::initialize( } // check that all parameters have the same number of components - auto const n = _time_parameter_mapping[0].second->getNumberOfComponents(); + auto const n = + _time_parameter_mapping[0].second->getNumberOfGlobalComponents(); if (!std::all_of(_time_parameter_mapping.begin(), _time_parameter_mapping.end(), [n](auto const p) { - return n == p.second->getNumberOfComponents(); + return n == p.second->getNumberOfGlobalComponents(); })) { OGS_FATAL( diff --git a/ParameterLib/TimeDependentHeterogeneousParameter.h b/ParameterLib/TimeDependentHeterogeneousParameter.h index 98e07ac0992..b62cfc22b12 100644 --- a/ParameterLib/TimeDependentHeterogeneousParameter.h +++ b/ParameterLib/TimeDependentHeterogeneousParameter.h @@ -29,8 +29,8 @@ public: std::vector<PairTimeParameterName> time_parameter_name_mapping); - /// @copydoc Parameter::getNumberOfComponents() - int getNumberOfComponents() const override; + /// @copydoc Parameter::getNumberOfGlobalComponents() + int getNumberOfGlobalComponents() const override; bool isTimeDependent() const override; diff --git a/ParameterLib/Utils.h b/ParameterLib/Utils.h index 2243b1466e3..f0d06851d4a 100644 --- a/ParameterLib/Utils.h +++ b/ParameterLib/Utils.h @@ -62,12 +62,13 @@ Parameter<ParameterDataType>* findParameterOptional( } if (num_components != 0 && - parameter->getNumberOfComponents() != num_components) + parameter->getNumberOfGlobalComponents() != num_components) { OGS_FATAL( "The read parameter `{:s}' has the wrong number of components " "({:d} instead of {:d}).", - parameter_name, parameter->getNumberOfComponents(), num_components); + parameter_name, parameter->getNumberOfGlobalComponents(), + num_components); } // Test the parameter's mesh only if there is a "test"-mesh provided. diff --git a/ProcessLib/BoundaryCondition/Python/PythonBoundaryConditionLocalAssembler.h b/ProcessLib/BoundaryCondition/Python/PythonBoundaryConditionLocalAssembler.h index c567a55de2c..07a79b7d89e 100644 --- a/ProcessLib/BoundaryCondition/Python/PythonBoundaryConditionLocalAssembler.h +++ b/ProcessLib/BoundaryCondition/Python/PythonBoundaryConditionLocalAssembler.h @@ -62,7 +62,7 @@ public: auto const num_var = _data.dof_table_bulk.getNumberOfVariables(); auto const num_nodes = Base::_element.getNumberOfNodes(); auto const num_comp_total = - _data.dof_table_bulk.getNumberOfComponents(); + _data.dof_table_bulk.getNumberOfGlobalComponents(); auto const& bulk_node_ids_map = *_data.boundary_mesh.getProperties() diff --git a/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp b/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp index d824b58ebc6..9126416136b 100644 --- a/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp +++ b/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp @@ -264,8 +264,8 @@ void ComponentTransportProcess::extrapolateIntegrationPointValuesToNodes( auto const& int_pt_C = integration_point_values_vectors[transport_process_id]; - extrapolator.extrapolate(pv.getNumberOfComponents(), extrapolatables, t, - {int_pt_C}, + extrapolator.extrapolate(pv.getNumberOfGlobalComponents(), + extrapolatables, t, {int_pt_C}, {_local_to_global_index_map.get()}); auto const& nodal_values = extrapolator.getNodalValues(); diff --git a/ProcessLib/ComponentTransport/CreateComponentTransportProcess.cpp b/ProcessLib/ComponentTransport/CreateComponentTransportProcess.cpp index 2c549d84290..a6e596ea2f2 100644 --- a/ProcessLib/ComponentTransport/CreateComponentTransportProcess.cpp +++ b/ProcessLib/ComponentTransport/CreateComponentTransportProcess.cpp @@ -119,7 +119,7 @@ std::unique_ptr<Process> createComponentTransportProcess( collected_process_variables.cbegin(), collected_process_variables.cend(), [](std::reference_wrapper<ProcessLib::ProcessVariable> const& pv) { - return pv.get().getNumberOfComponents() != 1; + return pv.get().getNumberOfGlobalComponents() != 1; }); if (it != collected_process_variables.end()) @@ -129,7 +129,7 @@ std::unique_ptr<Process> createComponentTransportProcess( "rather " "than {:d}.", it->get().getName(), - it->get().getNumberOfComponents()); + it->get().getNumberOfGlobalComponents()); } // Allocate the collected process variables into a two-dimensional vector, diff --git a/ProcessLib/HydroMechanics/CreateHydroMechanicsProcess.cpp b/ProcessLib/HydroMechanics/CreateHydroMechanicsProcess.cpp index 9bd395f0a4d..ac01b18d22b 100644 --- a/ProcessLib/HydroMechanics/CreateHydroMechanicsProcess.cpp +++ b/ProcessLib/HydroMechanics/CreateHydroMechanicsProcess.cpp @@ -87,25 +87,25 @@ std::unique_ptr<Process> createHydroMechanicsProcess( DBUG("Associate displacement with process variable '{:s}'.", variable_u->getName()); - if (variable_u->getNumberOfComponents() != DisplacementDim) + if (variable_u->getNumberOfGlobalComponents() != DisplacementDim) { OGS_FATAL( "Number of components of the process variable '{:s}' is different " "from the displacement dimension: got {:d}, expected {:d}", variable_u->getName(), - variable_u->getNumberOfComponents(), + variable_u->getNumberOfGlobalComponents(), DisplacementDim); } DBUG("Associate pressure with process variable '{:s}'.", variable_p->getName()); - if (variable_p->getNumberOfComponents() != 1) + if (variable_p->getNumberOfGlobalComponents() != 1) { OGS_FATAL( "Pressure process variable '{:s}' is not a scalar variable but has " "{:d} components.", variable_p->getName(), - variable_p->getNumberOfComponents()); + variable_p->getNumberOfGlobalComponents()); } auto solid_constitutive_relations = diff --git a/ProcessLib/HydroMechanics/HydroMechanicsProcess.cpp b/ProcessLib/HydroMechanics/HydroMechanicsProcess.cpp index b88b97c1d5e..79b20998e98 100644 --- a/ProcessLib/HydroMechanics/HydroMechanicsProcess.cpp +++ b/ProcessLib/HydroMechanics/HydroMechanicsProcess.cpp @@ -145,7 +145,7 @@ void HydroMechanicsProcess<DisplacementDim>::constructDofTable() std::generate_n(std::back_inserter(all_mesh_subsets), getProcessVariables(monolithic_process_id)[1] .get() - .getNumberOfComponents(), + .getNumberOfGlobalComponents(), [&]() { return *_mesh_subset_all_nodes; }); std::vector<int> const vec_n_components{1, DisplacementDim}; @@ -160,10 +160,11 @@ void HydroMechanicsProcess<DisplacementDim>::constructDofTable() // For displacement equation. const int process_id = 1; std::vector<MeshLib::MeshSubset> all_mesh_subsets; - std::generate_n( - std::back_inserter(all_mesh_subsets), - getProcessVariables(process_id)[0].get().getNumberOfComponents(), - [&]() { return *_mesh_subset_all_nodes; }); + std::generate_n(std::back_inserter(all_mesh_subsets), + getProcessVariables(process_id)[0] + .get() + .getNumberOfGlobalComponents(), + [&]() { return *_mesh_subset_all_nodes; }); std::vector<int> const vec_n_components{DisplacementDim}; _local_to_global_index_map = @@ -322,13 +323,14 @@ void HydroMechanicsProcess<DisplacementDim>::initializeConcreteProcess( auto const ip_meta_data = getIntegrationPointMetaData(mesh, name); // Check the number of components. - if (ip_meta_data.n_components != mesh_property.getNumberOfComponents()) + if (ip_meta_data.n_components != + mesh_property.getNumberOfGlobalComponents()) { OGS_FATAL( "Different number of components in meta data ({:d}) than in " "the integration point field data for '{:s}': {:d}.", ip_meta_data.n_components, name, - mesh_property.getNumberOfComponents()); + mesh_property.getNumberOfGlobalComponents()); } // Now we have a properly named vtk's field data array and the diff --git a/ProcessLib/LIE/Common/PostUtils.cpp b/ProcessLib/LIE/Common/PostUtils.cpp index d48be472e7d..fc0efcbc813 100644 --- a/ProcessLib/LIE/Common/PostUtils.cpp +++ b/ProcessLib/LIE/Common/PostUtils.cpp @@ -277,7 +277,7 @@ MeshLib::PropertyVector<T>* PostProcessTool::createProperty( MeshLib::PropertyVector<T> const& property) { auto const item_type = property.getMeshItemType(); - auto const n_src_comp = property.getNumberOfComponents(); + auto const n_src_comp = property.getNumberOfGlobalComponents(); // convert 2D vector to 3D. Otherwise Paraview Calculator filter does // not recognize it as a vector auto const n_dest_comp = (n_src_comp == 2) ? 3 : n_src_comp; @@ -322,8 +322,9 @@ void PostProcessTool::copyPropertyValues( auto const item_type = source_property.getMeshItemType(); if (item_type == MeshLib::MeshItemType::Node) { - auto const n_src_comp = source_property.getNumberOfComponents(); - auto const n_dest_comp = destination_property->getNumberOfComponents(); + auto const n_src_comp = source_property.getNumberOfGlobalComponents(); + auto const n_dest_comp = + destination_property->getNumberOfGlobalComponents(); // copy existing for (unsigned i = 0; i < _org_mesh.getNumberOfNodes(); i++) { @@ -366,7 +367,7 @@ void PostProcessTool::calculateTotalDisplacement(unsigned const n_fractures, { auto const& u = *_output_mesh->getProperties().getPropertyVector<double>( "displacement"); - auto const n_u_comp = u.getNumberOfComponents(); + auto const n_u_comp = u.getNumberOfGlobalComponents(); assert(u.size() == _output_mesh->getNodes().size() * 3); auto& total_u = *_output_mesh->getProperties().createNewPropertyVector<double>( diff --git a/ProcessLib/LIE/HydroMechanics/CreateHydroMechanicsProcess.cpp b/ProcessLib/LIE/HydroMechanics/CreateHydroMechanicsProcess.cpp index 5d5924d5956..ef13d20a80a 100644 --- a/ProcessLib/LIE/HydroMechanics/CreateHydroMechanicsProcess.cpp +++ b/ProcessLib/LIE/HydroMechanics/CreateHydroMechanicsProcess.cpp @@ -86,14 +86,14 @@ std::unique_ptr<Process> createHydroMechanicsProcess( variable->getName(), "process_variable"); if (pv_name.find("displacement") != std::string::npos && - variable->getNumberOfComponents() != GlobalDim) + variable->getNumberOfGlobalComponents() != GlobalDim) { OGS_FATAL( "Number of components of the process variable '{:s}' is " "different " "from the displacement dimension: got {:d}, expected {:d}", variable->getName(), - variable->getNumberOfComponents(), + variable->getNumberOfGlobalComponents(), GlobalDim); } diff --git a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp index 75f2dac295c..b33b4648547 100644 --- a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp +++ b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp @@ -498,7 +498,7 @@ void HydroMechanicsProcess<GlobalDim>::postTimestepConcreteProcess( const int monolithic_process_id = 0; ProcessVariable& pv_g = this->getProcessVariables(monolithic_process_id)[g_variable_id]; - auto const num_comp = pv_g.getNumberOfComponents(); + auto const num_comp = pv_g.getNumberOfGlobalComponents(); auto& mesh_prop_g = *MeshLib::getOrCreateMeshProperty<double>( _mesh, pv_g.getName(), MeshLib::MeshItemType::Node, num_comp); for (int component_id = 0; component_id < num_comp; ++component_id) diff --git a/ProcessLib/LIE/SmallDeformation/CreateSmallDeformationProcess.cpp b/ProcessLib/LIE/SmallDeformation/CreateSmallDeformationProcess.cpp index 994c6d690c1..e5c3e679202 100644 --- a/ProcessLib/LIE/SmallDeformation/CreateSmallDeformationProcess.cpp +++ b/ProcessLib/LIE/SmallDeformation/CreateSmallDeformationProcess.cpp @@ -94,14 +94,14 @@ std::unique_ptr<Process> createSmallDeformationProcess( DBUG("Associate displacement with process variable '{:s}'.", per_process_variables.back().get().getName()); - if (per_process_variables.back().get().getNumberOfComponents() != + if (per_process_variables.back().get().getNumberOfGlobalComponents() != DisplacementDim) { OGS_FATAL( "Number of components of the process variable '{:s}' is different " "from the displacement dimension: got {:d}, expected {:d}", per_process_variables.back().get().getName(), - per_process_variables.back().get().getNumberOfComponents(), + per_process_variables.back().get().getNumberOfGlobalComponents(), DisplacementDim); } std::vector<std::vector<std::reference_wrapper<ProcessVariable>>> diff --git a/ProcessLib/Output/ProcessOutput.cpp b/ProcessLib/Output/ProcessOutput.cpp index 09e5e2c068e..ae067ab9f93 100644 --- a/ProcessLib/Output/ProcessOutput.cpp +++ b/ProcessLib/Output/ProcessOutput.cpp @@ -174,7 +174,7 @@ void addProcessDataToMesh( ++variable_id) { ProcessVariable& pv = process_variables[variable_id]; - int const n_components = pv.getNumberOfComponents(); + int const n_components = pv.getNumberOfGlobalComponents(); // If (number_of_dof_variables==1), the case is either the staggered // scheme being applied or a single PDE being solved. const int sub_meshset_id = @@ -195,7 +195,7 @@ void addProcessDataToMesh( DBUG(" process variable {:s}", pv.getName()); - auto const num_comp = pv.getNumberOfComponents(); + auto const num_comp = pv.getNumberOfGlobalComponents(); auto& output_data = *MeshLib::getOrCreateMeshProperty<double>( mesh, pv.getName(), MeshLib::MeshItemType::Node, num_comp); diff --git a/ProcessLib/PhaseField/CreatePhaseFieldProcess.cpp b/ProcessLib/PhaseField/CreatePhaseFieldProcess.cpp index 0e65b84fe8c..dd5bec442dc 100644 --- a/ProcessLib/PhaseField/CreatePhaseFieldProcess.cpp +++ b/ProcessLib/PhaseField/CreatePhaseFieldProcess.cpp @@ -81,26 +81,26 @@ std::unique_ptr<Process> createPhaseFieldProcess( DBUG("Associate displacement with process variable '{:s}'.", variable_u->getName()); - if (variable_u->getNumberOfComponents() != DisplacementDim) + if (variable_u->getNumberOfGlobalComponents() != DisplacementDim) { OGS_FATAL( "Number of components of the process variable '{:s}' is different " "from the displacement dimension: got {:d}, expected {:d}", variable_u->getName(), - variable_u->getNumberOfComponents(), + variable_u->getNumberOfGlobalComponents(), DisplacementDim); } DBUG("Associate phase field with process variable '{:s}'.", variable_ph->getName()); - if (variable_ph->getNumberOfComponents() != 1) + if (variable_ph->getNumberOfGlobalComponents() != 1) { OGS_FATAL( "Phasefield process variable '{:s}' is not a scalar variable but " "has " "{:d} components.", variable_ph->getName(), - variable_ph->getNumberOfComponents()); + variable_ph->getNumberOfGlobalComponents()); } auto solid_constitutive_relations = diff --git a/ProcessLib/Process.cpp b/ProcessLib/Process.cpp index 6782aeece1e..4322cfde8b9 100644 --- a/ProcessLib/Process.cpp +++ b/ProcessLib/Process.cpp @@ -128,7 +128,7 @@ void Process::setInitialConditions(const int process_id, double const t, auto const& ic = pv.get().getInitialCondition(); - auto const num_comp = pv.get().getNumberOfComponents(); + auto const num_comp = pv.get().getNumberOfGlobalComponents(); for (int component_id = 0; component_id < num_comp; ++component_id) { @@ -262,15 +262,16 @@ void Process::constructMonolithicProcessDofTable() for (ProcessVariable const& pv : _process_variables[0]) { std::generate_n(std::back_inserter(all_mesh_subsets), - pv.getNumberOfComponents(), + pv.getNumberOfGlobalComponents(), [&]() { return *_mesh_subset_all_nodes; }); } // Create a vector of the number of variable components - transform( - cbegin(_process_variables[0]), cend(_process_variables[0]), - back_inserter(vec_var_n_components), - [](ProcessVariable const& pv) { return pv.getNumberOfComponents(); }); + transform(cbegin(_process_variables[0]), cend(_process_variables[0]), + back_inserter(vec_var_n_components), + [](ProcessVariable const& pv) { + return pv.getNumberOfGlobalComponents(); + }); _local_to_global_index_map = std::make_unique<NumLib::LocalToGlobalIndexMap>( @@ -296,13 +297,13 @@ void Process::constructDofTableOfSpecifiedProsessStaggerdScheme( std::generate_n(std::back_inserter(all_mesh_subsets), _process_variables[specified_prosess_id][0] .get() - .getNumberOfComponents(), + .getNumberOfGlobalComponents(), [&]() { return *_mesh_subset_all_nodes; }); // Create a vector of the number of variable components. vec_var_n_components.push_back(_process_variables[specified_prosess_id][0] .get() - .getNumberOfComponents()); + .getNumberOfGlobalComponents()); _local_to_global_index_map = std::make_unique<NumLib::LocalToGlobalIndexMap>( std::move(all_mesh_subsets), vec_var_n_components, @@ -314,7 +315,7 @@ void Process::constructDofTableOfSpecifiedProsessStaggerdScheme( std::tuple<NumLib::LocalToGlobalIndexMap*, bool> Process::getDOFTableForExtrapolatorData() const { - if (_local_to_global_index_map->getNumberOfComponents() == 1) + if (_local_to_global_index_map->getNumberOfGlobalComponents() == 1) { // For single-variable-single-component processes reuse the existing DOF // table. diff --git a/ProcessLib/ProcessVariable.h b/ProcessLib/ProcessVariable.h index a7199512c8a..48b01050bf2 100644 --- a/ProcessLib/ProcessVariable.h +++ b/ProcessLib/ProcessVariable.h @@ -73,7 +73,7 @@ public: } /// Returns the number of components of the process variable. - int getNumberOfComponents() const { return _n_components; } + int getNumberOfGlobalComponents() const { return _n_components; } std::vector<std::unique_ptr<BoundaryCondition>> createBoundaryConditions( const NumLib::LocalToGlobalIndexMap& dof_table, const int variable_id, unsigned const integration_order, diff --git a/ProcessLib/RichardsMechanics/CreateRichardsMechanicsProcess.cpp b/ProcessLib/RichardsMechanics/CreateRichardsMechanicsProcess.cpp index 79f753e524c..25527acc90f 100644 --- a/ProcessLib/RichardsMechanics/CreateRichardsMechanicsProcess.cpp +++ b/ProcessLib/RichardsMechanics/CreateRichardsMechanicsProcess.cpp @@ -112,25 +112,25 @@ std::unique_ptr<Process> createRichardsMechanicsProcess( DBUG("Associate displacement with process variable '{:s}'.", variable_u->getName()); - if (variable_u->getNumberOfComponents() != DisplacementDim) + if (variable_u->getNumberOfGlobalComponents() != DisplacementDim) { OGS_FATAL( "Number of components of the process variable '{:s}' is different " "from the displacement dimension: got {:d}, expected {:d}", variable_u->getName(), - variable_u->getNumberOfComponents(), + variable_u->getNumberOfGlobalComponents(), DisplacementDim); } DBUG("Associate pressure with process variable '{:s}'.", variable_p->getName()); - if (variable_p->getNumberOfComponents() != 1) + if (variable_p->getNumberOfGlobalComponents() != 1) { OGS_FATAL( "Pressure process variable '{:s}' is not a scalar variable but has " "{:d} components.", variable_p->getName(), - variable_p->getNumberOfComponents()); + variable_p->getNumberOfGlobalComponents()); } auto solid_constitutive_relations = diff --git a/ProcessLib/RichardsMechanics/RichardsMechanicsProcess.cpp b/ProcessLib/RichardsMechanics/RichardsMechanicsProcess.cpp index af10c00d487..141b4f72c6a 100644 --- a/ProcessLib/RichardsMechanics/RichardsMechanicsProcess.cpp +++ b/ProcessLib/RichardsMechanics/RichardsMechanicsProcess.cpp @@ -218,7 +218,7 @@ void RichardsMechanicsProcess<DisplacementDim>::constructDofTable() std::generate_n(std::back_inserter(all_mesh_subsets), getProcessVariables(monolithic_process_id)[1] .get() - .getNumberOfComponents(), + .getNumberOfGlobalComponents(), [&]() { return *_mesh_subset_all_nodes; }); std::vector<int> const vec_n_components{1, DisplacementDim}; @@ -233,10 +233,11 @@ void RichardsMechanicsProcess<DisplacementDim>::constructDofTable() // For displacement equation. const int process_id = 1; std::vector<MeshLib::MeshSubset> all_mesh_subsets; - std::generate_n( - std::back_inserter(all_mesh_subsets), - getProcessVariables(process_id)[0].get().getNumberOfComponents(), - [&]() { return *_mesh_subset_all_nodes; }); + std::generate_n(std::back_inserter(all_mesh_subsets), + getProcessVariables(process_id)[0] + .get() + .getNumberOfGlobalComponents(), + [&]() { return *_mesh_subset_all_nodes; }); std::vector<int> const vec_n_components{DisplacementDim}; _local_to_global_index_map = @@ -371,13 +372,14 @@ void RichardsMechanicsProcess<DisplacementDim>::initializeConcreteProcess( auto const ip_meta_data = getIntegrationPointMetaData(mesh, name); // Check the number of components. - if (ip_meta_data.n_components != mesh_property.getNumberOfComponents()) + if (ip_meta_data.n_components != + mesh_property.getNumberOfGlobalComponents()) { OGS_FATAL( "Different number of components in meta data ({:d}) than in " "the integration point field data for '{:s}': {:d}.", ip_meta_data.n_components, name, - mesh_property.getNumberOfComponents()); + mesh_property.getNumberOfGlobalComponents()); } // Now we have a properly named vtk's field data array and the diff --git a/ProcessLib/SmallDeformation/CreateSmallDeformationProcess.cpp b/ProcessLib/SmallDeformation/CreateSmallDeformationProcess.cpp index 20023100d38..19dd200691e 100644 --- a/ProcessLib/SmallDeformation/CreateSmallDeformationProcess.cpp +++ b/ProcessLib/SmallDeformation/CreateSmallDeformationProcess.cpp @@ -53,14 +53,14 @@ std::unique_ptr<Process> createSmallDeformationProcess( DBUG("Associate displacement with process variable '{:s}'.", per_process_variables.back().get().getName()); - if (per_process_variables.back().get().getNumberOfComponents() != + if (per_process_variables.back().get().getNumberOfGlobalComponents() != DisplacementDim) { OGS_FATAL( "Number of components of the process variable '{:s}' is different " "from the displacement dimension: got {:d}, expected {:d}", per_process_variables.back().get().getName(), - per_process_variables.back().get().getNumberOfComponents(), + per_process_variables.back().get().getNumberOfGlobalComponents(), DisplacementDim); } std::vector<std::vector<std::reference_wrapper<ProcessVariable>>> diff --git a/ProcessLib/SmallDeformation/SmallDeformationProcess.cpp b/ProcessLib/SmallDeformation/SmallDeformationProcess.cpp index cb9879ba0fe..d97735275e8 100644 --- a/ProcessLib/SmallDeformation/SmallDeformationProcess.cpp +++ b/ProcessLib/SmallDeformation/SmallDeformationProcess.cpp @@ -161,13 +161,14 @@ void SmallDeformationProcess<DisplacementDim>::initializeConcreteProcess( auto const ip_meta_data = getIntegrationPointMetaData(mesh, name); // Check the number of components. - if (ip_meta_data.n_components != mesh_property.getNumberOfComponents()) + if (ip_meta_data.n_components != + mesh_property.getNumberOfGlobalComponents()) { OGS_FATAL( "Different number of components in meta data ({:d}) than in " "the integration point field data for '{:s}': {:d}.", ip_meta_data.n_components, name, - mesh_property.getNumberOfComponents()); + mesh_property.getNumberOfGlobalComponents()); } // Now we have a properly named vtk's field data array and the diff --git a/ProcessLib/SmallDeformationNonlocal/CreateSmallDeformationNonlocalProcess.cpp b/ProcessLib/SmallDeformationNonlocal/CreateSmallDeformationNonlocalProcess.cpp index 84528684102..4dacf629734 100644 --- a/ProcessLib/SmallDeformationNonlocal/CreateSmallDeformationNonlocalProcess.cpp +++ b/ProcessLib/SmallDeformationNonlocal/CreateSmallDeformationNonlocalProcess.cpp @@ -53,14 +53,14 @@ std::unique_ptr<Process> createSmallDeformationNonlocalProcess( DBUG("Associate displacement with process variable '{:s}'.", per_process_variables.back().get().getName()); - if (per_process_variables.back().get().getNumberOfComponents() != + if (per_process_variables.back().get().getNumberOfGlobalComponents() != DisplacementDim) { OGS_FATAL( "Number of components of the process variable '{:s}' is different " "from the displacement dimension: got {:d}, expected {:d}", per_process_variables.back().get().getName(), - per_process_variables.back().get().getNumberOfComponents(), + per_process_variables.back().get().getNumberOfGlobalComponents(), DisplacementDim); } std::vector<std::vector<std::reference_wrapper<ProcessVariable>>> diff --git a/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalProcess.cpp b/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalProcess.cpp index 3695cb59872..71d34779bc4 100644 --- a/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalProcess.cpp +++ b/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalProcess.cpp @@ -164,14 +164,14 @@ void SmallDeformationNonlocalProcess<DisplacementDim>:: // Check the number of components. if (ip_meta_data.n_components != - mesh_property.getNumberOfComponents()) + mesh_property.getNumberOfGlobalComponents()) { OGS_FATAL( "Different number of components in meta data ({:d}) than " "in " "the integration point field data for '{:s}': {:d}.", ip_meta_data.n_components, name, - mesh_property.getNumberOfComponents()); + mesh_property.getNumberOfGlobalComponents()); } // Now we have a properly named vtk's field data array and the @@ -214,7 +214,8 @@ void SmallDeformationNonlocalProcess<DisplacementDim>:: std::vector<double> value( &mesh_property[i], - &mesh_property[i] + mesh_property.getNumberOfComponents()); + &mesh_property[i] + + mesh_property.getNumberOfGlobalComponents()); // TODO (naumov) Check sizes / read size / etc. // OR reconstruct dimensions from size / component = // ip_points diff --git a/ProcessLib/SourceTerms/Python/PythonSourceTermLocalAssembler.h b/ProcessLib/SourceTerms/Python/PythonSourceTermLocalAssembler.h index 379ebd37d50..7305f534a3b 100644 --- a/ProcessLib/SourceTerms/Python/PythonSourceTermLocalAssembler.h +++ b/ProcessLib/SourceTerms/Python/PythonSourceTermLocalAssembler.h @@ -100,7 +100,7 @@ public: auto const num_var = dof_table_source_term.getNumberOfVariables(); auto const num_nodes = ShapeFunction::NPOINTS; auto const num_comp_total = - dof_table_source_term.getNumberOfComponents(); + dof_table_source_term.getNumberOfGlobalComponents(); // gather primary variables typename ShapeMatricesType::template MatrixType<ShapeFunction::NPOINTS, diff --git a/ProcessLib/SurfaceFlux/SurfaceFluxData.h b/ProcessLib/SurfaceFlux/SurfaceFluxData.h index 2acaf64460c..491e2d5af2c 100644 --- a/ProcessLib/SurfaceFlux/SurfaceFluxData.h +++ b/ProcessLib/SurfaceFlux/SurfaceFluxData.h @@ -85,10 +85,12 @@ struct SurfaceFluxData surface_mesh, property_vector_name, MeshLib::MeshItemType::Cell, 1); // initialise the PropertyVector pv with zero values std::fill(surfaceflux_pv->begin(), surfaceflux_pv->end(), 0.0); - auto surfaceflux_process = ProcessLib::SurfaceFlux( - surface_mesh, - p.getProcessVariables(process_id)[0].get().getNumberOfComponents(), - integration_order); + auto surfaceflux_process = + ProcessLib::SurfaceFlux(surface_mesh, + p.getProcessVariables(process_id)[0] + .get() + .getNumberOfGlobalComponents(), + integration_order); surfaceflux_process.integrate( x, *surfaceflux_pv, t, bulk_mesh, active_element_ids, diff --git a/ProcessLib/SurfaceFlux/SurfaceFluxLocalAssembler.h b/ProcessLib/SurfaceFlux/SurfaceFluxLocalAssembler.h index 49c33741bc2..f1de6d115c1 100644 --- a/ProcessLib/SurfaceFlux/SurfaceFluxLocalAssembler.h +++ b/ProcessLib/SurfaceFlux/SurfaceFluxLocalAssembler.h @@ -150,7 +150,7 @@ public: auto const bulk_flux = getFlux(_bulk_element_id, bulk_element_point, t, x); for (int component_id(0); - component_id < specific_flux.getNumberOfComponents(); + component_id < specific_flux.getNumberOfGlobalComponents(); ++component_id) { // TODO find solution for 2d case @@ -167,7 +167,7 @@ public: element_area += _detJ_times_integralMeasure[ip] * wp.getWeight(); } for (int component_id(0); - component_id < specific_flux.getNumberOfComponents(); + component_id < specific_flux.getNumberOfGlobalComponents(); ++component_id) { specific_flux.getComponent(element_id, component_id) /= diff --git a/ProcessLib/ThermoHydroMechanics/CreateThermoHydroMechanicsProcess.cpp b/ProcessLib/ThermoHydroMechanics/CreateThermoHydroMechanicsProcess.cpp index fafa042aa77..a00c3e92a27 100644 --- a/ProcessLib/ThermoHydroMechanics/CreateThermoHydroMechanicsProcess.cpp +++ b/ProcessLib/ThermoHydroMechanics/CreateThermoHydroMechanicsProcess.cpp @@ -92,36 +92,36 @@ std::unique_ptr<Process> createThermoHydroMechanicsProcess( DBUG("Associate displacement with process variable '{:s}'.", variable_u->getName()); - if (variable_u->getNumberOfComponents() != DisplacementDim) + if (variable_u->getNumberOfGlobalComponents() != DisplacementDim) { OGS_FATAL( "Number of components of the process variable '{:s}' is different " "from the displacement dimension: got {:d}, expected {:d}", variable_u->getName(), - variable_u->getNumberOfComponents(), + variable_u->getNumberOfGlobalComponents(), DisplacementDim); } DBUG("Associate pressure with process variable '{:s}'.", variable_p->getName()); - if (variable_p->getNumberOfComponents() != 1) + if (variable_p->getNumberOfGlobalComponents() != 1) { OGS_FATAL( "Pressure process variable '{:s}' is not a scalar variable but has " "{:d} components.", variable_p->getName(), - variable_p->getNumberOfComponents()); + variable_p->getNumberOfGlobalComponents()); } DBUG("Associate temperature with process variable '{:s}'.", variable_T->getName()); - if (variable_T->getNumberOfComponents() != 1) + if (variable_T->getNumberOfGlobalComponents() != 1) { OGS_FATAL( "temperature process variable '{:s}' is not a scalar variable but " "has {:d} components.", variable_T->getName(), - variable_T->getNumberOfComponents()); + variable_T->getNumberOfGlobalComponents()); } auto solid_constitutive_relations = diff --git a/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsProcess.cpp b/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsProcess.cpp index 56c6a367a29..75f05a79ab3 100644 --- a/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsProcess.cpp +++ b/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsProcess.cpp @@ -109,7 +109,7 @@ void ThermoHydroMechanicsProcess<DisplacementDim>::constructDofTable() std::generate_n(std::back_inserter(all_mesh_subsets), getProcessVariables(monolithic_process_id)[2] .get() - .getNumberOfComponents(), + .getNumberOfGlobalComponents(), [&]() { return *_mesh_subset_all_nodes; }); std::vector<int> const vec_n_components{1, 1, DisplacementDim}; @@ -124,10 +124,11 @@ void ThermoHydroMechanicsProcess<DisplacementDim>::constructDofTable() // For displacement equation. const int process_id = 2; std::vector<MeshLib::MeshSubset> all_mesh_subsets; - std::generate_n( - std::back_inserter(all_mesh_subsets), - getProcessVariables(process_id)[0].get().getNumberOfComponents(), - [&]() { return *_mesh_subset_all_nodes; }); + std::generate_n(std::back_inserter(all_mesh_subsets), + getProcessVariables(process_id)[0] + .get() + .getNumberOfGlobalComponents(), + [&]() { return *_mesh_subset_all_nodes; }); std::vector<int> const vec_n_components{DisplacementDim}; _local_to_global_index_map = diff --git a/ProcessLib/ThermoMechanicalPhaseField/CreateThermoMechanicalPhaseFieldProcess.cpp b/ProcessLib/ThermoMechanicalPhaseField/CreateThermoMechanicalPhaseFieldProcess.cpp index ffbf2bd5555..5300866eb8b 100644 --- a/ProcessLib/ThermoMechanicalPhaseField/CreateThermoMechanicalPhaseFieldProcess.cpp +++ b/ProcessLib/ThermoMechanicalPhaseField/CreateThermoMechanicalPhaseFieldProcess.cpp @@ -81,38 +81,38 @@ std::unique_ptr<Process> createThermoMechanicalPhaseFieldProcess( DBUG("Associate displacement with process variable '{:s}'.", variable_u->getName()); - if (variable_u->getNumberOfComponents() != DisplacementDim) + if (variable_u->getNumberOfGlobalComponents() != DisplacementDim) { OGS_FATAL( "Number of components of the process variable '{:s}' is different " "from the displacement dimension: got {:d}, expected {:d}", variable_u->getName(), - variable_u->getNumberOfComponents(), + variable_u->getNumberOfGlobalComponents(), DisplacementDim); } DBUG("Associate phase field with process variable '{:s}'.", variable_ph->getName()); - if (variable_ph->getNumberOfComponents() != 1) + if (variable_ph->getNumberOfGlobalComponents() != 1) { OGS_FATAL( "Phasefield process variable '{:s}' is not a scalar variable but " "has " "{:d} components.", variable_ph->getName(), - variable_ph->getNumberOfComponents()); + variable_ph->getNumberOfGlobalComponents()); } DBUG("Associate temperature with process variable '{:s}'.", variable_T->getName()); - if (variable_T->getNumberOfComponents() != 1) + if (variable_T->getNumberOfGlobalComponents() != 1) { OGS_FATAL( "Temperature process variable '{:s}' is not a scalar variable but " "has " "{:d} components.", variable_T->getName(), - variable_T->getNumberOfComponents()); + variable_T->getNumberOfGlobalComponents()); } auto solid_constitutive_relations = diff --git a/ProcessLib/ThermoMechanics/CreateThermoMechanicsProcess.cpp b/ProcessLib/ThermoMechanics/CreateThermoMechanicsProcess.cpp index 5d6e41799f4..9bb37f0f0e4 100644 --- a/ProcessLib/ThermoMechanics/CreateThermoMechanicsProcess.cpp +++ b/ProcessLib/ThermoMechanics/CreateThermoMechanicsProcess.cpp @@ -91,25 +91,25 @@ std::unique_ptr<Process> createThermoMechanicsProcess( DBUG("Associate displacement with process variable '{:s}'.", variable_u->getName()); - if (variable_u->getNumberOfComponents() != DisplacementDim) + if (variable_u->getNumberOfGlobalComponents() != DisplacementDim) { OGS_FATAL( "Number of components of the process variable '{:s}' is different " "from the displacement dimension: got {:d}, expected {:d}", variable_u->getName(), - variable_u->getNumberOfComponents(), + variable_u->getNumberOfGlobalComponents(), DisplacementDim); } DBUG("Associate temperature with process variable '{:s}'.", variable_T->getName()); - if (variable_T->getNumberOfComponents() != 1) + if (variable_T->getNumberOfGlobalComponents() != 1) { OGS_FATAL( "Pressure process variable '{:s}' is not a scalar variable but has " "{:d} components.", variable_T->getName(), - variable_T->getNumberOfComponents()); + variable_T->getNumberOfGlobalComponents()); } //! \ogs_file_param{prj__processes__process__THERMO_MECHANICS__constitutive_relation} diff --git a/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.cpp b/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.cpp index caa44c0aa5b..48b0f30b1bf 100644 --- a/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.cpp +++ b/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.cpp @@ -227,13 +227,14 @@ void ThermoMechanicsProcess<DisplacementDim>::initializeConcreteProcess( auto const ip_meta_data = getIntegrationPointMetaData(mesh, name); // Check the number of components. - if (ip_meta_data.n_components != mesh_property.getNumberOfComponents()) + if (ip_meta_data.n_components != + mesh_property.getNumberOfGlobalComponents()) { OGS_FATAL( "Different number of components in meta data ({:d}) than in " "the integration point field data for '{:s}': {:d}.", ip_meta_data.n_components, name, - mesh_property.getNumberOfComponents()); + mesh_property.getNumberOfGlobalComponents()); } // Now we have a properly named vtk's field data array and the diff --git a/Tests/MeshLib/MeshProperties.cpp b/Tests/MeshLib/MeshProperties.cpp index ff6d94fce7f..8b0114212c5 100644 --- a/Tests/MeshLib/MeshProperties.cpp +++ b/Tests/MeshLib/MeshProperties.cpp @@ -42,7 +42,7 @@ TEST_F(MeshLibProperties, PropertyVectorTestMetaData) ASSERT_EQ(0u, p->getPropertyName().compare(prop_name)); ASSERT_EQ(MeshLib::MeshItemType::Cell, p->getMeshItemType()); - ASSERT_EQ(1u, p->getNumberOfComponents()); + ASSERT_EQ(1u, p->getNumberOfGlobalComponents()); ASSERT_EQ(0u, p->size()); } @@ -61,7 +61,7 @@ TEST_F(MeshLibProperties, PropertyVectorTestIntegrationPoint) auto& p = *p_ptr; ASSERT_EQ(p.getPropertyName(), prop_name); ASSERT_EQ(MeshLib::MeshItemType::IntegrationPoint, p.getMeshItemType()); - ASSERT_EQ(vector_length, p.getNumberOfComponents()); + ASSERT_EQ(vector_length, p.getNumberOfGlobalComponents()); ASSERT_EQ(0u, p.size()); // Fill the property vector with double data in following pattern: @@ -461,7 +461,7 @@ TEST_F(MeshLibProperties, AddDoublePropertiesTupleSize2) ASSERT_EQ(0u, pv->getPropertyName().compare(prop_name)); ASSERT_EQ(MeshLib::MeshItemType::Cell, pv->getMeshItemType()); - ASSERT_EQ(2u, pv->getNumberOfComponents()); + ASSERT_EQ(2u, pv->getNumberOfGlobalComponents()); ASSERT_EQ(0u, pv->getNumberOfTuples()); ASSERT_EQ(0u, pv->size()); @@ -472,7 +472,8 @@ TEST_F(MeshLibProperties, AddDoublePropertiesTupleSize2) } // check the number of tuples ASSERT_EQ(number_of_tuples, pv->getNumberOfTuples()); - ASSERT_EQ(pv->getNumberOfTuples()*pv->getNumberOfComponents(), pv->size()); + ASSERT_EQ(pv->getNumberOfTuples() * pv->getNumberOfGlobalComponents(), + pv->size()); // check the values for (std::size_t k(0); k<number_of_tuples; k++) { ASSERT_EQ(static_cast<double>(k), (*pv)[2*k]); diff --git a/Tests/MeshLib/TestVtkMappedMeshSource.cpp b/Tests/MeshLib/TestVtkMappedMeshSource.cpp index ac67bcdd567..85605d99b03 100644 --- a/Tests/MeshLib/TestVtkMappedMeshSource.cpp +++ b/Tests/MeshLib/TestVtkMappedMeshSource.cpp @@ -323,8 +323,8 @@ TEST_F(InSituMesh, DISABLED_MappedMeshSourceRoundtrip) auto const* const newDoubleProps = newMeshProperties.getPropertyVector<double>( "PointDoubleProperty"); - ASSERT_EQ(newDoubleProps->getNumberOfComponents(), - doubleProps->getNumberOfComponents()); + ASSERT_EQ(newDoubleProps->getNumberOfGlobalComponents(), + doubleProps->getNumberOfGlobalComponents()); ASSERT_EQ(newDoubleProps->getNumberOfTuples(), doubleProps->getNumberOfTuples()); ASSERT_EQ(newDoubleProps->size(), doubleProps->size()); @@ -338,8 +338,8 @@ TEST_F(InSituMesh, DISABLED_MappedMeshSourceRoundtrip) auto newUnsignedIds = newMeshProperties.getPropertyVector<unsigned>( "CellUnsignedProperty"); - ASSERT_EQ(newUnsignedIds->getNumberOfComponents(), - unsignedProps->getNumberOfComponents()); + ASSERT_EQ(newUnsignedIds->getNumberOfGlobalComponents(), + unsignedProps->getNumberOfGlobalComponents()); ASSERT_EQ(newUnsignedIds->getNumberOfTuples(), unsignedProps->getNumberOfTuples()); ASSERT_EQ(newUnsignedIds->size(), unsignedProps->size()); @@ -354,8 +354,8 @@ TEST_F(InSituMesh, DISABLED_MappedMeshSourceRoundtrip) auto new_p = newMeshProperties.getPropertyVector<int>( "FieldIntProperty"); - ASSERT_EQ(new_p->getNumberOfComponents(), - p->getNumberOfComponents()); + ASSERT_EQ(new_p->getNumberOfGlobalComponents(), + p->getNumberOfGlobalComponents()); ASSERT_EQ(new_p->getNumberOfTuples(), p->getNumberOfTuples()); ASSERT_EQ(new_p->size(), p->size()); for (std::size_t i = 0; i < unsignedProps->size(); i++) @@ -368,8 +368,8 @@ TEST_F(InSituMesh, DISABLED_MappedMeshSourceRoundtrip) meshProperties.getPropertyVector<int>("MaterialIDs"); auto const* const newMaterialIds = newMeshProperties.getPropertyVector<int>("MaterialIDs"); - ASSERT_EQ(newMaterialIds->getNumberOfComponents(), - materialIds->getNumberOfComponents()); + ASSERT_EQ(newMaterialIds->getNumberOfGlobalComponents(), + materialIds->getNumberOfGlobalComponents()); ASSERT_EQ(newMaterialIds->getNumberOfTuples(), materialIds->getNumberOfTuples()); ASSERT_EQ(newMaterialIds->size(), materialIds->size()); diff --git a/Tests/NumLib/LocalToGlobalIndexMap.cpp b/Tests/NumLib/LocalToGlobalIndexMap.cpp index a3a38c72e86..b9bd0a5ebc2 100644 --- a/Tests/NumLib/LocalToGlobalIndexMap.cpp +++ b/Tests/NumLib/LocalToGlobalIndexMap.cpp @@ -138,7 +138,7 @@ TEST_F(NumLibLocalToGlobalIndexMapTest, DISABLED_MultipleVariablesMultipleCompon NumLib::ComponentOrder::BY_COMPONENT); ASSERT_EQ(30, dof_map->dofSizeWithGhosts()); - ASSERT_EQ(3, dof_map->getNumberOfComponents()); + ASSERT_EQ(3, dof_map->getNumberOfGlobalComponents()); ASSERT_EQ(2u, dof_map->getNumberOfVariables()); ASSERT_EQ(1, dof_map->getNumberOfVariableComponents(0)); ASSERT_EQ(2, dof_map->getNumberOfVariableComponents(1)); @@ -167,7 +167,7 @@ TEST_F(NumLibLocalToGlobalIndexMapTest, DISABLED_MultipleVariablesMultipleCompon NumLib::ComponentOrder::BY_COMPONENT); ASSERT_EQ(30, dof_map->dofSizeWithGhosts()); - ASSERT_EQ(3, dof_map->getNumberOfComponents()); + ASSERT_EQ(3, dof_map->getNumberOfGlobalComponents()); ASSERT_EQ(2u, dof_map->getNumberOfVariables()); ASSERT_EQ(2, dof_map->getNumberOfVariableComponents(0)); ASSERT_EQ(1, dof_map->getNumberOfVariableComponents(1)); @@ -206,7 +206,7 @@ TEST_F(NumLibLocalToGlobalIndexMapTest, DISABLED_MultipleVariablesMultipleCompon NumLib::ComponentOrder::BY_COMPONENT); ASSERT_EQ(22u, dof_map->dofSizeWithGhosts()); - ASSERT_EQ(3, dof_map->getNumberOfComponents()); + ASSERT_EQ(3, dof_map->getNumberOfGlobalComponents()); ASSERT_EQ(2u, dof_map->getNumberOfVariables()); ASSERT_EQ(2, dof_map->getNumberOfVariableComponents(0)); ASSERT_EQ(1, dof_map->getNumberOfVariableComponents(1)); @@ -258,7 +258,7 @@ TEST_F(NumLibLocalToGlobalIndexMapTest, DISABLED_MultipleVariablesMultipleCompon NumLib::ComponentOrder::BY_COMPONENT); ASSERT_EQ(21u, dof_map->dofSizeWithGhosts()); - ASSERT_EQ(3, dof_map->getNumberOfComponents()); + ASSERT_EQ(3, dof_map->getNumberOfGlobalComponents()); ASSERT_EQ(2u, dof_map->getNumberOfVariables()); ASSERT_EQ(2, dof_map->getNumberOfVariableComponents(0)); ASSERT_EQ(1, dof_map->getNumberOfVariableComponents(1)); diff --git a/Tests/NumLib/LocalToGlobalIndexMapMultiComponent.cpp b/Tests/NumLib/LocalToGlobalIndexMapMultiComponent.cpp index f32dd35078e..bd625cca63b 100644 --- a/Tests/NumLib/LocalToGlobalIndexMapMultiComponent.cpp +++ b/Tests/NumLib/LocalToGlobalIndexMapMultiComponent.cpp @@ -177,10 +177,10 @@ void NumLibLocalToGlobalIndexMapMultiDOFTest::test( { initComponents(num_components, selected_component, ComponentOrder); - ASSERT_EQ(dof_map->getNumberOfComponents(), num_components); + ASSERT_EQ(dof_map->getNumberOfGlobalComponents(), num_components); ASSERT_EQ(dof_map->size(), mesh->getNumberOfElements()); - ASSERT_EQ(dof_map_boundary->getNumberOfComponents(), 1); + ASSERT_EQ(dof_map_boundary->getNumberOfGlobalComponents(), 1); ASSERT_EQ(dof_map_boundary->size(), boundary_mesh->getNumberOfElements()); // check mesh elements @@ -189,7 +189,7 @@ void NumLibLocalToGlobalIndexMapMultiDOFTest::test( auto const element_nodes_size = mesh->getElement(e)->getNumberOfNodes(); auto const ptr_element_nodes = mesh->getElement(e)->getNodes(); - for (int c = 0; c < dof_map->getNumberOfComponents(); ++c) + for (int c = 0; c < dof_map->getNumberOfGlobalComponents(); ++c) { auto const& global_idcs = (*dof_map)(e, c).rows; ASSERT_EQ(element_nodes_size, global_idcs.size()); @@ -206,7 +206,7 @@ void NumLibLocalToGlobalIndexMapMultiDOFTest::test( // check boundary elements for (unsigned e=0; e<dof_map_boundary->size(); ++e) { - ASSERT_EQ(1, dof_map_boundary->getNumberOfComponents()); + ASSERT_EQ(1, dof_map_boundary->getNumberOfGlobalComponents()); for (int c = 0; c < 1; ++c) { @@ -238,10 +238,10 @@ void NumLibLocalToGlobalIndexMapMultiDOFTest::test( { initComponents(num_components, selected_components, ComponentOrder); - ASSERT_EQ(dof_map->getNumberOfComponents(), num_components); + ASSERT_EQ(dof_map->getNumberOfGlobalComponents(), num_components); ASSERT_EQ(dof_map->size(), mesh->getNumberOfElements()); - ASSERT_EQ(dof_map_boundary->getNumberOfComponents(), + ASSERT_EQ(dof_map_boundary->getNumberOfGlobalComponents(), selected_components.size()); ASSERT_EQ(dof_map_boundary->size(), boundary_mesh->getNumberOfElements()); @@ -251,7 +251,7 @@ void NumLibLocalToGlobalIndexMapMultiDOFTest::test( auto const element_nodes_size = mesh->getElement(e)->getNumberOfNodes(); auto const ptr_element_nodes = mesh->getElement(e)->getNodes(); - for (int c = 0; c < dof_map->getNumberOfComponents(); ++c) + for (int c = 0; c < dof_map->getNumberOfGlobalComponents(); ++c) { auto const& global_idcs = (*dof_map)(e, c).rows; ASSERT_EQ(element_nodes_size, global_idcs.size()); @@ -269,7 +269,7 @@ void NumLibLocalToGlobalIndexMapMultiDOFTest::test( for (unsigned e = 0; e < dof_map_boundary->size(); ++e) { ASSERT_EQ(selected_components.size(), - dof_map_boundary->getNumberOfComponents()); + dof_map_boundary->getNumberOfGlobalComponents()); for (int c = 0; c < static_cast<int>(selected_components.size()); ++c) { @@ -296,11 +296,12 @@ void NumLibLocalToGlobalIndexMapMultiDOFTest::test( void assert_equal(NL::LocalToGlobalIndexMap const& dof1, NL::LocalToGlobalIndexMap const& dof2) { ASSERT_EQ(dof1.size(), dof2.size()); - ASSERT_EQ(dof1.getNumberOfComponents(), dof2.getNumberOfComponents()); + ASSERT_EQ(dof1.getNumberOfGlobalComponents(), + dof2.getNumberOfGlobalComponents()); for (unsigned e=0; e<dof1.size(); ++e) { - for (int c = 0; c < dof1.getNumberOfComponents(); ++c) + for (int c = 0; c < dof1.getNumberOfGlobalComponents(); ++c) { EXPECT_EQ(dof1(e, c).rows, dof2(e, c).rows); EXPECT_EQ(dof1(e, c).columns, dof2(e, c).columns); -- GitLab