From 1a3809eb6caa9acaab69c78968c2c42ebd606fe7 Mon Sep 17 00:00:00 2001 From: Petr Karnakov Date: Wed, 7 Jul 2021 18:47:58 +0200 Subject: [PATCH] vof: add vtkpoly flag --- examples/102_mean_curv_flow/main.cpp | 1 + src/solver/vof.h | 1 + src/solver/vof.ipp | 4 ++-- src/solver/vofm.ipp | 2 +- src/util/vof.h | 4 +++- src/util/vof.ipp | 10 ++++++---- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/examples/102_mean_curv_flow/main.cpp b/examples/102_mean_curv_flow/main.cpp index 698676e19..868f38524 100644 --- a/examples/102_mean_curv_flow/main.cpp +++ b/examples/102_mean_curv_flow/main.cpp @@ -467,6 +467,7 @@ void Run(M& m, Vars& var) { parvof.filterth = var.Double["filterth"]; parvof.dim = 2; parvof.vtkbin = true; + parvof.vtkpoly = false; layers = GRange(parvof.layers); t.fcu0.resize(layers); t.fccl0.resize(layers); diff --git a/src/solver/vof.h b/src/solver/vof.h index 58184b104..db6b3561e 100644 --- a/src/solver/vof.h +++ b/src/solver/vof.h @@ -40,6 +40,7 @@ class Vof final : public AdvectionSolver { Scal dumppolymarch_fill = -1; // fill cells outside bool vtkbin = true; bool vtkmerge = true; + bool vtkpoly = true; // dump vtk polygins instead of lines Scal vtkiso = 0.5; enum class Scheme { plain, aulisa, weymouth }; Scheme scheme = Scheme::weymouth; diff --git a/src/solver/vof.ipp b/src/solver/vof.ipp index 79f6e25eb..dce3e2624 100644 --- a/src/solver/vof.ipp +++ b/src/solver/vof.ipp @@ -642,8 +642,8 @@ struct Vof::Imp { } if (sem.Nested()) { uvof_.DumpPolyMarch( - layers, &fcut, &fcclt, &fcn_, filename, - owner_->GetTime(), par.vtkbin, par.vtkmerge, par.vtkiso, + layers, &fcut, &fcclt, &fcn_, filename, owner_->GetTime(), + par.vtkpoly, par.vtkbin, par.vtkmerge, par.vtkiso, par.dumppolymarch_fill >= 0 ? &fcut : nullptr, m); } } diff --git a/src/solver/vofm.ipp b/src/solver/vofm.ipp index 402bd9d24..b29fa4820 100644 --- a/src/solver/vofm.ipp +++ b/src/solver/vofm.ipp @@ -334,7 +334,7 @@ struct Vofm::Imp { } if (sem.Nested()) { uvof_.DumpPolyMarch( - layers, fcut, fcclt, fcn_, filename, owner_->GetTime(), + layers, fcut, fcclt, fcn_, filename, owner_->GetTime(), par.vtkpoly, par.vtkbin, par.vtkmerge, par.vtkiso, par.dumppolymarch_fill >= 0 ? &fcust : nullptr, m); } diff --git a/src/util/vof.h b/src/util/vof.h index eca2e2b45..d9c9c71b8 100644 --- a/src/util/vof.h +++ b/src/util/vof.h @@ -30,6 +30,7 @@ class UVof { Scal time = 0; // time used in dump report if verbose bool binary = true; // write binary data, else ASCII bool merge = true; // merge close points + bool poly = true; // dump vtk polygons instead of lines bool verbose = true; // print dump report to stderr on root bool dump_cell_index = false; // dump global cell index `c` bool dump_layer = false; // dump layer index `l` @@ -56,7 +57,8 @@ class UVof { const GRange& layers, const Multi*>& fcu, const Multi*>& fccl, const Multi*>& fcn, std::string filename, Scal time, - bool bin, bool merge, Scal iso, const FieldCell* fcus, M& m); + bool poly, bool bin, bool merge, Scal iso, const FieldCell* fcus, + M& m); // Computes unique color for each connected component over all layers. // fcu: volume fraction diff --git a/src/util/vof.ipp b/src/util/vof.ipp index 2d2243a92..96e41de47 100644 --- a/src/util/vof.ipp +++ b/src/util/vof.ipp @@ -499,7 +499,8 @@ struct UVof::Imp { const GRange& layers, const Multi*>& fcu, const Multi*>& fccl, const Multi*>& fcn, std::string filename, Scal time, - bool bin, bool merge, Scal iso, const FieldCell* fcus, M& m) { + bool poly, bool bin, bool merge, Scal iso, const FieldCell* fcus, + M& m) { auto sem = m.GetSem("dumppolymarch"); struct { std::vector> dl; // polygons @@ -600,7 +601,7 @@ struct UVof::Imp { << " t=" << time << " to " << filename << std::endl; WriteVtkPoly( filename, dl, &dln, {&dlc, &dll, &dlcl}, {"c", "l", "cl"}, - "Interface from marching cubes", true, bin, merge); + "Interface from marching cubes", poly, bin, merge); } } } @@ -1174,9 +1175,10 @@ void UVof::DumpPolyMarch( const GRange& layers, const Multi*>& fcu, const Multi*>& fccl, const Multi*>& fcn, std::string filename, Scal t, - bool bin, bool merge, Scal iso, const FieldCell* fcus, M& m) { + bool poly, bool bin, bool merge, Scal iso, const FieldCell* fcus, + M& m) { imp->DumpPolyMarch( - layers, fcu, fccl, fcn, filename, t, bin, merge, iso, fcus, m); + layers, fcu, fccl, fcn, filename, t, poly, bin, merge, iso, fcus, m); } template