mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: minor changes to rationalize sampledSurface
- make hasFaceId a top-level virtual method and remove keepIds equivalent from sampledTriSurfaceMesh. This makes the property available without casting. - New sampling type 'none'. Can be used to temporarily disable a sampling surface definition, or to provide boilerplate for overwriting later.
This commit is contained in:
@ -38,6 +38,7 @@ surfMeshSample/distanceSurface/surfMeshSampleDistanceSurface.C
|
|||||||
surfMeshSample/plane/surfMeshSamplePlane.C
|
surfMeshSample/plane/surfMeshSamplePlane.C
|
||||||
surfMeshSample/triSurfaceMesh/surfMeshSampleDiscrete.C
|
surfMeshSample/triSurfaceMesh/surfMeshSampleDiscrete.C
|
||||||
|
|
||||||
|
sampledSurface/sampledNone/sampledNone.C
|
||||||
sampledSurface/sampledPatch/sampledPatch.C
|
sampledSurface/sampledPatch/sampledPatch.C
|
||||||
sampledSurface/sampledPatchInternalField/sampledPatchInternalField.C
|
sampledSurface/sampledPatchInternalField/sampledPatchInternalField.C
|
||||||
sampledSurface/sampledPlane/sampledPlane.C
|
sampledSurface/sampledPlane/sampledPlane.C
|
||||||
|
|||||||
107
src/sampling/sampledSurface/sampledNone/sampledNone.C
Normal file
107
src/sampling/sampledSurface/sampledNone/sampledNone.C
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "sampledNone.H"
|
||||||
|
#include "dictionary.H"
|
||||||
|
#include "polyMesh.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(sampledNone, 0);
|
||||||
|
addNamedToRunTimeSelectionTable(sampledSurface, sampledNone, word, none);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::sampledNone::sampledNone()
|
||||||
|
:
|
||||||
|
sampledSurface(word::null, nullptr)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::sampledNone::sampledNone(const word& name)
|
||||||
|
:
|
||||||
|
sampledSurface(name, nullptr)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::sampledNone::sampledNone
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
sampledSurface(name, nullptr)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::sampledNone::needsUpdate() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::sampledNone::expire()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::sampledNone::update()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#undef makeDummy
|
||||||
|
#define makeDummy(Func,Type) \
|
||||||
|
Foam::tmp<Foam::Field<Foam::Type>> \
|
||||||
|
Foam::sampledNone::Func(const interpolation<Type>&) const \
|
||||||
|
{ \
|
||||||
|
return tmp<Field<Type>>::New(); \
|
||||||
|
}
|
||||||
|
|
||||||
|
makeDummy(sample, scalar);
|
||||||
|
makeDummy(sample, vector);
|
||||||
|
makeDummy(sample, sphericalTensor);
|
||||||
|
makeDummy(sample, symmTensor);
|
||||||
|
makeDummy(sample, tensor);
|
||||||
|
|
||||||
|
makeDummy(interpolate, scalar);
|
||||||
|
makeDummy(interpolate, vector);
|
||||||
|
makeDummy(interpolate, sphericalTensor);
|
||||||
|
makeDummy(interpolate, symmTensor);
|
||||||
|
makeDummy(interpolate, tensor);
|
||||||
|
|
||||||
|
#undef makeDummy
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
211
src/sampling/sampledSurface/sampledNone/sampledNone.H
Normal file
211
src/sampling/sampledSurface/sampledNone/sampledNone.H
Normal file
@ -0,0 +1,211 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::sampledNone
|
||||||
|
|
||||||
|
Description
|
||||||
|
A no operation sampledSurface that can be used when a sampler
|
||||||
|
is expected but is not desired. For example, to temporarily disable
|
||||||
|
a sampling definition, or to provide a boilerplate definition that
|
||||||
|
is overwritten at a later stage in a dictionary.
|
||||||
|
|
||||||
|
Usage
|
||||||
|
\table
|
||||||
|
Property | Description | Required | Default
|
||||||
|
type | 'none' | yes |
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
sampledNone.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef sampledNone_H
|
||||||
|
#define sampledNone_H
|
||||||
|
|
||||||
|
#include "sampledSurface.H"
|
||||||
|
#include "MeshedSurfaces.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class sampledNone Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class sampledNone
|
||||||
|
:
|
||||||
|
public meshedSurface,
|
||||||
|
public sampledSurface
|
||||||
|
{
|
||||||
|
typedef meshedSurface Mesh;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("sampledNone");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct null
|
||||||
|
explicit sampledNone();
|
||||||
|
|
||||||
|
//- Construct null, with specified name
|
||||||
|
explicit sampledNone(const word& name);
|
||||||
|
|
||||||
|
//- Construct null, with dictionary
|
||||||
|
sampledNone(const word& name, const polyMesh&, const dictionary&);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~sampledNone() = default;
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Does the surface need an update?
|
||||||
|
virtual bool needsUpdate() const;
|
||||||
|
|
||||||
|
//- Mark the surface as needing an update.
|
||||||
|
virtual bool expire();
|
||||||
|
|
||||||
|
//- Update the surface as required.
|
||||||
|
virtual bool update();
|
||||||
|
|
||||||
|
//- Points of surface
|
||||||
|
virtual const pointField& points() const
|
||||||
|
{
|
||||||
|
return Mesh::points();
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Faces of surface
|
||||||
|
virtual const faceList& faces() const
|
||||||
|
{
|
||||||
|
return Mesh::surfFaces();
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Const access to per-face zone/region information
|
||||||
|
virtual const labelList& zoneIds() const
|
||||||
|
{
|
||||||
|
return Foam::emptyLabelList;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Face area magnitudes
|
||||||
|
virtual const vectorField& Sf() const
|
||||||
|
{
|
||||||
|
return Mesh::Sf();
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Face area magnitudes
|
||||||
|
virtual const scalarField& magSf() const
|
||||||
|
{
|
||||||
|
return Mesh::magSf();
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Face centres
|
||||||
|
virtual const vectorField& Cf() const
|
||||||
|
{
|
||||||
|
return Mesh::Cf();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Sample
|
||||||
|
|
||||||
|
//- Sample volume field onto surface faces
|
||||||
|
virtual tmp<scalarField> sample
|
||||||
|
(
|
||||||
|
const interpolation<scalar>& sampler
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Sample volume field onto surface faces
|
||||||
|
virtual tmp<vectorField> sample
|
||||||
|
(
|
||||||
|
const interpolation<vector>& sampler
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Sample volume field onto surface faces
|
||||||
|
virtual tmp<sphericalTensorField> sample
|
||||||
|
(
|
||||||
|
const interpolation<sphericalTensor>& sampler
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Sample volume field onto surface faces
|
||||||
|
virtual tmp<symmTensorField> sample
|
||||||
|
(
|
||||||
|
const interpolation<symmTensor>& sampler
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Sample volume field onto surface faces
|
||||||
|
virtual tmp<tensorField> sample
|
||||||
|
(
|
||||||
|
const interpolation<tensor>& sampler
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
// Interpolate
|
||||||
|
|
||||||
|
//- Interpolate volume field onto surface points
|
||||||
|
virtual tmp<scalarField> interpolate
|
||||||
|
(
|
||||||
|
const interpolation<scalar>& interpolator
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Interpolate volume field onto surface points
|
||||||
|
virtual tmp<vectorField> interpolate
|
||||||
|
(
|
||||||
|
const interpolation<vector>& interpolator
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Interpolate volume field onto surface points
|
||||||
|
virtual tmp<sphericalTensorField> interpolate
|
||||||
|
(
|
||||||
|
const interpolation<sphericalTensor>& interpolator
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Interpolate volume field onto surface points
|
||||||
|
virtual tmp<symmTensorField> interpolate
|
||||||
|
(
|
||||||
|
const interpolation<symmTensor>& interpolator
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Interpolate volume field onto surface points
|
||||||
|
virtual tmp<tensorField> interpolate
|
||||||
|
(
|
||||||
|
const interpolation<tensor>& interpolator
|
||||||
|
) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -27,7 +27,6 @@ License
|
|||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "demandDrivenData.H"
|
#include "demandDrivenData.H"
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
@ -37,7 +36,7 @@ namespace Foam
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::sampledSurface::clearGeom() const
|
void Foam::sampledSurface::clearGeom() const
|
||||||
{
|
{
|
||||||
@ -79,6 +78,15 @@ Foam::autoPtr<Foam::sampledSurface> Foam::sampledSurface::New
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::sampledSurface::sampledSurface(const word& name, std::nullptr_t)
|
||||||
|
:
|
||||||
|
name_(name),
|
||||||
|
mesh_(NullObjectRef<polyMesh>()),
|
||||||
|
interpolate_(false),
|
||||||
|
area_(-1)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::sampledSurface::sampledSurface
|
Foam::sampledSurface::sampledSurface
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
@ -123,8 +131,7 @@ Foam::scalar Foam::sampledSurface::area() const
|
|||||||
{
|
{
|
||||||
if (area_ < 0)
|
if (area_ < 0)
|
||||||
{
|
{
|
||||||
area_ = sum(magSf());
|
area_ = gSum(magSf());
|
||||||
reduce(area_, sumOp<scalar>());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return area_;
|
return area_;
|
||||||
@ -187,7 +194,7 @@ void Foam::sampledSurface::print(Ostream& os) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::Ostream& Foam::operator<<(Ostream& os, const sampledSurface& s)
|
Foam::Ostream& Foam::operator<<(Ostream& os, const sampledSurface& s)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -70,12 +70,6 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declarations
|
|
||||||
|
|
||||||
class sampledSurface;
|
|
||||||
Ostream& operator<<(Ostream& os, const sampledSurface& s);
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class sampledSurface Declaration
|
Class sampledSurface Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -84,6 +78,8 @@ class sampledSurface
|
|||||||
:
|
:
|
||||||
public meshedSurf
|
public meshedSurf
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Name of sample surface
|
//- Name of sample surface
|
||||||
@ -127,6 +123,8 @@ protected:
|
|||||||
|
|
||||||
virtual void clearGeom() const;
|
virtual void clearGeom() const;
|
||||||
|
|
||||||
|
//- Construct null
|
||||||
|
explicit sampledSurface(const word& name, std::nullptr_t);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -180,7 +178,7 @@ public:
|
|||||||
sampledSurface
|
sampledSurface
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const polyMesh&,
|
const polyMesh& mesh,
|
||||||
const bool interpolate = false
|
const bool interpolate = false
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -188,8 +186,8 @@ public:
|
|||||||
sampledSurface
|
sampledSurface
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const polyMesh&,
|
const polyMesh& mesh,
|
||||||
const dictionary&
|
const dictionary& dict
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Clone
|
//- Clone
|
||||||
@ -206,8 +204,8 @@ public:
|
|||||||
static autoPtr<sampledSurface> New
|
static autoPtr<sampledSurface> New
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const polyMesh&,
|
const polyMesh& mesh,
|
||||||
const dictionary&
|
const dictionary& dict
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -267,6 +265,21 @@ public:
|
|||||||
//- The total surface area
|
//- The total surface area
|
||||||
scalar area() const;
|
scalar area() const;
|
||||||
|
|
||||||
|
//- If element ids/order of the original surface are available
|
||||||
|
virtual bool hasFaceIds() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- List of element ids/order of the original surface,
|
||||||
|
//- when hasFaceIds is true.
|
||||||
|
const labelList& originalIds() const
|
||||||
|
{
|
||||||
|
return Foam::emptyLabelList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Sample (faces)
|
||||||
|
|
||||||
//- Sample volume field onto surface faces
|
//- Sample volume field onto surface faces
|
||||||
virtual tmp<scalarField> sample
|
virtual tmp<scalarField> sample
|
||||||
@ -330,6 +343,8 @@ public:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
// Interpolate (points)
|
||||||
|
|
||||||
//- Interpolate volume field onto surface points
|
//- Interpolate volume field onto surface points
|
||||||
virtual tmp<scalarField> interpolate
|
virtual tmp<scalarField> interpolate
|
||||||
(
|
(
|
||||||
@ -374,12 +389,14 @@ public:
|
|||||||
|
|
||||||
//- Print information
|
//- Print information
|
||||||
virtual void print(Ostream& os) const;
|
virtual void print(Ostream& os) const;
|
||||||
|
|
||||||
//- Ostream operator
|
|
||||||
friend Ostream& operator<<(Ostream& os, const sampledSurface& s);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Global Operators
|
||||||
|
|
||||||
|
//- Ostream operator
|
||||||
|
Ostream& operator<<(Ostream& os, const sampledSurface& s);
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|||||||
@ -58,7 +58,7 @@ Foam::scalar Foam::sampledSurfaces::mergeTol_ = 1e-10;
|
|||||||
void Foam::sampledSurfaces::writeGeometry() const
|
void Foam::sampledSurfaces::writeGeometry() const
|
||||||
{
|
{
|
||||||
// Write to time directory under outputPath_
|
// Write to time directory under outputPath_
|
||||||
// Skip surface without faces (eg, a failed cut-plane)
|
// Skip surfaces without faces (eg, a failed cut-plane)
|
||||||
|
|
||||||
const fileName outputDir = outputPath_/time_.timeName();
|
const fileName outputDir = outputPath_/time_.timeName();
|
||||||
|
|
||||||
@ -95,23 +95,18 @@ void Foam::sampledSurfaces::writeOriginalIds()
|
|||||||
{
|
{
|
||||||
const sampledSurface& s = operator[](surfi);
|
const sampledSurface& s = operator[](surfi);
|
||||||
|
|
||||||
if (isA<sampledTriSurfaceMesh>(s))
|
if (s.hasFaceIds())
|
||||||
{
|
{
|
||||||
const sampledTriSurfaceMesh& surf =
|
const labelList& idLst = s.originalIds();
|
||||||
dynamicCast<const sampledTriSurfaceMesh&>(s);
|
|
||||||
|
|
||||||
if (surf.keepIds())
|
// Transcribe from label to scalar
|
||||||
|
Field<scalar> ids(idLst.size());
|
||||||
|
forAll(idLst, i)
|
||||||
{
|
{
|
||||||
const labelList& idLst = surf.originalIds();
|
ids[i] = idLst[i];
|
||||||
|
|
||||||
Field<scalar> ids(idLst.size());
|
|
||||||
forAll(idLst, i)
|
|
||||||
{
|
|
||||||
ids[i] = idLst[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
writeSurface(ids, surfi, fieldName, outputDir);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
writeSurface(ids, surfi, fieldName, outputDir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -130,25 +125,17 @@ Foam::sampledSurfaces::sampledSurfaces
|
|||||||
PtrList<sampledSurface>(),
|
PtrList<sampledSurface>(),
|
||||||
mesh_(refCast<const fvMesh>(obr_)),
|
mesh_(refCast<const fvMesh>(obr_)),
|
||||||
loadFromFiles_(false),
|
loadFromFiles_(false),
|
||||||
outputPath_(fileName::null),
|
outputPath_
|
||||||
|
(
|
||||||
|
time_.globalPath()/functionObject::outputPrefix/name
|
||||||
|
),
|
||||||
fieldSelection_(),
|
fieldSelection_(),
|
||||||
sampleFaceScheme_(word::null),
|
sampleFaceScheme_(),
|
||||||
sampleNodeScheme_(word::null),
|
sampleNodeScheme_(),
|
||||||
mergedList_(),
|
mergedList_(),
|
||||||
changedGeom_(),
|
changedGeom_(),
|
||||||
formatter_(nullptr)
|
formatter_(nullptr)
|
||||||
{
|
{
|
||||||
const fileName relPath(functionObject::outputPrefix/name);
|
|
||||||
|
|
||||||
if (Pstream::parRun())
|
|
||||||
{
|
|
||||||
outputPath_ = mesh_.time().path()/".."/relPath;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
outputPath_ = mesh_.time().path()/relPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
outputPath_.clean(); // Remove unneeded ".."
|
outputPath_.clean(); // Remove unneeded ".."
|
||||||
|
|
||||||
read(dict);
|
read(dict);
|
||||||
@ -167,39 +154,23 @@ Foam::sampledSurfaces::sampledSurfaces
|
|||||||
PtrList<sampledSurface>(),
|
PtrList<sampledSurface>(),
|
||||||
mesh_(refCast<const fvMesh>(obr)),
|
mesh_(refCast<const fvMesh>(obr)),
|
||||||
loadFromFiles_(loadFromFiles),
|
loadFromFiles_(loadFromFiles),
|
||||||
outputPath_(fileName::null),
|
outputPath_
|
||||||
|
(
|
||||||
|
time_.globalPath()/functionObject::outputPrefix/name
|
||||||
|
),
|
||||||
fieldSelection_(),
|
fieldSelection_(),
|
||||||
sampleFaceScheme_(word::null),
|
sampleFaceScheme_(),
|
||||||
sampleNodeScheme_(word::null),
|
sampleNodeScheme_(),
|
||||||
mergedList_(),
|
mergedList_(),
|
||||||
changedGeom_(),
|
changedGeom_(),
|
||||||
formatter_(nullptr)
|
formatter_(nullptr)
|
||||||
{
|
{
|
||||||
read(dict);
|
|
||||||
|
|
||||||
const fileName relPath(functionObject::outputPrefix/name);
|
|
||||||
|
|
||||||
if (Pstream::parRun())
|
|
||||||
{
|
|
||||||
outputPath_ = time_.path()/".."/relPath;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
outputPath_ = time_.path()/relPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
outputPath_.clean(); // Remove unneeded ".."
|
outputPath_.clean(); // Remove unneeded ".."
|
||||||
|
|
||||||
read(dict);
|
read(dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::sampledSurfaces::~sampledSurfaces()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::sampledSurfaces::verbose(const bool verbosity)
|
void Foam::sampledSurfaces::verbose(const bool verbosity)
|
||||||
@ -388,13 +359,13 @@ bool Foam::sampledSurfaces::expire()
|
|||||||
|
|
||||||
bool Foam::sampledSurfaces::update()
|
bool Foam::sampledSurfaces::update()
|
||||||
{
|
{
|
||||||
bool updated = false;
|
|
||||||
|
|
||||||
if (!needsUpdate())
|
if (!needsUpdate())
|
||||||
{
|
{
|
||||||
return updated;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool updated = false;
|
||||||
|
|
||||||
// Serial: quick and easy, no merging required
|
// Serial: quick and easy, no merging required
|
||||||
if (!Pstream::parRun())
|
if (!Pstream::parRun())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -178,6 +178,17 @@ class sampledSurfaces
|
|||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Return the surfaces
|
||||||
|
const PtrList<sampledSurface>& surfaces() const
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return the surfaces
|
||||||
|
PtrList<sampledSurface>& surfaces()
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
//- Return number of fields
|
//- Return number of fields
|
||||||
label classifyFields();
|
label classifyFields();
|
||||||
@ -251,7 +262,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~sampledSurfaces();
|
virtual ~sampledSurfaces() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|||||||
@ -288,14 +288,14 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- If element ids/order of the original surface are kept
|
//- If element ids/order of the original surface are kept
|
||||||
bool keepIds() const
|
virtual bool hasFaceIds() const
|
||||||
{
|
{
|
||||||
return keepIds_;
|
return keepIds_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- List of element ids/order of the original surface,
|
//- List of element ids/order of the original surface,
|
||||||
// when keepIds is active.
|
// when keepIds is active.
|
||||||
const labelList& originalIds() const
|
virtual const labelList& originalIds() const
|
||||||
{
|
{
|
||||||
return originalIds_;
|
return originalIds_;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -180,14 +180,14 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- If element ids/order of the original surface are kept
|
//- If element ids/order of the original surface are kept
|
||||||
bool keepIds() const
|
virtual bool hasFaceIds() const
|
||||||
{
|
{
|
||||||
return MeshStorage::keepIds();
|
return MeshStorage::hasFaceIds();
|
||||||
}
|
}
|
||||||
|
|
||||||
//- List of element ids/order of the original surface,
|
//- List of element ids/order of the original surface,
|
||||||
// when keepIds is active.
|
// when keepIds is active.
|
||||||
const labelList& originalIds() const
|
virtual const labelList& originalIds() const
|
||||||
{
|
{
|
||||||
return MeshStorage::originalIds();
|
return MeshStorage::originalIds();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -651,8 +651,8 @@ Foam::discreteSurface::discreteSurface
|
|||||||
keepIds_(false),
|
keepIds_(false),
|
||||||
originalIds_(),
|
originalIds_(),
|
||||||
zoneIds_(),
|
zoneIds_(),
|
||||||
sampleElements_(0),
|
sampleElements_(),
|
||||||
samplePoints_(0)
|
samplePoints_()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -689,8 +689,8 @@ Foam::discreteSurface::discreteSurface
|
|||||||
keepIds_(dict.lookupOrDefault("keepIds", false)),
|
keepIds_(dict.lookupOrDefault("keepIds", false)),
|
||||||
originalIds_(),
|
originalIds_(),
|
||||||
zoneIds_(),
|
zoneIds_(),
|
||||||
sampleElements_(0),
|
sampleElements_(),
|
||||||
samplePoints_(0)
|
samplePoints_()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -726,8 +726,8 @@ Foam::discreteSurface::discreteSurface
|
|||||||
keepIds_(false),
|
keepIds_(false),
|
||||||
originalIds_(),
|
originalIds_(),
|
||||||
zoneIds_(),
|
zoneIds_(),
|
||||||
sampleElements_(0),
|
sampleElements_(),
|
||||||
samplePoints_(0)
|
samplePoints_()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -275,26 +275,24 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- If element ids/order of the original surface are kept
|
//- If element ids/order of the original surface are kept
|
||||||
bool keepIds() const
|
virtual bool hasFaceIds() const
|
||||||
{
|
{
|
||||||
return keepIds_;
|
return keepIds_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- List of element ids/order of the original surface,
|
//- List of element ids/order of the original surface,
|
||||||
// when keepIds is active.
|
// when keepIds is active.
|
||||||
const labelList& originalIds() const
|
virtual const labelList& originalIds() const
|
||||||
{
|
{
|
||||||
return originalIds_;
|
return originalIds_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Sampling boundary values instead of cell values
|
//- Sampling boundary values instead of cell values
|
||||||
bool onBoundary() const
|
bool onBoundary() const
|
||||||
{
|
{
|
||||||
return sampleSource_ == boundaryFaces;
|
return sampleSource_ == boundaryFaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- From local surface face to mesh cell/face.
|
//- From local surface face to mesh cell/face.
|
||||||
const labelList& sampleElements() const
|
const labelList& sampleElements() const
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user