Skip to content
Snippets Groups Projects
Commit 8ae5d835 authored by Yonghui56's avatar Yonghui56
Browse files

Use const reference for material_ids replacing boost optional in TwoPhaseModel material prop

parent a2944758
No related branches found
No related tags found
No related merge requests found
......@@ -33,8 +33,7 @@ std::tuple<std::unique_ptr<TwoPhaseFlowWithPPMaterialProperties>,
BaseLib::ConfigTree>
createTwoPhaseFlowMaterialProperties(
BaseLib::ConfigTree const& config,
boost::optional<MeshLib::PropertyVector<int> const&>
material_ids)
MeshLib::PropertyVector<int> const& material_ids)
{
DBUG("Reading material properties of two-phase flow process.");
......
......@@ -31,8 +31,7 @@ std::tuple<std::unique_ptr<TwoPhaseFlowWithPPMaterialProperties>,
BaseLib::ConfigTree>
createTwoPhaseFlowMaterialProperties(
BaseLib::ConfigTree const& config,
boost::optional<MeshLib::PropertyVector<int> const&>
material_ids);
MeshLib::PropertyVector<int> const& material_ids);
} // end namespace
} // end namespace
......@@ -30,7 +30,7 @@ namespace MaterialLib
namespace TwoPhaseFlowWithPP
{
TwoPhaseFlowWithPPMaterialProperties::TwoPhaseFlowWithPPMaterialProperties(
boost::optional<MeshLib::PropertyVector<int> const&> const material_ids,
MeshLib::PropertyVector<int> const& material_ids,
std::unique_ptr<MaterialLib::Fluid::FluidProperty>&& liquid_density,
std::unique_ptr<MaterialLib::Fluid::FluidProperty>&& liquid_viscosity,
std::unique_ptr<MaterialLib::Fluid::FluidProperty>&& gas_density,
......@@ -63,13 +63,13 @@ TwoPhaseFlowWithPPMaterialProperties::TwoPhaseFlowWithPPMaterialProperties(
int TwoPhaseFlowWithPPMaterialProperties::getMaterialID(
const std::size_t element_id) const
{
if (!_material_ids)
if (_material_ids.empty())
{
return 0;
}
assert(element_id < _material_ids->size());
return (*_material_ids)[element_id];
assert(element_id < _material_ids.size());
return _material_ids[element_id];
}
double TwoPhaseFlowWithPPMaterialProperties::getLiquidDensity(
......
......@@ -56,7 +56,7 @@ public:
using ArrayType = MaterialLib::Fluid::FluidProperty::ArrayType;
TwoPhaseFlowWithPPMaterialProperties(
boost::optional<MeshLib::PropertyVector<int> const&> const material_ids,
MeshLib::PropertyVector<int> const& material_ids,
std::unique_ptr<MaterialLib::Fluid::FluidProperty>&&
liquid_density,
std::unique_ptr<MaterialLib::Fluid::FluidProperty>&&
......@@ -118,7 +118,7 @@ private:
/** Use two phase models for different material zones.
* Material IDs must be given as mesh element properties.
*/
boost::optional<MeshLib::PropertyVector<int> const&> const _material_ids;
MeshLib::PropertyVector<int> const& _material_ids;
std::unique_ptr<MaterialLib::Fluid::FluidProperty> const _liquid_density;
std::unique_ptr<MaterialLib::Fluid::FluidProperty> const _liquid_viscosity;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment