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
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -175,8 +175,13 @@ void Foam::PatchFunction1Types::MappedFile<Type>::autoMap
|
|||||||
if (startSampledValues_.size())
|
if (startSampledValues_.size())
|
||||||
{
|
{
|
||||||
startSampledValues_.autoMap(mapper);
|
startSampledValues_.autoMap(mapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endSampledValues_.size())
|
||||||
|
{
|
||||||
endSampledValues_.autoMap(mapper);
|
endSampledValues_.autoMap(mapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear interpolator
|
// Clear interpolator
|
||||||
mapperPtr_.clear();
|
mapperPtr_.clear();
|
||||||
startSampleTime_ = -1;
|
startSampleTime_ = -1;
|
||||||
@ -196,8 +201,17 @@ void Foam::PatchFunction1Types::MappedFile<Type>::rmap
|
|||||||
const PatchFunction1Types::MappedFile<Type>& tiptf =
|
const PatchFunction1Types::MappedFile<Type>& tiptf =
|
||||||
refCast<const PatchFunction1Types::MappedFile<Type>>(pf1);
|
refCast<const PatchFunction1Types::MappedFile<Type>>(pf1);
|
||||||
|
|
||||||
startSampledValues_.rmap(tiptf.startSampledValues_, addr);
|
if (tiptf.startSampledValues_.size())
|
||||||
endSampledValues_.rmap(tiptf.endSampledValues_, addr);
|
{
|
||||||
|
startSampledValues_.setSize(this->size());
|
||||||
|
startSampledValues_.rmap(tiptf.startSampledValues_, addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tiptf.endSampledValues_.size())
|
||||||
|
{
|
||||||
|
endSampledValues_.setSize(this->size());
|
||||||
|
endSampledValues_.rmap(tiptf.endSampledValues_, addr);
|
||||||
|
}
|
||||||
|
|
||||||
// Clear interpolator
|
// Clear interpolator
|
||||||
mapperPtr_.clear();
|
mapperPtr_.clear();
|
||||||
@ -584,27 +598,11 @@ Foam::PatchFunction1Types::MappedFile<Type>::integrate
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::PatchFunction1Types::MappedFile<Type>::writeData
|
void Foam::PatchFunction1Types::MappedFile<Type>::writeEntries
|
||||||
(
|
(
|
||||||
Ostream& os
|
Ostream& os
|
||||||
) const
|
) 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_)
|
if (setAverage_)
|
||||||
{
|
{
|
||||||
os.writeEntry("setAverage", 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
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -27,19 +27,34 @@ Class
|
|||||||
Foam::PatchFunction1Types::MappedFile
|
Foam::PatchFunction1Types::MappedFile
|
||||||
|
|
||||||
Description
|
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:
|
Options:
|
||||||
\table
|
\table
|
||||||
Property | Description | Required | Default
|
Property | Description | Type | Reqd | Deflt
|
||||||
mapMethod | (nearest/planarInterpolation) | no | planarInterpolation
|
mapMethod | Mapping method | word | no <!--
|
||||||
offset | Time-varying offset values to interpolated data | no |
|
--> | planarInterpolation
|
||||||
fieldTable | Name of field data table | no | field-name
|
offset | Time-varying offset values to interpolated data <!--
|
||||||
points | The name of the points file | no | points
|
--> | Function1\<Type\> | no | -
|
||||||
perturb | Perturbation fraction of bounding box | no | 1e-5
|
fieldTable | Name of field data table | word | no | field-name
|
||||||
setAverage | adjust mapped field to maintain average value | no | false
|
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
|
\endtable
|
||||||
|
|
||||||
|
Options for the \c mapMethod entry:
|
||||||
|
\verbatim
|
||||||
|
nearest | Use nearest points only (avoids triangulation)
|
||||||
|
planarInterpolation | Interpolation using 2D Delaunay triangulation
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
MappedFile.C
|
MappedFile.C
|
||||||
|
|
||||||
@ -229,6 +244,9 @@ public:
|
|||||||
|
|
||||||
// I-O
|
// I-O
|
||||||
|
|
||||||
|
//- Write coefficient entries in dictionary format
|
||||||
|
void writeEntries(Ostream& os) const;
|
||||||
|
|
||||||
//- Write in dictionary format
|
//- Write in dictionary format
|
||||||
virtual void writeData(Ostream& os) const;
|
virtual void writeData(Ostream& os) const;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user