mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: MappedFile: ensure separate entry scopes (fixes #2098)
BUG: MappedFile: ensure rmap() and automap() consistent
This commit is contained in:
committed by
Andrew Heather
parent
53f6431c31
commit
c6759692ba
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -175,8 +175,13 @@ void Foam::PatchFunction1Types::MappedFile<Type>::autoMap
|
||||
if (startSampledValues_.size())
|
||||
{
|
||||
startSampledValues_.autoMap(mapper);
|
||||
}
|
||||
|
||||
if (endSampledValues_.size())
|
||||
{
|
||||
endSampledValues_.autoMap(mapper);
|
||||
}
|
||||
|
||||
// Clear interpolator
|
||||
mapperPtr_.clear();
|
||||
startSampleTime_ = -1;
|
||||
@ -196,8 +201,17 @@ void Foam::PatchFunction1Types::MappedFile<Type>::rmap
|
||||
const PatchFunction1Types::MappedFile<Type>& tiptf =
|
||||
refCast<const PatchFunction1Types::MappedFile<Type>>(pf1);
|
||||
|
||||
startSampledValues_.rmap(tiptf.startSampledValues_, addr);
|
||||
endSampledValues_.rmap(tiptf.endSampledValues_, addr);
|
||||
if (tiptf.startSampledValues_.size())
|
||||
{
|
||||
startSampledValues_.setSize(this->size());
|
||||
startSampledValues_.rmap(tiptf.startSampledValues_, addr);
|
||||
}
|
||||
|
||||
if (tiptf.endSampledValues_.size())
|
||||
{
|
||||
endSampledValues_.setSize(this->size());
|
||||
endSampledValues_.rmap(tiptf.endSampledValues_, addr);
|
||||
}
|
||||
|
||||
// Clear interpolator
|
||||
mapperPtr_.clear();
|
||||
@ -584,27 +598,11 @@ Foam::PatchFunction1Types::MappedFile<Type>::integrate
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::PatchFunction1Types::MappedFile<Type>::writeData
|
||||
void Foam::PatchFunction1Types::MappedFile<Type>::writeEntries
|
||||
(
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
PatchFunction1<Type>::writeData(os);
|
||||
|
||||
// Check if field name explicitly provided
|
||||
// (e.g. through timeVaryingMapped bc)
|
||||
if (dictConstructed_)
|
||||
{
|
||||
os.writeEntry(this->name(), type());
|
||||
|
||||
os.writeEntryIfDifferent
|
||||
(
|
||||
"fieldTable",
|
||||
this->name(),
|
||||
fieldTableName_
|
||||
);
|
||||
}
|
||||
|
||||
if (setAverage_)
|
||||
{
|
||||
os.writeEntry("setAverage", setAverage_);
|
||||
@ -628,4 +626,36 @@ void Foam::PatchFunction1Types::MappedFile<Type>::writeData
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::PatchFunction1Types::MappedFile<Type>::writeData
|
||||
(
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
PatchFunction1<Type>::writeData(os);
|
||||
|
||||
// Check if field name explicitly provided
|
||||
// (e.g. through timeVaryingMapped bc)
|
||||
if (dictConstructed_)
|
||||
{
|
||||
os.writeEntry(this->name(), type());
|
||||
|
||||
os.writeEntryIfDifferent
|
||||
(
|
||||
"fieldTable",
|
||||
this->name(),
|
||||
fieldTableName_
|
||||
);
|
||||
|
||||
os.beginBlock(word(this->name() + "Coeffs"));
|
||||
writeEntries(os);
|
||||
os.endBlock();
|
||||
}
|
||||
else
|
||||
{
|
||||
writeEntries(os);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -27,19 +27,34 @@ Class
|
||||
Foam::PatchFunction1Types::MappedFile
|
||||
|
||||
Description
|
||||
Patch value mapping from file
|
||||
Patch value mapping from a set of values stored in a file and
|
||||
a set of unstructured points using the following directory structure:
|
||||
|
||||
\verbatim
|
||||
constant/boundaryData/\<patchName\>/points
|
||||
constant/boundaryData/\<patchName\>/\<time\>/\<field\>
|
||||
\endverbatim
|
||||
|
||||
Options:
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
mapMethod | (nearest/planarInterpolation) | no | planarInterpolation
|
||||
offset | Time-varying offset values to interpolated data | no |
|
||||
fieldTable | Name of field data table | no | field-name
|
||||
points | The name of the points file | no | points
|
||||
perturb | Perturbation fraction of bounding box | no | 1e-5
|
||||
setAverage | adjust mapped field to maintain average value | no | false
|
||||
Property | Description | Type | Reqd | Deflt
|
||||
mapMethod | Mapping method | word | no <!--
|
||||
--> | planarInterpolation
|
||||
offset | Time-varying offset values to interpolated data <!--
|
||||
--> | Function1\<Type\> | no | -
|
||||
fieldTable | Name of field data table | word | no | field-name
|
||||
points | Name of the points file | word | no | points
|
||||
perturb | Perturbation fraction of bounding box | scalar | no | 1e-5
|
||||
setAverage | Adjust mapped field to maintain average value <!--
|
||||
--> | scalar | no | false
|
||||
\endtable
|
||||
|
||||
Options for the \c mapMethod entry:
|
||||
\verbatim
|
||||
nearest | Use nearest points only (avoids triangulation)
|
||||
planarInterpolation | Interpolation using 2D Delaunay triangulation
|
||||
\endverbatim
|
||||
|
||||
SourceFiles
|
||||
MappedFile.C
|
||||
|
||||
@ -229,6 +244,9 @@ public:
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write coefficient entries in dictionary format
|
||||
void writeEntries(Ostream& os) const;
|
||||
|
||||
//- Write in dictionary format
|
||||
virtual void writeData(Ostream& os) const;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user