Skip to content

Commit

Permalink
vof: add vtkpoly flag
Browse files Browse the repository at this point in the history
  • Loading branch information
pkarnakov committed Jul 7, 2021
1 parent e32e8a1 commit 1a3809e
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions examples/102_mean_curv_flow/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<size_t>(parvof.layers);
t.fcu0.resize(layers);
t.fccl0.resize(layers);
Expand Down
1 change: 1 addition & 0 deletions src/solver/vof.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class Vof final : public AdvectionSolver<typename EB_::M> {
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;
Expand Down
4 changes: 2 additions & 2 deletions src/solver/vof.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -642,8 +642,8 @@ struct Vof<EB_>::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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/solver/vofm.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ struct Vofm<EB_>::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);
}
Expand Down
4 changes: 3 additions & 1 deletion src/util/vof.h
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -56,7 +57,8 @@ class UVof {
const GRange<size_t>& layers, const Multi<const FieldCell<Scal>*>& fcu,
const Multi<const FieldCell<Scal>*>& fccl,
const Multi<const FieldCell<Vect>*>& fcn, std::string filename, Scal time,
bool bin, bool merge, Scal iso, const FieldCell<Scal>* fcus, M& m);
bool poly, bool bin, bool merge, Scal iso, const FieldCell<Scal>* fcus,
M& m);

// Computes unique color for each connected component over all layers.
// fcu: volume fraction
Expand Down
10 changes: 6 additions & 4 deletions src/util/vof.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,8 @@ struct UVof<M_>::Imp {
const GRange<size_t>& layers, const Multi<const FieldCell<Scal>*>& fcu,
const Multi<const FieldCell<Scal>*>& fccl,
const Multi<const FieldCell<Vect>*>& fcn, std::string filename, Scal time,
bool bin, bool merge, Scal iso, const FieldCell<Scal>* fcus, M& m) {
bool poly, bool bin, bool merge, Scal iso, const FieldCell<Scal>* fcus,
M& m) {
auto sem = m.GetSem("dumppolymarch");
struct {
std::vector<std::vector<Vect>> dl; // polygons
Expand Down Expand Up @@ -600,7 +601,7 @@ struct UVof<M_>::Imp {
<< " t=" << time << " to " << filename << std::endl;
WriteVtkPoly<Vect>(
filename, dl, &dln, {&dlc, &dll, &dlcl}, {"c", "l", "cl"},
"Interface from marching cubes", true, bin, merge);
"Interface from marching cubes", poly, bin, merge);
}
}
}
Expand Down Expand Up @@ -1174,9 +1175,10 @@ void UVof<M_>::DumpPolyMarch(
const GRange<size_t>& layers, const Multi<const FieldCell<Scal>*>& fcu,
const Multi<const FieldCell<Scal>*>& fccl,
const Multi<const FieldCell<Vect>*>& fcn, std::string filename, Scal t,
bool bin, bool merge, Scal iso, const FieldCell<Scal>* fcus, M& m) {
bool poly, bool bin, bool merge, Scal iso, const FieldCell<Scal>* 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 <class M_>
Expand Down

0 comments on commit 1a3809e

Please sign in to comment.