Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop

This commit is contained in:
sergio
2016-12-13 07:20:39 -08:00
30 changed files with 311 additions and 288 deletions

View File

@ -1,8 +1,7 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # run from this directory
set -x
wclean libso CompressibleTwoPhaseMixtureTurbulenceModels wclean libso CompressibleTwoPhaseMixtureTurbulenceModels
wclean wclean
# ----------------------------------------------------------------- end-of-file #------------------------------------------------------------------------------

View File

@ -1,8 +1,7 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # run from this directory
set -x
wmake libso CompressibleTwoPhaseMixtureTurbulenceModels wmake libso CompressibleTwoPhaseMixtureTurbulenceModels
wmake wmake
# ----------------------------------------------------------------- end-of-file #------------------------------------------------------------------------------

View File

@ -4,7 +4,6 @@ cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation # Parse arguments for library compilation
targetType=libso targetType=libso
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
set -x
wmake $targetType temperaturePhaseChangeTwoPhaseMixtures wmake $targetType temperaturePhaseChangeTwoPhaseMixtures
wmake wmake

View File

@ -7,8 +7,6 @@ cd ${0%/*} || exit 1 # Run from this directory
if [ -f "$CGAL_ARCH_PATH/include/CGAL/version.h" ] || \ if [ -f "$CGAL_ARCH_PATH/include/CGAL/version.h" ] || \
[ "${CGAL_ARCH_PATH##*-}" = system -a -f /usr/include/CGAL/version.h ] [ "${CGAL_ARCH_PATH##*-}" = system -a -f /usr/include/CGAL/version.h ]
then then
set -x
wmake $targetType conformalVoronoiMesh wmake $targetType conformalVoronoiMesh
wmake $targetType conformalVoronoi2DMesh wmake $targetType conformalVoronoi2DMesh
wmake foamyQuadMesh wmake foamyQuadMesh

View File

@ -20,7 +20,6 @@ then
export LINK_FLAGS="${LINK_FLAGS} -lzoltanRenumber -L${ZOLTAN_ARCH_PATH}/lib -lzoltan" export LINK_FLAGS="${LINK_FLAGS} -lzoltanRenumber -L${ZOLTAN_ARCH_PATH}/lib -lzoltan"
fi fi
set -x
wmake $targetType wmake $targetType
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -1,6 +1,5 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
set -x
unset COMPILE_FLAGS LINK_FLAGS unset COMPILE_FLAGS LINK_FLAGS

View File

@ -82,7 +82,7 @@ Description
runTime | Execute/write every 'Interval' run time period runTime | Execute/write every 'Interval' run time period
clockTime | Execute/write every 'Interval' clock time period clockTime | Execute/write every 'Interval' clock time period
cpuTime | Execute/write every 'Interval' CPU time period cpuTime | Execute/write every 'Interval' CPU time period
none | Execute/write every time-step none | Execute/write disabled
\endtable \endtable
The sub-dictionary name \c \<functionObjectName\> is chosen by the user, and The sub-dictionary name \c \<functionObjectName\> is chosen by the user, and

View File

@ -452,24 +452,21 @@ void Foam::ensightMesh::writeCellConnectivity
ensightCells::NFACED ensightCells::NFACED
}; };
for (int i=0; i < 5; ++i) for (label typei=0; typei < ensightCells::nTypes; ++typei)
{ {
const ensightCells::elemType& what = oldOrder[i]; const ensightCells::elemType& what = oldOrder[typei];
writeCellConnectivity(what, ensCells, pointToGlobal, os); writeCellConnectivity(what, ensCells, pointToGlobal, os);
} }
return;
} }
else
for (label typei=0; typei < ensightCells::nTypes; ++typei)
{ {
const List<ensightCells::elemType> enums = const ensightCells::elemType what = ensightCells::elemType(typei);
ensightCells::elemEnum.enums();
forAllConstIter(List<ensightCells::elemType>, enums, iter) writeCellConnectivity(what, ensCells, pointToGlobal, os);
{
const ensightCells::elemType what = *iter;
writeCellConnectivity(what, ensCells, pointToGlobal, os);
}
} }
} }
@ -614,13 +611,11 @@ void Foam::ensightMesh::writeFaceConnectivity
const bool raw const bool raw
) const ) const
{ {
const List<ensightFaces::elemType> enums = ensightFaces::elemEnum.enums();
if (raw) if (raw)
{ {
forAllConstIter(List<ensightFaces::elemType>, enums, iter) for (label typei=0; typei < ensightFaces::nTypes; ++typei)
{ {
const ensightFaces::elemType what = *iter; const ensightFaces::elemType what = ensightFaces::elemType(typei);
writeFaceConnectivity writeFaceConnectivity
( (
@ -638,9 +633,9 @@ void Foam::ensightMesh::writeFaceConnectivity
} }
else else
{ {
forAllConstIter(List<ensightFaces::elemType>, enums, iter) for (label typei=0; typei < ensightFaces::nTypes; ++typei)
{ {
const ensightFaces::elemType what = *iter; const ensightFaces::elemType what = ensightFaces::elemType(typei);
writeFaceConnectivity writeFaceConnectivity
( (

View File

@ -101,7 +101,8 @@ bool Foam::ensightOutput::writeFaceField
for (label typei=0; typei < ensightFaces::nTypes; ++typei) for (label typei=0; typei < ensightFaces::nTypes; ++typei)
{ {
const ensightFaces::elemType what = ensightFaces::elemType(typei); const ensightFaces::elemType what =
ensightFaces::elemType(typei);
writeFieldContent writeFieldContent
( (
@ -136,7 +137,7 @@ bool Foam::ensightOutput::writeFaceSubField
} }
label start = 0; // start of sublist label start = 0; // start of sublist
for (label typei = 0; typei < ensightFaces::nTypes; ++typei) for (label typei=0; typei < ensightFaces::nTypes; ++typei)
{ {
const ensightFaces::elemType what = ensightFaces::elemType(typei); const ensightFaces::elemType what = ensightFaces::elemType(typei);
const label size = ensFaces.faceIds(what).size(); const label size = ensFaces.faceIds(what).size();

View File

@ -84,7 +84,8 @@ bool Foam::ensightSerialOutput::writeField
for (label typei=0; typei < ensightFaces::nTypes; ++typei) for (label typei=0; typei < ensightFaces::nTypes; ++typei)
{ {
const ensightFaces::elemType what = ensightFaces::elemType(typei); const ensightFaces::elemType what =
ensightFaces::elemType(typei);
writeFieldContent writeFieldContent
( (

View File

@ -263,12 +263,9 @@ void Foam::ensightPartCells::write
} }
// write each element type // write each element type
const List<ensightCells::elemType> enums = for (label typei=0; typei < ensightCells::nTypes; ++typei)
ensightCells::elemEnum.enums();
forAllConstIter(List<ensightCells::elemType>, enums, iter)
{ {
const ensightCells::elemType what = *iter; const ensightCells::elemType what = ensightCells::elemType(typei);
writeConnectivity writeConnectivity
( (
@ -308,10 +305,9 @@ void Foam::ensightPartCells::dumpInfo(Ostream& os) const
os.writeEntry("name", name()); os.writeEntry("name", name());
os.writeEntry("size", size()); os.writeEntry("size", size());
const List<ensightCells::elemType> enums = ensightCells::elemEnum.enums(); for (label typei=0; typei < ensightCells::nTypes; ++typei)
forAllConstIter(List<ensightCells::elemType>, enums, iter)
{ {
const ensightCells::elemType what = *iter; const ensightCells::elemType what = ensightCells::elemType(typei);
const labelUList& addr = this->cellIds(what); const labelUList& addr = this->cellIds(what);
os.writeKeyword(ensightCells::key(what)); os.writeKeyword(ensightCells::key(what));

View File

@ -226,12 +226,9 @@ void Foam::ensightPartFaces::write
} }
// write part // write part
const List<ensightFaces::elemType> enums = for (label typei=0; typei < ensightFaces::nTypes; ++typei)
ensightFaces::elemEnum.enums();
forAllConstIter(List<ensightFaces::elemType>, enums, iter)
{ {
const ensightFaces::elemType what = *iter; const ensightFaces::elemType what = ensightFaces::elemType(typei);
writeConnectivity writeConnectivity
( (
@ -273,10 +270,9 @@ void Foam::ensightPartFaces::dumpInfo(Ostream& os) const
os.writeEntry("start", start_); os.writeEntry("start", start_);
os.writeEntry("size", size()); os.writeEntry("size", size());
const List<ensightFaces::elemType> enums = ensightFaces::elemEnum.enums(); for (label typei=0; typei < ensightFaces::nTypes; ++typei)
forAllConstIter(List<ensightFaces::elemType>, enums, iter)
{ {
const ensightFaces::elemType what = *iter; const ensightFaces::elemType what = ensightFaces::elemType(typei);
const labelUList& addr = this->faceIds(what); const labelUList& addr = this->faceIds(what);
os.writeKeyword(ensightFaces::key(what)); os.writeKeyword(ensightFaces::key(what));

View File

@ -49,41 +49,25 @@ const Foam::NamedEnum<Foam::ensightCells::elemType, 5>
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
inline Foam::label Foam::ensightCells::offset void Foam::ensightCells::resizeAll()
(
const enum elemType what,
const label i
) const
{
label n = i;
for (label typeI = 0; typeI < label(what); ++typeI)
{
n += sizes_[typeI];
}
return n;
}
void Foam::ensightCells::resize()
{ {
// overall required size // overall required size
label n = 0; label n = 0;
forAll(sizes_, typeI) forAll(sizes_, typei)
{ {
n += sizes_[typeI]; n += sizes_[typei];
} }
address_.setSize(n, Zero); address_.setSize(n, Zero);
// assign corresponding sub-lists // assign corresponding sub-lists
n = 0; n = 0;
forAll(sizes_, typeI) forAll(sizes_, typei)
{ {
deleteDemandDrivenData(lists_[typeI]); deleteDemandDrivenData(lists_[typei]);
lists_[typeI] = new SubList<label>(address_, sizes_[typeI], n); lists_[typei] = new SubList<label>(address_, sizes_[typei], n);
n += sizes_[typeI]; n += sizes_[typei];
} }
} }
@ -98,12 +82,12 @@ Foam::ensightCells::ensightCells(const label partIndex)
lists_() lists_()
{ {
// Ensure sub-lists are properly initialized to nullptr // Ensure sub-lists are properly initialized to nullptr
forAll(lists_, typeI) forAll(lists_, typei)
{ {
lists_[typeI] = nullptr; lists_[typei] = nullptr;
} }
resize(); // adjust allocation resizeAll(); // adjust allocation
} }
@ -115,9 +99,9 @@ Foam::ensightCells::ensightCells(const ensightCells& obj)
lists_() lists_()
{ {
// Ensure sub-lists are properly initialized to nullptr // Ensure sub-lists are properly initialized to nullptr
forAll(lists_, typeI) forAll(lists_, typei)
{ {
lists_[typeI] = nullptr; lists_[typei] = nullptr;
} }
// Total (reduced) sizes // Total (reduced) sizes
@ -126,7 +110,7 @@ Foam::ensightCells::ensightCells(const ensightCells& obj)
// Local sizes // Local sizes
this->sizes_ = obj.sizes(); this->sizes_ = obj.sizes();
resize(); // adjust allocation resizeAll(); // adjust allocation
// Restore total (reduced) sizes // Restore total (reduced) sizes
this->sizes_ = totSizes; this->sizes_ = totSizes;
@ -137,9 +121,9 @@ Foam::ensightCells::ensightCells(const ensightCells& obj)
Foam::ensightCells::~ensightCells() Foam::ensightCells::~ensightCells()
{ {
forAll(lists_, typeI) forAll(lists_, typei)
{ {
deleteDemandDrivenData(lists_[typeI]); deleteDemandDrivenData(lists_[typei]);
} }
address_.clear(); address_.clear();
} }
@ -150,21 +134,33 @@ Foam::ensightCells::~ensightCells()
Foam::FixedList<Foam::label, 5> Foam::ensightCells::sizes() const Foam::FixedList<Foam::label, 5> Foam::ensightCells::sizes() const
{ {
FixedList<label, 5> count; FixedList<label, 5> count;
forAll(lists_, typeI) forAll(lists_, typei)
{ {
count[typeI] = lists_[typeI]->size(); count[typei] = lists_[typei]->size();
} }
return count; return count;
} }
Foam::label Foam::ensightCells::offset(const enum elemType what) const
{
label n = 0;
for (label typei = 0; typei < label(what); ++typei)
{
n += lists_[typei]->size();
}
return n;
}
Foam::label Foam::ensightCells::total() const Foam::label Foam::ensightCells::total() const
{ {
label n = 0; label n = 0;
forAll(sizes_, typeI) forAll(sizes_, typei)
{ {
n += sizes_[typeI]; n += sizes_[typei];
} }
return n; return n;
} }
@ -173,25 +169,25 @@ Foam::label Foam::ensightCells::total() const
void Foam::ensightCells::clear() void Foam::ensightCells::clear()
{ {
sizes_ = Zero; // reset sizes sizes_ = Zero; // reset sizes
resize(); resizeAll();
} }
void Foam::ensightCells::reduce() void Foam::ensightCells::reduce()
{ {
forAll(sizes_, typeI) forAll(sizes_, typei)
{ {
sizes_[typeI] = lists_[typeI]->size(); sizes_[typei] = lists_[typei]->size();
Foam::reduce(sizes_[typeI], sumOp<label>()); Foam::reduce(sizes_[typei], sumOp<label>());
} }
} }
void Foam::ensightCells::sort() void Foam::ensightCells::sort()
{ {
forAll(lists_, typeI) forAll(lists_, typei)
{ {
Foam::sort(*(lists_[typeI])); Foam::sort(*(lists_[typei]));
} }
} }
@ -217,9 +213,9 @@ void Foam::ensightCells::classify
// Can avoid double looping, but only at the expense of allocation // Can avoid double looping, but only at the expense of allocation
sizes_ = Zero; // reset sizes sizes_ = Zero; // reset sizes
for (label listI = 0; listI < sz; ++listI) for (label listi = 0; listi < sz; ++listi)
{ {
const label id = indirect ? addressing[listI] : listI; const label id = indirect ? addressing[listi] : listi;
const cellModel& model = shapes[id].model(); const cellModel& model = shapes[id].model();
enum elemType what = NFACED; enum elemType what = NFACED;
@ -243,13 +239,13 @@ void Foam::ensightCells::classify
sizes_[what]++; sizes_[what]++;
} }
resize(); // adjust allocation resizeAll(); // adjust allocation
sizes_ = Zero; // reset sizes sizes_ = Zero; // reset sizes
// Assign cell-id per shape type // Assign cell-id per shape type
for (label listI = 0; listI < sz; ++listI) for (label listi = 0; listi < sz; ++listi)
{ {
const label id = indirect ? addressing[listI] : listI; const label id = indirect ? addressing[listi] : listi;
const cellModel& model = shapes[id].model(); const cellModel& model = shapes[id].model();
enum elemType what = NFACED; enum elemType what = NFACED;
@ -276,10 +272,4 @@ void Foam::ensightCells::classify
} }
Foam::label Foam::ensightCells::offset(const enum elemType what) const
{
return offset(what, 0);
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -89,21 +89,19 @@ private:
//- Linear list of ids, sub-sectioned per element type via SubLists //- Linear list of ids, sub-sectioned per element type via SubLists
labelList address_; labelList address_;
//- List of sizes for each element type //- List of global sizes for each element type.
// Used temporarily for local sizes when building the element lists.
FixedList<label, 5> sizes_; FixedList<label, 5> sizes_;
//- List of ids for each element type //- List of ids for each element type.
// Managed via pointers, since a SubList cannot be relocated/resized. // Managed via pointers, since a SubList cannot be relocated/resized.
FixedList<SubList<label>*, 5> lists_; FixedList<SubList<label>*, 5> lists_;
// Private Member Functions // Private Member Functions
//- Low-level offset routine //- Use temporarily stored sizes to redimension the element lists
inline label offset(const enum elemType what, const label i) const; void resizeAll();
//- Use current sizes to redimension the element lists
void resize();
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const ensightCells&) = delete; void operator=(const ensightCells&) = delete;
@ -126,7 +124,7 @@ public:
// Member Functions // Member Functions
// Access // Access
//- The index in a list. //- The index in a list.
inline label index() const; inline label index() const;
@ -145,13 +143,15 @@ public:
// This value is only meaningful after a reduce operation. // This value is only meaningful after a reduce operation.
label total() const; label total() const;
//- The processor local sizes per element type.
FixedList<label, 5> sizes() const;
//- The global numbers per element type. //- The global numbers per element type.
// This value is only meaningful after a reduce operation. // This value is only meaningful after a reduce operation.
inline const FixedList<label, 5>& totals() const; inline const FixedList<label, 5>& totals() const;
//- The processor local sizes per element type.
FixedList<label, 5> sizes() const;
//- Processor local starting offset of element type.
label offset(const enum elemType what) const;
//- Return the (local) cell ids of the specified element type //- Return the (local) cell ids of the specified element type
inline const labelUList& cellIds(const enum elemType) const; inline const labelUList& cellIds(const enum elemType) const;
@ -159,9 +159,6 @@ public:
//- Return the cell ids of all elements //- Return the cell ids of all elements
inline const labelUList& cellIds() const; inline const labelUList& cellIds() const;
//- Starting offset of element type.
label offset(const enum elemType what) const;
// Edit // Edit

View File

@ -74,52 +74,36 @@ inline void Foam::ensightFaces::add
{ {
const enum elemType what = whatType(f); const enum elemType what = whatType(f);
label n = sizes_[what]++; // linear addressing:
lists_[what]->operator[](n) = id; const label index = offset(what) + sizes_[what]++;
address_[index] = id;
if (flipMap_.size()) if (flipMap_.size())
{ {
flipMap_[offset(what, n)] = flip; flipMap_[index] = flip;
} }
} }
// only used in this file-scope void Foam::ensightFaces::resizeAll()
inline Foam::label Foam::ensightFaces::offset
(
const enum elemType what,
const label i
) const
{
label n = i;
for (label typeI = 0; typeI < label(what); ++typeI)
{
n += sizes_[typeI];
}
return n;
}
void Foam::ensightFaces::resize()
{ {
// overall required size // overall required size
label n = 0; label n = 0;
forAll(sizes_, typeI) forAll(sizes_, typei)
{ {
n += sizes_[typeI]; n += sizes_[typei];
} }
address_.setSize(n, Zero); address_.setSize(n, Zero);
// assign corresponding sub-lists // assign corresponding sub-lists
n = 0; n = 0;
forAll(sizes_, typeI) forAll(sizes_, typei)
{ {
deleteDemandDrivenData(lists_[typeI]); deleteDemandDrivenData(lists_[typei]);
lists_[typeI] = new SubList<label>(address_, sizes_[typeI], n); lists_[typei] = new SubList<label>(address_, sizes_[typei], n);
n += sizes_[typeI]; n += sizes_[typei];
} }
// normally assume no flipMap // normally assume no flipMap
@ -138,12 +122,12 @@ Foam::ensightFaces::ensightFaces(label partIndex)
lists_() lists_()
{ {
// Ensure sub-lists are properly initialized to nullptr // Ensure sub-lists are properly initialized to nullptr
forAll(lists_, typeI) forAll(lists_, typei)
{ {
lists_[typeI] = nullptr; lists_[typei] = nullptr;
} }
resize(); // adjust allocation resizeAll(); // adjust allocation
} }
@ -156,9 +140,9 @@ Foam::ensightFaces::ensightFaces(const ensightFaces& obj)
lists_() lists_()
{ {
// Ensure sub-lists are properly initialized to nullptr // Ensure sub-lists are properly initialized to nullptr
forAll(lists_, typeI) forAll(lists_, typei)
{ {
lists_[typeI] = nullptr; lists_[typei] = nullptr;
} }
// Total (reduced) sizes // Total (reduced) sizes
@ -167,7 +151,7 @@ Foam::ensightFaces::ensightFaces(const ensightFaces& obj)
// Local sizes // Local sizes
this->sizes_ = obj.sizes(); this->sizes_ = obj.sizes();
resize(); // adjust allocation resizeAll(); // adjust allocation
// Restore total (reduced) sizes // Restore total (reduced) sizes
this->sizes_ = totSizes; this->sizes_ = totSizes;
@ -178,9 +162,9 @@ Foam::ensightFaces::ensightFaces(const ensightFaces& obj)
Foam::ensightFaces::~ensightFaces() Foam::ensightFaces::~ensightFaces()
{ {
forAll(lists_, typeI) forAll(lists_, typei)
{ {
deleteDemandDrivenData(lists_[typeI]); deleteDemandDrivenData(lists_[typei]);
} }
address_.clear(); address_.clear();
flipMap_.clear(); flipMap_.clear();
@ -192,21 +176,33 @@ Foam::ensightFaces::~ensightFaces()
Foam::FixedList<Foam::label, 3> Foam::ensightFaces::sizes() const Foam::FixedList<Foam::label, 3> Foam::ensightFaces::sizes() const
{ {
FixedList<label, 3> count; FixedList<label, 3> count;
forAll(lists_, typeI) forAll(lists_, typei)
{ {
count[typeI] = lists_[typeI]->size(); count[typei] = lists_[typei]->size();
} }
return count; return count;
} }
Foam::label Foam::ensightFaces::offset(const enum elemType what) const
{
label n = 0;
for (label typei = 0; typei < label(what); ++typei)
{
n += lists_[typei]->size();
}
return n;
}
Foam::label Foam::ensightFaces::total() const Foam::label Foam::ensightFaces::total() const
{ {
label n = 0; label n = 0;
forAll(sizes_, typeI) forAll(sizes_, typei)
{ {
n += sizes_[typeI]; n += sizes_[typei];
} }
return n; return n;
} }
@ -215,16 +211,16 @@ Foam::label Foam::ensightFaces::total() const
void Foam::ensightFaces::clear() void Foam::ensightFaces::clear()
{ {
sizes_ = Zero; // reset sizes sizes_ = Zero; // reset sizes
resize(); resizeAll();
} }
void Foam::ensightFaces::reduce() void Foam::ensightFaces::reduce()
{ {
forAll(sizes_, typeI) forAll(sizes_, typei)
{ {
sizes_[typeI] = lists_[typeI]->size(); sizes_[typei] = lists_[typei]->size();
Foam::reduce(sizes_[typeI], sumOp<label>()); Foam::reduce(sizes_[typei], sumOp<label>());
} }
} }
@ -238,9 +234,9 @@ void Foam::ensightFaces::sort()
labelList order; labelList order;
label start = 0; label start = 0;
forAll(lists_, typeI) forAll(lists_, typei)
{ {
SubList<label>& idLst = *(lists_[typeI]); SubList<label>& idLst = *(lists_[typei]);
const label sz = idLst.size(); const label sz = idLst.size();
if (sz) if (sz)
@ -258,9 +254,9 @@ void Foam::ensightFaces::sort()
else else
{ {
// no flip-maps, simpler to sort // no flip-maps, simpler to sort
forAll(lists_, typeI) forAll(lists_, typei)
{ {
Foam::sort(*(lists_[typeI])); Foam::sort(*(lists_[typei]));
} }
flipMap_.clear(); // for safety flipMap_.clear(); // for safety
} }
@ -275,19 +271,19 @@ void Foam::ensightFaces::classify(const faceList& faces)
// Can avoid double looping, but only at the expense of allocation // Can avoid double looping, but only at the expense of allocation
sizes_ = Zero; // reset sizes sizes_ = Zero; // reset sizes
for (label listI = 0; listI < sz; ++listI) for (label listi = 0; listi < sz; ++listi)
{ {
const enum elemType what = whatType(faces[listI]); const enum elemType what = whatType(faces[listi]);
sizes_[what]++; sizes_[what]++;
} }
resize(); // adjust allocation resizeAll(); // adjust allocation
sizes_ = Zero; // reset sizes sizes_ = Zero; // reset sizes
// Assign face-id per shape type // Assign face-id per shape type
for (label listI = 0; listI < sz; ++listI) for (label listi = 0; listi < sz; ++listi)
{ {
add(faces[listI], listI); add(faces[listi], listi);
} }
} }
@ -310,9 +306,9 @@ void Foam::ensightFaces::classify
// Can avoid double looping, but only at the expense of allocation // Can avoid double looping, but only at the expense of allocation
sizes_ = Zero; // reset sizes sizes_ = Zero; // reset sizes
for (label listI = 0; listI < sz; ++listI) for (label listi = 0; listi < sz; ++listi)
{ {
const label faceId = addressing[listI]; const label faceId = addressing[listi];
if (!exclude[faceId]) if (!exclude[faceId])
{ {
@ -321,7 +317,7 @@ void Foam::ensightFaces::classify
} }
} }
resize(); // adjust allocation resizeAll(); // adjust allocation
sizes_ = Zero; // reset sizes sizes_ = Zero; // reset sizes
if (useFlip) if (useFlip)
@ -331,10 +327,10 @@ void Foam::ensightFaces::classify
} }
// Assign face-id per shape type // Assign face-id per shape type
for (label listI = 0; listI < sz; ++listI) for (label listi = 0; listi < sz; ++listi)
{ {
const label faceId = addressing[listI]; const label faceId = addressing[listi];
const bool flip = useFlip && flipMap[listI]; const bool flip = useFlip && flipMap[listi];
if (!exclude[faceId]) if (!exclude[faceId])
{ {
@ -343,11 +339,4 @@ void Foam::ensightFaces::classify
} }
} }
Foam::label Foam::ensightFaces::offset(const enum elemType what) const
{
return offset(what, 0);
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -89,7 +89,8 @@ private:
//- Linear list of face-flips //- Linear list of face-flips
boolList flipMap_; boolList flipMap_;
//- List of global sizes for each element type //- List of global sizes for each element type.
// Used temporarily for local sizes when building the element lists.
FixedList<label, 3> sizes_; FixedList<label, 3> sizes_;
//- SubLists of ids for each element type. //- SubLists of ids for each element type.
@ -102,14 +103,11 @@ private:
//- Simple classifier //- Simple classifier
inline static elemType whatType(const face&); inline static elemType whatType(const face&);
//- Low-level addition routine //- Low-level internal addition routine
inline void add(const face&, const label id, const bool flip = false); inline void add(const face&, const label id, const bool flip = false);
//- Low-level offset routine //- Use temporarily stored sizes to redimension the element lists
inline label offset(const enum elemType what, const label i) const; void resizeAll();
//- Use current sizes to redimension the element lists
void resize();
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const ensightFaces&) = delete; void operator=(const ensightFaces&) = delete;
@ -132,76 +130,73 @@ public:
// Member Functions // Member Functions
// Access // Access
//- The index in a list. //- The index in a list.
inline label index() const; inline label index() const;
//- The index in a list, non-const access. //- The index in a list, non-const access.
inline label& index(); inline label& index();
//- The processor local size of all elements. //- The processor local size of all elements.
inline label size() const; inline label size() const;
//- The global number of the specified element type. //- The global number of the specified element type.
// This value is only meaningful after a reduce operation. // This value is only meaningful after a reduce operation.
inline label total(const enum elemType) const; inline label total(const enum elemType) const;
//- The global number of all element types. //- The global number of all element types.
// This value is only meaningful after a reduce operation. // This value is only meaningful after a reduce operation.
label total() const; label total() const;
//- The global numbers per element type.
// This value is only meaningful after a reduce operation.
inline const FixedList<label, 3>& totals() const;
//- The processor local sizes per element type.
FixedList<label, 3> sizes() const;
//- Processor local starting offset of element type.
label offset(const enum elemType what) const;
//- Return the (local) face ids of the specified element type
inline const labelUList& faceIds(const enum elemType) const;
//- Return the processor local face ids of all elements
inline const labelUList& faceIds() const;
//- Return the processor local flip-map of all elements
inline const boolList& flipMap() const;
//- The processor local sizes per element type. // Edit
FixedList<label, 3> sizes() const;
//- The global numbers per element type. //- Classify the face types, set element list.
// This value is only meaningful after a reduce operation. void classify(const faceList& faces);
const FixedList<label, 3>& totals() const;
//- Return the (local) face ids of the specified element type //- Classify the face types, set element list.
inline const labelUList& faceIds(const enum elemType) const; // The indirect addressing can be used when classifying groups of
// face (eg, from a faceZone etc) with an optional flipMap.
//- Return the face ids of all elements // The optional exclude marker can be used to skip faces on particular
inline const labelUList& faceIds() const; // boundary types or regions.
void classify
//- Return the flip-map of all elements (
inline const boolList& flipMap() const; const faceList& faces,
const labelUList& addressing,
const boolList& flipMap = boolList(),
const PackedBoolList& exclude = PackedBoolList()
);
//- Starting offset of element type. //- Set addressable sizes to zero, free up addressing memory.
label offset(const enum elemType what) const; void clear();
//- Sum element counts across all processes.
void reduce();
// Edit //- Sort element lists numerically.
void sort();
//- Classify the face types, set element list.
void classify(const faceList& faces);
//- Classify the face types, set element list.
// The indirect addressing can be used when classifying groups of
// face (eg, from a faceZone etc) with an optional flipMap.
// The optional exclude marker can be used to skip faces on particular
// boundary types or regions.
void classify
(
const faceList& faces,
const labelUList& addressing,
const boolList& flipMap = boolList(),
const PackedBoolList& exclude = PackedBoolList()
);
//- Set addressable sizes to zero, free up addressing memory.
void clear();
//- Sum element counts across all processes.
void reduce();
//- Sort element lists numerically.
void sort();
// Member operators // Member operators

View File

@ -64,7 +64,7 @@ template<>
const char* Foam::NamedEnum const char* Foam::NamedEnum
< <
Foam::functionObjects::fieldValues::surfaceFieldValue::operationType, Foam::functionObjects::fieldValues::surfaceFieldValue::operationType,
15 16
>::names[] = >::names[] =
{ {
"none", "none",
@ -77,6 +77,7 @@ const char* Foam::NamedEnum
"areaAverage", "areaAverage",
"weightedAreaAverage", "weightedAreaAverage",
"areaIntegrate", "areaIntegrate",
"weightedAreaIntegrate",
"min", "min",
"max", "max",
"CoV", "CoV",
@ -93,7 +94,7 @@ const Foam::NamedEnum
const Foam::NamedEnum const Foam::NamedEnum
< <
Foam::functionObjects::fieldValues::surfaceFieldValue::operationType, Foam::functionObjects::fieldValues::surfaceFieldValue::operationType,
15 16
> Foam::functionObjects::fieldValues::surfaceFieldValue::operationTypeNames_; > Foam::functionObjects::fieldValues::surfaceFieldValue::operationTypeNames_;

View File

@ -109,14 +109,15 @@ Usage
sumDirectionBalance | sum of balance of values in given direction sumDirectionBalance | sum of balance of values in given direction
average | ensemble average average | ensemble average
weightedAverage | weighted average weightedAverage | weighted average
areaAverage | area weighted average areaAverage | area-weighted average
weightedAreaAverage | weighted area average weightedAreaAverage | weighted area average
areaIntegrate | area integral areaIntegrate | area integral
weightedAreaIntegrate | weighted area integral
min | minimum min | minimum
max | maximum max | maximum
CoV | coefficient of variation: standard deviation/mean CoV | coefficient of variation: standard deviation/mean
areaNormalAverage| area weighted average in face normal direction areaNormalAverage| area-weighted average in face normal direction
areaNormalIntegrate | area weighted integral in face normal directon areaNormalIntegrate | area-weighted integral in face normal directon
\endplaintable \endplaintable
Note Note
@ -210,6 +211,7 @@ public:
opAreaAverage, //!< Area average opAreaAverage, //!< Area average
opWeightedAreaAverage, //!< Weighted area average opWeightedAreaAverage, //!< Weighted area average
opAreaIntegrate, //!< Area integral opAreaIntegrate, //!< Area integral
opWeightedAreaIntegrate, //!< Weighted area integral
opMin, //!< Minimum opMin, //!< Minimum
opMax, //!< Maximum opMax, //!< Maximum
opCoV, //!< Coefficient of variation opCoV, //!< Coefficient of variation
@ -218,7 +220,7 @@ public:
}; };
//- Operation type names //- Operation type names
static const NamedEnum<operationType, 15> operationTypeNames_; static const NamedEnum<operationType, 16> operationTypeNames_;
private: private:

View File

@ -176,10 +176,9 @@ processSameTypeValues
} }
case opWeightedAverage: case opWeightedAverage:
{ {
label wSize = returnReduce(weightField.size(), sumOp<label>()); if (returnReduce(weightField.size(), sumOp<label>()))
if (wSize > 0)
{ {
// has weights
result = result =
gSum(weightField*values)/(gSum(weightField) + ROOTVSMALL); gSum(weightField*values)/(gSum(weightField) + ROOTVSMALL);
} }
@ -192,31 +191,40 @@ processSameTypeValues
} }
case opAreaAverage: case opAreaAverage:
{ {
const scalarField magSf(mag(Sf)); const scalarField factor(mag(Sf));
result = gSum(magSf*values)/gSum(magSf); result = gSum(factor*values)/gSum(factor);
break; break;
} }
case opWeightedAreaAverage: case opWeightedAreaAverage:
{ {
const scalarField magSf(mag(Sf)); const scalarField factor
label wSize = returnReduce(weightField.size(), sumOp<label>()); (
returnReduce(weightField.size(), sumOp<label>()) // has weights
? weightField*mag(Sf)
: mag(Sf)
);
if (wSize > 0) result = gSum(factor*values)/gSum(factor);
{
result = gSum(weightField*magSf*values)/gSum(magSf*weightField);
}
else
{
result = gSum(magSf*values)/gSum(magSf);
}
break; break;
} }
case opAreaIntegrate: case opAreaIntegrate:
{ {
const scalarField magSf(mag(Sf)); const scalarField factor(mag(Sf));
result = gSum(magSf*values); result = gSum(factor*values);
break;
}
case opWeightedAreaIntegrate:
{
const scalarField factor
(
returnReduce(weightField.size(), sumOp<label>()) // has weights
? weightField*mag(Sf)
: mag(Sf)
);
result = gSum(factor*values);
break; break;
} }
case opMin: case opMin:

View File

@ -16,8 +16,6 @@ targetType=libso
# echo # echo
#fi #fi
set -x
wmake $targetType renumberMethods wmake $targetType renumberMethods
if [ -f "$BOOST_ARCH_PATH/include/boost/version.hpp" ] || \ if [ -f "$BOOST_ARCH_PATH/include/boost/version.hpp" ] || \

View File

@ -31,6 +31,7 @@ License
#include "volPointInterpolation.H" #include "volPointInterpolation.H"
#include "PatchTools.H" #include "PatchTools.H"
#include "mapPolyMesh.H" #include "mapPolyMesh.H"
#include "sampledTriSurfaceMesh.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -84,6 +85,37 @@ void Foam::sampledSurfaces::writeGeometry() const
} }
void Foam::sampledSurfaces::writeOriginalIds()
{
const word fieldName = "Ids";
const fileName outputDir = outputPath_/time_.timeName();
forAll(*this, surfI)
{
const sampledSurface& s = operator[](surfI);
if (isA<sampledTriSurfaceMesh>(s))
{
const sampledTriSurfaceMesh& surf =
dynamicCast<const sampledTriSurfaceMesh&>(s);
if (surf.keepIds())
{
const labelList& idLst = surf.originalIds();
Field<scalar> ids(idLst.size());
forAll(idLst, i)
{
ids[i] = idLst[i];
}
writeSurface(ids, surfI, fieldName, outputDir);
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::sampledSurfaces::sampledSurfaces Foam::sampledSurfaces::sampledSurfaces

View File

@ -116,6 +116,9 @@ class sampledSurfaces
//- Write geometry only //- Write geometry only
void writeGeometry() const; void writeGeometry() const;
//- Write scalar field with original ids
void writeOriginalIds();
//- Write sampled fieldName on surface and on outputDir path //- Write sampled fieldName on surface and on outputDir path
template<class Type> template<class Type>
void writeSurface void writeSurface

View File

@ -60,7 +60,6 @@ Foam::label Foam::sampledSurfaces::classifyFields()
{ {
// Check currently available fields // Check currently available fields
wordList allFields = obr_.sortedNames(); wordList allFields = obr_.sortedNames();
labelList indices = findStrings(fieldSelection_, allFields);
forAll(fieldSelection_, i) forAll(fieldSelection_, i)
{ {

View File

@ -49,9 +49,7 @@ void Foam::sampledSurfaces::writeSurface
gatheredValues[Pstream::myProcNo()] = values; gatheredValues[Pstream::myProcNo()] = values;
Pstream::gatherList(gatheredValues); Pstream::gatherList(gatheredValues);
fileName sampleFile; fileName sampleFile;
if (Pstream::master()) if (Pstream::master())
{ {
// Combine values into single field // Combine values into single field
@ -181,24 +179,21 @@ void Foam::sampledSurfaces::sampleAndWrite
template<class GeoField> template<class GeoField>
void Foam::sampledSurfaces::sampleAndWrite(const IOobjectList& objects) void Foam::sampledSurfaces::sampleAndWrite(const IOobjectList& objects)
{ {
wordList names; wordList fieldNames;
if (loadFromFiles_) if (loadFromFiles_)
{ {
IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName)); fieldNames = objects.sortedNames(GeoField::typeName, fieldSelection_);
names = fieldObjects.names();
} }
else else
{ {
names = mesh_.thisDb().names<GeoField>(); fieldNames = mesh_.thisDb().sortedNames<GeoField>(fieldSelection_);
writeOriginalIds();
} }
labelList nameIDs(findStrings(fieldSelection_, names)); forAll(fieldNames, fieldi)
wordHashSet fieldNames(wordList(names, nameIDs));
forAllConstIter(wordHashSet, fieldNames, iter)
{ {
const word& fieldName = iter.key(); const word& fieldName = fieldNames[fieldi];
if ((Pstream::master()) && verbose_) if ((Pstream::master()) && verbose_)
{ {

View File

@ -296,6 +296,11 @@ bool Foam::sampledTriSurfaceMesh::update(const meshSearch& meshSearcher)
} }
if (keepIds_)
{
originalIds_ = faceMap;
}
// Subset cellOrFaceLabels // Subset cellOrFaceLabels
cellOrFaceLabels = UIndirectList<label>(cellOrFaceLabels, faceMap)(); cellOrFaceLabels = UIndirectList<label>(cellOrFaceLabels, faceMap)();
@ -545,6 +550,8 @@ Foam::sampledTriSurfaceMesh::sampledTriSurfaceMesh
), ),
sampleSource_(sampleSource), sampleSource_(sampleSource),
needsUpdate_(true), needsUpdate_(true),
keepIds_(false),
originalIds_(),
sampleElements_(0), sampleElements_(0),
samplePoints_(0) samplePoints_(0)
{} {}
@ -573,6 +580,8 @@ Foam::sampledTriSurfaceMesh::sampledTriSurfaceMesh
), ),
sampleSource_(samplingSourceNames_[dict.lookup("source")]), sampleSource_(samplingSourceNames_[dict.lookup("source")]),
needsUpdate_(true), needsUpdate_(true),
keepIds_(dict.lookupOrDefault<Switch>("keepIds", false)),
originalIds_(),
sampleElements_(0), sampleElements_(0),
samplePoints_(0) samplePoints_(0)
{} {}
@ -594,7 +603,7 @@ Foam::sampledTriSurfaceMesh::sampledTriSurfaceMesh
name, name,
mesh.time().constant(), // instance mesh.time().constant(), // instance
"triSurface", // local "triSurface", // local
mesh, // registry mesh, // registry
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
@ -603,6 +612,8 @@ Foam::sampledTriSurfaceMesh::sampledTriSurfaceMesh
), ),
sampleSource_(samplingSourceNames_[sampleSourceName]), sampleSource_(samplingSourceNames_[sampleSourceName]),
needsUpdate_(true), needsUpdate_(true),
keepIds_(false),
originalIds_(),
sampleElements_(0), sampleElements_(0),
samplePoints_(0) samplePoints_(0)
{} {}
@ -633,6 +644,7 @@ bool Foam::sampledTriSurfaceMesh::expire()
sampledSurface::clearGeom(); sampledSurface::clearGeom();
MeshStorage::clear(); MeshStorage::clear();
originalIds_.clear();
boundaryTreePtr_.clear(); boundaryTreePtr_.clear();
sampleElements_.clear(); sampleElements_.clear();
samplePoints_.clear(); samplePoints_.clear();

View File

@ -117,6 +117,13 @@ private:
//- Track if the surface needs an update //- Track if the surface needs an update
mutable bool needsUpdate_; mutable bool needsUpdate_;
//- Retain element ids/order of original surface
bool keepIds_;
//- List of element ids/order of the original surface,
// when keepIds is active.
labelList originalIds_;
//- Search tree for all non-coupled boundary faces //- Search tree for all non-coupled boundary faces
mutable autoPtr<indexedOctree<treeDataFace>> boundaryTreePtr_; mutable autoPtr<indexedOctree<treeDataFace>> boundaryTreePtr_;
@ -240,6 +247,19 @@ public:
return MeshStorage::Cf(); return MeshStorage::Cf();
} }
//- If element ids/order of the original surface are kept
bool keepIds() const
{
return keepIds_;
}
//- List of element ids/order of the original surface,
// when keepIds is active.
const labelList& originalIds() const
{
return originalIds_;
}
//- Sample field on surface //- Sample field on surface
virtual tmp<scalarField> sample virtual tmp<scalarField> sample

View File

@ -7,6 +7,6 @@ cd ${0%/*} || exit 1 # Run from this directory
restore0Dir restore0Dir
runApplication blockMesh runApplication blockMesh
runApplication $(getApplication) -writePhi -writep runApplication $(getApplication) -writePhi -writep
runApplication streamFunction runApplication postProcess -func streamFunction
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -15,11 +15,11 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dynamicFvMesh solidBodyMotionFvMesh; dynamicFvMesh dynamicMotionSolverFvMesh;
motionSolverLibs ( "libfvMotionSolvers.so" ); solver solidBody;
solidBodyMotionFvMeshCoeffs solidBodyCoeffs
{ {
cellZone rotating; cellZone rotating;

View File

@ -24,7 +24,7 @@ boundaryField
inlet inlet
{ {
type outletMappedUniformInletHeatAddition; type outletMappedUniformInletHeatAddition;
outletPatchName outlet1; outletPatch outlet1;
Q 5; // Heat addition in W Q 5; // Heat addition in W
TMin 300; TMin 300;
TMax 500; TMax 500;

View File

@ -15,15 +15,15 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dynamicFvMesh solidBodyMotionFvMesh; dynamicFvMesh dynamicMotionSolverFvMesh;
motionSolverLibs ( "libfvMotionSolvers.so" ); solver solidBody;
solidBodyMotionFvMeshCoeffs solidBodyCoeffs
{ {
cellZone inletChannel; cellZone inletChannel;
solidBodyMotionFunction oscillatingLinearMotion; solidBodyMotionFunction oscillatingLinearMotion;
oscillatingLinearMotionCoeffs oscillatingLinearMotionCoeffs
{ {