ConnFiltrateData: template Scalar type

This commit is contained in:
Arne Morten Kvarving 2024-02-17 17:20:35 +01:00
parent 3b3fb6752c
commit ea1f4f822b
4 changed files with 21 additions and 15 deletions

View File

@ -26,7 +26,9 @@
namespace Opm {
void ConnFiltrateData::resize(std::size_t num_perf) {
template<class Scalar>
void ConnFiltrateData<Scalar>::resize(std::size_t num_perf)
{
this->rates.resize(num_perf);
this->total.resize(num_perf);
this->skin_factor.resize(num_perf);
@ -37,7 +39,9 @@ void ConnFiltrateData::resize(std::size_t num_perf) {
this->area_of_flow.resize(num_perf);
}
ConnFiltrateData ConnFiltrateData::serializationTestObject()
template<class Scalar>
ConnFiltrateData<Scalar>
ConnFiltrateData<Scalar>::serializationTestObject()
{
ConnFiltrateData result;
result.rates = {8.};
@ -51,7 +55,8 @@ ConnFiltrateData ConnFiltrateData::serializationTestObject()
return result;
}
bool ConnFiltrateData::operator==(const ConnFiltrateData& rhs) const
template<class Scalar>
bool ConnFiltrateData<Scalar>::operator==(const ConnFiltrateData& rhs) const
{
return this->rates == rhs.rates &&
this->total == rhs.total &&
@ -63,4 +68,6 @@ bool ConnFiltrateData::operator==(const ConnFiltrateData& rhs) const
this->area_of_flow == rhs.area_of_flow;
}
template struct ConnFiltrateData<double>;
}

View File

@ -25,10 +25,9 @@
namespace Opm {
template<class Scalar>
struct ConnFiltrateData {
ConnFiltrateData() = default;
void resize(std::size_t num_perf);
template<class Serializer>
@ -47,14 +46,14 @@ struct ConnFiltrateData {
bool operator==(const ConnFiltrateData& rhs) const;
std::vector<double> rates;
std::vector<double> total;
std::vector<double> skin_factor;
std::vector<double> thickness;
std::vector<double> perm;
std::vector<double> poro;
std::vector<double> radius;
std::vector<double> area_of_flow;
std::vector<Scalar> rates;
std::vector<Scalar> total;
std::vector<Scalar> skin_factor;
std::vector<Scalar> thickness;
std::vector<Scalar> perm;
std::vector<Scalar> poro;
std::vector<Scalar> radius;
std::vector<Scalar> area_of_flow;
};
}

View File

@ -79,7 +79,7 @@ PerfData PerfData::serializationTestObject()
result.water_throughput = {25.0, 26.0};
result.skin_pressure = {27.0, 28.0};
result.water_velocity = {29.0, 30.0};
result.filtrate_data = ConnFiltrateData::serializationTestObject();
result.filtrate_data = ConnFiltrateData<double>::serializationTestObject();
return result;
}

View File

@ -102,7 +102,7 @@ public:
std::vector<double> skin_pressure{};
std::vector<double> water_velocity{};
ConnFiltrateData filtrate_data{};
ConnFiltrateData<double> filtrate_data{};
};
} // namespace Opm