Commit af5acafb authored by Timo Koch's avatar Timo Koch
Browse files

[mpnc] Correctly implement typesafe interfaces using std::string

(cherry picked from commit 7ab1887c)
parent 2a44f2b0
......@@ -181,7 +181,7 @@ protected:
*/
template <class MultiWriter>
void commitScalarBuffer_(MultiWriter &writer,
std::string name,
const std::string& name,
ScalarVector &buffer,
bool vertexCentered = true)
{
......@@ -196,13 +196,13 @@ protected:
*/
template <class MultiWriter>
void commitPhaseBuffer_(MultiWriter &writer,
std::string pattern,
const std::string& pattern,
PhaseVector &buffer,
bool vertexCentered = true)
{
char name[512];
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
snprintf(name, 512, pattern, FluidSystem::phaseName(phaseIdx));
snprintf(name, 512, pattern.c_str(), FluidSystem::phaseName(phaseIdx).c_str());
if (vertexCentered)
writer.attachVertexData(buffer[phaseIdx], name, 1);
......@@ -216,13 +216,13 @@ protected:
*/
template <class MultiWriter>
void commitComponentBuffer_(MultiWriter &writer,
std::string pattern,
const std::string& pattern,
ComponentVector &buffer,
bool vertexCentered = true)
{
char name[512];
for (int compIdx = 0; compIdx < numComponents; ++compIdx) {
snprintf(name, 512, pattern, FluidSystem::componentName(compIdx));
snprintf(name, 512, pattern.c_str(), FluidSystem::componentName(compIdx).c_str());
if (vertexCentered)
writer.attachVertexData(buffer[compIdx], name, 1);
......@@ -236,16 +236,16 @@ protected:
*/
template <class MultiWriter>
void commitPhaseComponentBuffer_(MultiWriter &writer,
std::string pattern,
const std::string& pattern,
PhaseComponentMatrix &buffer,
bool vertexCentered = true)
{
char name[512];
for (int phaseIdx= 0; phaseIdx < numPhases; ++phaseIdx) {
for (int compIdx = 0; compIdx < numComponents; ++compIdx) {
snprintf(name, 512, pattern,
FluidSystem::phaseName(phaseIdx),
FluidSystem::componentName(compIdx));
snprintf(name, 512, pattern.c_str(),
FluidSystem::phaseName(phaseIdx).c_str(),
FluidSystem::componentName(compIdx).c_str());
if (vertexCentered)
writer.attachVertexData(buffer[phaseIdx][compIdx], name, 1);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment