adapting to std::string_view

for componentName and phaseName
This commit is contained in:
Kai Bao 2024-01-05 13:10:24 +01:00
parent 8b9e8aefee
commit aad3f10f13
3 changed files with 12 additions and 9 deletions

View File

@ -38,10 +38,11 @@
#include <dune/istl/bvector.hh>
#include <dune/common/fvector.hh>
#include <vector>
#include <array>
#include <sstream>
#include <string>
#include <array>
#include <string_view>
#include <vector>
#include <cstdio>
@ -422,7 +423,7 @@ protected:
{
char name[512];
for (unsigned i = 0; i < numPhases; ++i) {
snprintf(name, 512, pattern, FluidSystem::phaseName(i));
snprintf(name, 512, pattern, FluidSystem::phaseName(i).data());
if (bufferType == DofBuffer)
DiscBaseOutputModule::attachScalarDofData_(baseWriter, buffer[i], name);
@ -445,7 +446,7 @@ protected:
{
char name[512];
for (unsigned i = 0; i < numComponents; ++i) {
snprintf(name, 512, pattern, FluidSystem::componentName(i));
snprintf(name, 512, pattern, FluidSystem::componentName(i).data());
if (bufferType == DofBuffer)
DiscBaseOutputModule::attachScalarDofData_(baseWriter, buffer[i], name);
@ -470,8 +471,8 @@ protected:
for (unsigned i= 0; i < numPhases; ++i) {
for (unsigned j = 0; j < numComponents; ++j) {
snprintf(name, 512, pattern,
FluidSystem::phaseName(i),
FluidSystem::componentName(j));
FluidSystem::phaseName(i).data(),
FluidSystem::componentName(j).data());
if (bufferType == DofBuffer)
DiscBaseOutputModule::attachScalarDofData_(baseWriter, buffer[i][j], name);

View File

@ -38,6 +38,7 @@
#include <dune/common/fvector.hh>
#include <cstdio>
#include <string_view>
namespace Opm::Properties {
@ -308,7 +309,7 @@ public:
std::max<Scalar>(1e-20, fractureVelocityWeight_[phaseIdx][dofIdx]);
// commit the phase velocity
char name[512];
snprintf(name, 512, "fractureFilterVelocity_%s", FluidSystem::phaseName(phaseIdx));
snprintf(name, 512, "fractureFilterVelocity_%s", FluidSystem::phaseName(phaseIdx).data());
DiscBaseOutputModule::attachVectorDofData_(baseWriter, fractureVelocity_[phaseIdx], name);
}

View File

@ -39,6 +39,7 @@
#include <dune/common/fvector.hh>
#include <cstdio>
#include <string_view>
namespace Opm::Properties {
@ -376,7 +377,7 @@ public:
velocity_[phaseIdx][i] /= velocityWeight_[phaseIdx][i];
// commit the phase velocity
char name[512];
snprintf(name, 512, "filterVelocity_%s", FluidSystem::phaseName(phaseIdx));
snprintf(name, 512, "filterVelocity_%s", FluidSystem::phaseName(phaseIdx).data());
DiscBaseOutputModule::attachVectorDofData_(baseWriter, velocity_[phaseIdx], name);
}
@ -392,7 +393,7 @@ public:
potentialGradient_[phaseIdx][i] /= potentialWeight_[phaseIdx][i];
// commit the phase velocity
char name[512];
snprintf(name, 512, "gradP_%s", FluidSystem::phaseName(phaseIdx));
snprintf(name, 512, "gradP_%s", FluidSystem::phaseName(phaseIdx).data());
DiscBaseOutputModule::attachVectorDofData_(baseWriter,
potentialGradient_[phaseIdx],