mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
GIT: resolved merge conflict
This commit is contained in:
@ -85,7 +85,7 @@ class sampledDistanceSurface
|
||||
// Private data
|
||||
|
||||
//- Whether to recalculate cell values as average of point values
|
||||
const Switch average_;
|
||||
const bool average_;
|
||||
|
||||
//- Track if the surface needs an update
|
||||
mutable bool needsUpdate_;
|
||||
|
||||
@ -98,11 +98,11 @@ class sampledIsoSurface
|
||||
//- Merge tolerance
|
||||
const scalar mergeTol_;
|
||||
|
||||
//- Whether to coarse
|
||||
const Switch regularise_;
|
||||
//- Whether to coarsen
|
||||
const bool regularise_;
|
||||
|
||||
//- Whether to recalculate cell values as average of point values
|
||||
const Switch average_;
|
||||
const bool average_;
|
||||
|
||||
//- Zone name/index (if restricted to zones)
|
||||
mutable cellZoneID zoneID_;
|
||||
|
||||
@ -97,10 +97,10 @@ class sampledIsoSurfaceCell
|
||||
const boundBox bounds_;
|
||||
|
||||
//- Whether to coarse
|
||||
const Switch regularise_;
|
||||
const bool regularise_;
|
||||
|
||||
//- Whether to recalculate cell values as average of point values
|
||||
const Switch average_;
|
||||
const bool average_;
|
||||
|
||||
//- If restricted to zones, name of this zone or a regular expression
|
||||
keyType zoneKey_;
|
||||
|
||||
@ -102,10 +102,10 @@ class sampledCuttingPlane
|
||||
const scalar mergeTol_;
|
||||
|
||||
//- Whether to coarsen
|
||||
const Switch regularise_;
|
||||
const bool regularise_;
|
||||
|
||||
//- Whether to recalculate cell values as average of point values
|
||||
const Switch average_;
|
||||
const bool average_;
|
||||
|
||||
//- Zone name/index (if restricted to zones)
|
||||
mutable cellZoneID zoneID_;
|
||||
|
||||
@ -58,14 +58,14 @@ Foam::sampledTriSurfaceMesh::sampleOnFaces
|
||||
auto& values = tvalues.ref();
|
||||
|
||||
const polyBoundaryMesh& pbm = mesh().boundaryMesh();
|
||||
|
||||
const label nBnd = mesh().nFaces()-mesh().nInternalFaces();
|
||||
|
||||
// Create flat boundary field
|
||||
const label nBnd = mesh().nFaces()-mesh().nInternalFaces();
|
||||
|
||||
Field<Type> bVals(nBnd, Zero);
|
||||
|
||||
const auto& bField = sampler.psi().boundaryField();
|
||||
|
||||
forAll(bField, patchi)
|
||||
{
|
||||
const label bFacei = (pbm[patchi].start() - mesh().nInternalFaces());
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -91,6 +91,13 @@ class surfMeshSampleDiscrete
|
||||
//- Transfer mesh content from SurfaceSource to surfMesh
|
||||
void transferContent();
|
||||
|
||||
//- Sample field (from volume field) onto surface faces
|
||||
template<class Type>
|
||||
tmp<Field<Type>> sampleOnFaces
|
||||
(
|
||||
const interpolation<Type>& sampler
|
||||
) const;
|
||||
|
||||
//- Sample field on surface.
|
||||
template<class Type>
|
||||
bool sampleType
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -24,11 +24,32 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "surfMeshSampleDiscrete.H"
|
||||
#include "dimensionedType.H"
|
||||
#include "error.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::surfMeshSampleDiscrete::sampleOnFaces
|
||||
(
|
||||
const interpolation<Type>& sampler
|
||||
) const
|
||||
{
|
||||
if (onBoundary())
|
||||
{
|
||||
return SurfaceSource::sampleOnFaces(sampler);
|
||||
}
|
||||
|
||||
// Sample cells
|
||||
return surfMeshSample::sampleOnFaces
|
||||
(
|
||||
sampler,
|
||||
sampleElements(), //< sampleElements == meshCells
|
||||
surface().faces(),
|
||||
surface().points()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
bool Foam::surfMeshSampleDiscrete::sampleType
|
||||
(
|
||||
@ -38,7 +59,7 @@ bool Foam::surfMeshSampleDiscrete::sampleType
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
||||
|
||||
const auto volFldPtr =
|
||||
const auto* volFldPtr =
|
||||
SurfaceSource::mesh().lookupObjectPtr<VolFieldType>(fieldName);
|
||||
|
||||
if (!volFldPtr)
|
||||
@ -48,52 +69,11 @@ bool Foam::surfMeshSampleDiscrete::sampleType
|
||||
|
||||
auto samplerPtr = interpolation<Type>::New(sampleScheme, *volFldPtr);
|
||||
|
||||
getOrCreateSurfField<Type>(*volFldPtr).field()
|
||||
= SurfaceSource::sampleOnFaces(*samplerPtr);
|
||||
getOrCreateSurfField<Type>(*volFldPtr).field() =
|
||||
sampleOnFaces(*samplerPtr);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// template<class Type>
|
||||
// Foam::tmp<Foam::DimensionedField<Type, Foam::surfGeoMesh>>
|
||||
// Foam::surfMeshSampleDiscrete::sampleOnFaces
|
||||
// (
|
||||
// const GeometricField<Type, fvPatchField, volMesh>& fld
|
||||
// ) const
|
||||
// {
|
||||
// typedef DimensionedField<Type, surfGeoMesh> SurfFieldType;
|
||||
//
|
||||
// tmp<Field<Type>> tfield = SurfaceSource::sampleOnFaces(fld);
|
||||
// SurfFieldType& result = getOrCreateSurfField<Type>(fld);
|
||||
//
|
||||
// // need to verify if this will be needed (in the future)
|
||||
// const surfMesh& s = surface();
|
||||
// if (result.size() != s.size())
|
||||
// {
|
||||
// // maybe resampling changed the surfMesh,
|
||||
// // but the existing surfField wasn't updated
|
||||
//
|
||||
// result.resize(s.size(), Zero);
|
||||
// }
|
||||
//
|
||||
// if (result.size() != sampleElements().size())
|
||||
// {
|
||||
// FatalErrorInFunction
|
||||
// << "mismatch in field/mesh sizes "
|
||||
// << result.name() << nl
|
||||
// << " field has " << result.size()
|
||||
// << " but sampleElements has " << sampleElements().size() << nl
|
||||
// << endl
|
||||
// << exit(FatalError);
|
||||
//
|
||||
// Info<< "WARNING: "
|
||||
// << endl;
|
||||
// }
|
||||
//
|
||||
// result = tfield;
|
||||
// return result;
|
||||
// }
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -66,7 +66,7 @@ Foam::distanceSurface::distanceSurface
|
||||
)
|
||||
),
|
||||
distance_(readScalar(dict.lookup("distance"))),
|
||||
signed_(readBool(dict.lookup("signed"))),
|
||||
signed_(dict.get<bool>("signed")),
|
||||
cell_(dict.lookupOrDefault("cell", true)),
|
||||
regularise_(dict.lookupOrDefault("regularise", true)),
|
||||
bounds_(dict.lookupOrDefault("bounds", boundBox::invertedBox)),
|
||||
@ -85,7 +85,7 @@ Foam::distanceSurface::distanceSurface
|
||||
const scalar distance,
|
||||
const bool signedDistance,
|
||||
const bool cell,
|
||||
const Switch regularise,
|
||||
const bool regularise,
|
||||
const boundBox& bounds
|
||||
)
|
||||
:
|
||||
|
||||
@ -84,7 +84,7 @@ class distanceSurface
|
||||
const bool cell_;
|
||||
|
||||
//- Whether to coarsen
|
||||
const Switch regularise_;
|
||||
const bool regularise_;
|
||||
|
||||
//- Optional bounding box to trim triangles against
|
||||
const boundBox bounds_;
|
||||
@ -131,7 +131,7 @@ public:
|
||||
const scalar distance,
|
||||
const bool signedDistance,
|
||||
const bool cell,
|
||||
const Switch regularise,
|
||||
const bool regularise,
|
||||
const boundBox& bounds = boundBox::invertedBox
|
||||
);
|
||||
|
||||
|
||||
@ -122,7 +122,7 @@ class isoSurface
|
||||
const scalar iso_;
|
||||
|
||||
//- Regularise?
|
||||
const Switch regularise_;
|
||||
const bool regularise_;
|
||||
|
||||
//- Optional bounds
|
||||
const boundBox bounds_;
|
||||
|
||||
@ -744,6 +744,7 @@ bool Foam::discreteSurface::interpolate() const
|
||||
return interpolate_;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::discreteSurface::interpolate(bool b)
|
||||
{
|
||||
if (interpolate_ == b)
|
||||
|
||||
@ -175,24 +175,26 @@ Foam::discreteSurface::sampleOnFaces
|
||||
|
||||
Field<Type> bVals(nBnd, Zero);
|
||||
|
||||
forAll(vField.boundaryField(), patchi)
|
||||
const auto& bField = vField.boundaryField();
|
||||
|
||||
forAll(bField, patchi)
|
||||
{
|
||||
label bFacei = pbm[patchi].start() - mesh().nInternalFaces();
|
||||
const label bFacei = pbm[patchi].start() - mesh().nInternalFaces();
|
||||
|
||||
SubList<Type>
|
||||
(
|
||||
bVals,
|
||||
vField.boundaryField()[patchi].size(),
|
||||
bField[patchi].size(),
|
||||
bFacei
|
||||
) = vField.boundaryField()[patchi];
|
||||
) = bField[patchi];
|
||||
}
|
||||
|
||||
// Sample in flat boundary field
|
||||
|
||||
for (label i=0; i < len; ++i)
|
||||
{
|
||||
label facei = elements[i];
|
||||
values[i] = bVals[facei-mesh().nInternalFaces()];
|
||||
const label bFacei = (elements[i] - mesh().nInternalFaces());
|
||||
values[i] = bVals[bFacei];
|
||||
}
|
||||
}
|
||||
|
||||
@ -230,7 +232,7 @@ Foam::discreteSurface::sampleOnPoints
|
||||
|
||||
forAll(samplePoints_, pointi)
|
||||
{
|
||||
label facei = sampleElements_[pointi];
|
||||
const label facei = sampleElements_[pointi];
|
||||
|
||||
values[pointi] = interpolator.interpolate
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user