isoSurfaceBaseNew.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2020 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "isoSurfaceBase.H"
29 #include "isoSurfaceCell.H"
30 #include "isoSurfacePoint.H"
31 #include "isoSurfaceTopo.H"
32 
33 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
34 
37 (
38  const isoSurfaceParams& params,
39  const volScalarField& cellValues,
40  const scalarField& pointValues,
41  const scalar iso,
42  const bitSet& ignoreCells
43 )
44 {
46 
47  if (params.algorithm() == isoSurfaceParams::ALGO_POINT)
48  {
49  ptr.reset
50  (
51  new isoSurfacePoint
52  (
53  /* fvMesh implicit from cellValues */
54  cellValues,
55  pointValues,
56  iso,
57  params,
58  ignoreCells // unused
59  )
60  );
61  }
62  else if (params.algorithm() == isoSurfaceParams::ALGO_CELL)
63  {
64  ptr.reset
65  (
66  new isoSurfaceCell
67  (
68  cellValues.mesh(), // polyMesh
69  cellValues.primitiveField(),
70  pointValues,
71  iso,
72  params,
73  ignoreCells
74  )
75  );
76  }
77  else
78  {
79  // ALGO_TOPO, ALGO_DEFAULT
80  ptr.reset
81  (
82  new isoSurfaceTopo
83  (
84  cellValues.mesh(), // polyMesh
85  cellValues.primitiveField(),
86  pointValues,
87  iso,
88  params,
89  ignoreCells
90  )
91  );
92  }
93 
94  // Cannot really fail (with current logic)
95  // if (!ptr)
96  // {
97  // FatalErrorInFunction
98  // << "Unknown iso-surface algorithm ("
99  // << int(params.algorithm()) << ")\n"
100  // << exit(FatalError);
101  // }
102 
103  return ptr;
104 }
105 
106 
107 // ************************************************************************* //
Foam::isoSurfaceBase::New
static autoPtr< isoSurfaceBase > New(const isoSurfaceParams &params, const volScalarField &cellValues, const scalarField &pointValues, const scalar iso, const bitSet &ignoreCells=bitSet())
Create for specified algorithm type.
Definition: isoSurfaceBaseNew.C:37
isoSurfaceTopo.H
Foam::bitSet
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition: bitSet.H:63
isoSurfaceCell.H
Foam::isoSurfaceParams::algorithm
algorithmType algorithm() const noexcept
Get current algorithm.
Definition: isoSurfaceParams.H:213
Foam::GeometricField::primitiveField
const Internal::FieldType & primitiveField() const
Return a const-reference to the internal field.
Definition: GeometricFieldI.H:53
isoSurfaceBase.H
Foam::isoSurfaceCell
A surface formed by the iso value. After "Polygonising A Scalar Field Using Tetrahedrons",...
Definition: isoSurfaceCell.H:66
Foam::isoSurfacePoint
A surface formed by the iso value. After "Regularised Marching Tetrahedra: improved iso-surface extra...
Definition: isoSurfacePoint.H:87
Foam::Field< scalar >
isoSurfacePoint.H
Foam::isoSurfaceParams
Preferences for controlling iso-surface algorithms.
Definition: isoSurfaceParams.H:107
Foam::autoPtr::reset
void reset(autoPtr< T > &&other) noexcept
Delete managed object and set to new given pointer.
Definition: autoPtrI.H:117
Foam::autoPtr< Foam::isoSurfaceBase >
Foam::isoSurfaceTopo
Marching tet iso surface algorithm with optional filtering to keep only points originating from mesh ...
Definition: isoSurfaceTopo.H:59
Foam::GeometricField< scalar, fvPatchField, volMesh >