Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
003e62fa
Commit
003e62fa
authored
Feb 29, 2012
by
mattijs
Browse files
ENH: distanceSurface: use either cell (default) or cross-cell isosurface
parent
644dfbbf
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/sampling/sampledSurface/distanceSurface/distanceSurface.C
View file @
003e62fa
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011
-2012
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -49,6 +49,8 @@ void Foam::distanceSurface::createGeometry()
// Clear any stored topologies
facesPtr_
.
clear
();
isoSurfCellPtr_
.
clear
();
isoSurfPtr_
.
clear
();
// Clear derived data
clearGeom
();
...
...
@@ -265,24 +267,33 @@ void Foam::distanceSurface::createGeometry()
//- Direct from cell field and point field.
i
soSurfPtr_
.
reset
(
new
isoSurf
ace
i
f
(
cell_
)
{
isoSurf
CellPtr_
.
reset
(
cellDistance
,
pointDistance_
,
distance_
,
regularise_
)
//new isoSurfaceCell
//(
// fvm,
// cellDistance,
// pointDistance_,
// distance_,
// regularise_
//)
);
new
isoSurfaceCell
(
fvm
,
cellDistance
,
pointDistance_
,
distance_
,
regularise_
)
);
}
else
{
isoSurfPtr_
.
reset
(
new
isoSurface
(
cellDistance
,
pointDistance_
,
distance_
,
regularise_
)
);
}
if
(
debug
)
{
...
...
@@ -321,10 +332,12 @@ Foam::distanceSurface::distanceSurface
),
distance_
(
readScalar
(
dict
.
lookup
(
"distance"
))),
signed_
(
readBool
(
dict
.
lookup
(
"signed"
))),
cell_
(
dict
.
lookupOrDefault
(
"cell"
,
true
)),
regularise_
(
dict
.
lookupOrDefault
(
"regularise"
,
true
)),
average_
(
dict
.
lookupOrDefault
(
"average"
,
false
)),
zoneKey_
(
keyType
::
null
),
needsUpdate_
(
true
),
isoSurfCellPtr_
(
NULL
),
isoSurfPtr_
(
NULL
),
facesPtr_
(
NULL
)
{
...
...
@@ -338,6 +351,52 @@ Foam::distanceSurface::distanceSurface
}
Foam
::
distanceSurface
::
distanceSurface
(
const
word
&
name
,
const
polyMesh
&
mesh
,
const
bool
interpolate
,
const
word
&
surfaceType
,
const
word
&
surfaceName
,
const
scalar
distance
,
const
bool
signedDistance
,
const
bool
cell
,
const
Switch
regularise
,
const
Switch
average
)
:
sampledSurface
(
name
,
mesh
,
interpolate
),
surfPtr_
(
searchableSurface
::
New
(
surfaceType
,
IOobject
(
surfaceName
,
// name
mesh
.
time
().
constant
(),
// directory
"triSurface"
,
// instance
mesh
.
time
(),
// registry
IOobject
::
MUST_READ
,
IOobject
::
NO_WRITE
),
dictionary
()
)
),
distance_
(
distance
),
signed_
(
signedDistance
),
cell_
(
cell
),
regularise_
(
regularise
),
average_
(
average
),
zoneKey_
(
keyType
::
null
),
needsUpdate_
(
true
),
isoSurfCellPtr_
(
NULL
),
isoSurfPtr_
(
NULL
),
facesPtr_
(
NULL
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam
::
distanceSurface
::~
distanceSurface
()
...
...
src/sampling/sampledSurface/distanceSurface/distanceSurface.H
View file @
003e62fa
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011
-2012
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -27,6 +27,8 @@ Class
Description
A sampledSurface defined by a distance to a surface.
Uses either isoSurfaceCell or isoSurface.
SourceFiles
distanceSurface.C
...
...
@@ -37,7 +39,7 @@ SourceFiles
#include "sampledSurface.H"
#include "searchableSurface.H"
//
#include "isoSurfaceCell.H"
#include "isoSurfaceCell.H"
#include "isoSurface.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -64,6 +66,9 @@ class distanceSurface
//- signed distance
const
bool
signed_
;
//- Whether to use isoSurfaceCell or isoSurface
const
bool
cell_
;
//- Whether to coarsen
const
Switch
regularise_
;
...
...
@@ -84,7 +89,9 @@ class distanceSurface
scalarField
pointDistance_
;
//- Constructed iso surface
//autoPtr<isoSurfaceCell> isoSurfPtr_;
autoPtr
<
isoSurfaceCell
>
isoSurfCellPtr_
;
//- Constructed iso surface
autoPtr
<
isoSurface
>
isoSurfPtr_
;
//- triangles converted to faceList
...
...
@@ -125,6 +132,21 @@ public:
const
dictionary
&
dict
);
//- Construct from components
distanceSurface
(
const
word
&
name
,
const
polyMesh
&
mesh
,
const
bool
interpolate
,
const
word
&
surfaceType
,
const
word
&
surfaceName
,
const
scalar
distance
,
const
bool
signedDistance
,
const
bool
cell
,
const
Switch
regularise
,
const
Switch
average
);
//- Destructor
virtual
~
distanceSurface
();
...
...
@@ -167,11 +189,16 @@ public:
return
facesPtr_
;
}
//const isoSurfaceCell& surface() const
const
isoSurface
&
surface
()
const
const
triSurface
&
surface
()
const
{
return
isoSurfPtr_
();
if
(
cell_
)
{
return
isoSurfCellPtr_
();
}
else
{
return
isoSurfPtr_
();
}
}
//- sample field on surface
...
...
src/sampling/sampledSurface/distanceSurface/distanceSurfaceTemplates.C
View file @
003e62fa
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011
-2012
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -37,7 +37,20 @@ Foam::distanceSurface::sampleField
const
GeometricField
<
Type
,
fvPatchField
,
volMesh
>&
vField
)
const
{
return
tmp
<
Field
<
Type
>
>
(
new
Field
<
Type
>
(
vField
,
surface
().
meshCells
()));
if
(
cell_
)
{
return
tmp
<
Field
<
Type
>
>
(
new
Field
<
Type
>
(
vField
,
isoSurfCellPtr_
().
meshCells
())
);
}
else
{
return
tmp
<
Field
<
Type
>
>
(
new
Field
<
Type
>
(
vField
,
isoSurfPtr_
().
meshCells
())
);
}
}
...
...
@@ -60,15 +73,30 @@ Foam::distanceSurface::interpolateField
);
// Sample.
return
surface
().
interpolate
(
if
(
cell_
)
{
return
isoSurfCellPtr_
().
interpolate
(
average_
?
pointAverage
(
pointFld
())()
:
volFld
),
pointFld
()
);
(
average_
?
pointAverage
(
pointFld
())()
:
volFld
),
pointFld
()
);
}
else
{
return
isoSurfPtr_
().
interpolate
(
(
average_
?
pointAverage
(
pointFld
())()
:
volFld
),
pointFld
()
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment