mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop
This commit is contained in:
25
Allwmake
25
Allwmake
@ -1,21 +1,20 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
cd ${0%/*} || exit 1 # Run from this directory
|
# Run from OPENFOAM top-level directory only
|
||||||
|
cd ${0%/*} && wmakeCheckPwd "$WM_PROJECT_DIR" 2>/dev/null || {
|
||||||
|
echo "Error (${0##*/}) : not located in \$WM_PROJECT_DIR"
|
||||||
|
echo " Check your OpenFOAM environment and installation"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
[ -n "$FOAM_EXT_LIBBIN" ] || {
|
||||||
|
echo "Error (${0##*/}) : FOAM_EXT_LIBBIN not set"
|
||||||
|
echo " Check your OpenFOAM environment and installation"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
# Parse arguments for library compilation
|
# Parse arguments for library compilation
|
||||||
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
||||||
|
|
||||||
wmakeCheckPwd "$WM_PROJECT_DIR" || {
|
#------------------------------------------------------------------------------
|
||||||
echo "Allwmake error: Current directory is not \$WM_PROJECT_DIR"
|
|
||||||
echo " The environment variables are inconsistent with the installation."
|
|
||||||
echo " Check the OpenFOAM entries in your dot-files and source them."
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
[ -n "$FOAM_EXT_LIBBIN" ] || {
|
|
||||||
echo "Allwmake error: FOAM_EXT_LIBBIN not set"
|
|
||||||
echo " Check the OpenFOAM entries in your dot-files and source them."
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Compile wmake support applications
|
# Compile wmake support applications
|
||||||
(cd wmake/src && make)
|
(cd wmake/src && make)
|
||||||
|
|||||||
@ -1,21 +1,20 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
cd ${0%/*} || exit 1 # Run from this directory
|
# Run from OPENFOAM applications/ directory only
|
||||||
|
cd ${0%/*} && wmakeCheckPwd "$WM_PROJECT_DIR/applications" 2>/dev/null || {
|
||||||
|
echo "Error (${0##*/}) : not located in \$WM_PROJECT_DIR/applications"
|
||||||
|
echo " Check your OpenFOAM environment and installation"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
[ -n "$FOAM_EXT_LIBBIN" ] || {
|
||||||
|
echo "Error (${0##*/}) : FOAM_EXT_LIBBIN not set"
|
||||||
|
echo " Check your OpenFOAM environment and installation"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
# Parse arguments for library compilation
|
# Parse arguments for library compilation
|
||||||
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
||||||
|
|
||||||
wmakeCheckPwd "$WM_PROJECT_DIR/applications" || {
|
#------------------------------------------------------------------------------
|
||||||
echo "Allwmake error: Current directory is not \$WM_PROJECT_DIR/applications"
|
|
||||||
echo " The environment variables are inconsistent with the installation."
|
|
||||||
echo " Check the OpenFOAM entries in your dot-files and source them."
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
[ -n "$FOAM_EXT_LIBBIN" ] || {
|
|
||||||
echo "Allwmake error: FOAM_EXT_LIBBIN not set"
|
|
||||||
echo " Check the OpenFOAM entries in your dot-files and source them."
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
wmake -all $targetType solvers
|
wmake -all $targetType solvers
|
||||||
wmake -all $targetType utilities
|
wmake -all $targetType utilities
|
||||||
|
|||||||
@ -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 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -31,15 +31,53 @@ Description
|
|||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void printTable(const HashPtrTable<T>& table)
|
||||||
|
{
|
||||||
|
Info<< table.size() << nl << "(" << nl;
|
||||||
|
|
||||||
|
for
|
||||||
|
(
|
||||||
|
typename HashPtrTable<T>::const_iterator iter = table.cbegin();
|
||||||
|
iter != table.cend();
|
||||||
|
++iter
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const T* ptr = *iter;
|
||||||
|
Info<< iter.key() << " = ";
|
||||||
|
if (ptr)
|
||||||
|
{
|
||||||
|
Info<< *ptr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "nullptr";
|
||||||
|
}
|
||||||
|
Info<< nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< ")" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
// Main program:
|
// Main program:
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
Foam::HashPtrTable<double> myTable;
|
HashPtrTable<double> myTable;
|
||||||
myTable.insert("hello", new double(42.1));
|
myTable.insert("abc", new double(42.1));
|
||||||
|
myTable.insert("def", nullptr);
|
||||||
|
myTable.insert("ghi", new double(3.14159));
|
||||||
|
|
||||||
Info<< myTable << endl;
|
// Info<< myTable << endl;
|
||||||
|
printTable(myTable);
|
||||||
|
|
||||||
|
HashPtrTable<double> copy(myTable);
|
||||||
|
|
||||||
|
// Info<< copy << endl;
|
||||||
|
printTable(copy);
|
||||||
|
Info<< copy << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -49,6 +49,8 @@ int main()
|
|||||||
{"aec", 10.0}
|
{"aec", 10.0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Info<< "\ntable1: " << table1<< endl;
|
||||||
|
|
||||||
// Erase by key
|
// Erase by key
|
||||||
table1.erase("aaw");
|
table1.erase("aaw");
|
||||||
|
|
||||||
@ -60,7 +62,7 @@ int main()
|
|||||||
Info<< "\ntable1 sortedToc: " << table1.sortedToc() << endl;
|
Info<< "\ntable1 sortedToc: " << table1.sortedToc() << endl;
|
||||||
table1.printInfo(Info)
|
table1.printInfo(Info)
|
||||||
<< "table1 [" << table1.size() << "] " << endl;
|
<< "table1 [" << table1.size() << "] " << endl;
|
||||||
forAllIter(HashTable<scalar>, table1, iter)
|
forAllConstIter(HashTable<scalar>, table1, iter)
|
||||||
{
|
{
|
||||||
Info<< iter.key() << " => " << iter() << nl;
|
Info<< iter.key() << " => " << iter() << nl;
|
||||||
}
|
}
|
||||||
@ -106,7 +108,7 @@ int main()
|
|||||||
Info<< "\nerase table2 by iterator" << nl;
|
Info<< "\nerase table2 by iterator" << nl;
|
||||||
forAllIter(HashTable<scalar>, table2, iter)
|
forAllIter(HashTable<scalar>, table2, iter)
|
||||||
{
|
{
|
||||||
Info<< "erasing " << iter.key() << " => " << iter() << " ... ";
|
Info<< "erasing " << iter.key() << " => " << iter.object() << " ... ";
|
||||||
table2.erase(iter);
|
table2.erase(iter);
|
||||||
Info<< "erased" << endl;
|
Info<< "erased" << endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -42,7 +42,11 @@ See also
|
|||||||
#include "vector.H"
|
#include "vector.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
|
|
||||||
#include<list>
|
#include "labelRange.H"
|
||||||
|
#include "ListOps.H"
|
||||||
|
#include "SubList.H"
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -61,6 +65,19 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
|
|
||||||
|
if (false)
|
||||||
|
{
|
||||||
|
labelList intlist(IStringStream("(0 1 2)")());
|
||||||
|
Info<<"construct from Istream: " << intlist << endl;
|
||||||
|
|
||||||
|
IStringStream("(3 4 5)")() >> static_cast<labelUList&>(intlist);
|
||||||
|
Info<<"is >>: " << intlist << endl;
|
||||||
|
|
||||||
|
IStringStream("(6 7 8)")() >> intlist;
|
||||||
|
Info<<"is >>: " << intlist << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
List<vector> list1(IStringStream("1 ((0 1 2))")());
|
List<vector> list1(IStringStream("1 ((0 1 2))")());
|
||||||
Info<< "list1: " << list1 << endl;
|
Info<< "list1: " << list1 << endl;
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -40,8 +40,8 @@ boundBox cube(scalar start, scalar width)
|
|||||||
{
|
{
|
||||||
return boundBox
|
return boundBox
|
||||||
(
|
(
|
||||||
point(start, start, start),
|
point::uniform(start),
|
||||||
point(start + width, start + width, start + width)
|
point::uniform(start + width)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,6 +59,69 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<<"boundBox faces: " << boundBox::faces << endl;
|
Info<<"boundBox faces: " << boundBox::faces << endl;
|
||||||
Info<<"hex faces: " << hex.modelFaces() << endl;
|
Info<<"hex faces: " << hex.modelFaces() << endl;
|
||||||
|
Info<<"tree-bb faces: " << treeBoundBox::faces << endl;
|
||||||
|
Info<<"tree-bb edges: " << treeBoundBox::edges << endl;
|
||||||
|
|
||||||
|
boundBox bb = boundBox::greatBox;
|
||||||
|
Info<<"great box: " << bb << endl;
|
||||||
|
|
||||||
|
// bb.clear();
|
||||||
|
// Info<<"zero box: " << bb << endl;
|
||||||
|
|
||||||
|
bb = boundBox::invertedBox;
|
||||||
|
Info<<"invalid box: " << bb << endl;
|
||||||
|
Info<< nl << endl;
|
||||||
|
|
||||||
|
if (Pstream::parRun())
|
||||||
|
{
|
||||||
|
bb = cube(Pstream::myProcNo(), 1.1);
|
||||||
|
Pout<<"box: " << bb << endl;
|
||||||
|
|
||||||
|
bb.reduce();
|
||||||
|
Pout<<"reduced: " << bb << endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bb = cube(0, 1);
|
||||||
|
Info<<"starting box: " << bb << endl;
|
||||||
|
|
||||||
|
point pt(Zero);
|
||||||
|
bb.add(pt);
|
||||||
|
Info<<"enclose point " << pt << " -> " << bb << endl;
|
||||||
|
|
||||||
|
pt = point(0,1.5,0.5);
|
||||||
|
bb.add(pt);
|
||||||
|
Info<<"enclose point " << pt << " -> " << bb << endl;
|
||||||
|
|
||||||
|
pt = point(5,2,-2);
|
||||||
|
bb.add(pt);
|
||||||
|
Info<<"enclose point " << pt << " -> " << bb << endl;
|
||||||
|
|
||||||
|
// restart with same points
|
||||||
|
bb = boundBox::invertedBox;
|
||||||
|
bb.add(point(1,1,1));
|
||||||
|
bb.add(point::zero);
|
||||||
|
bb.add(point(0,1.5,0.5));
|
||||||
|
bb.add(point(5,2,-2));
|
||||||
|
|
||||||
|
Info<<"repeated " << bb << endl;
|
||||||
|
|
||||||
|
boundBox box1 = cube(0, 1);
|
||||||
|
boundBox box2 = cube(0, 0.75);
|
||||||
|
boundBox box3 = cube(0.5, 1);
|
||||||
|
boundBox box4 = cube(-1, 0.5);
|
||||||
|
|
||||||
|
Info<<"union of " << box1 << " and " << box2 << " => ";
|
||||||
|
|
||||||
|
box1.add(box2);
|
||||||
|
Info<< box1 << endl;
|
||||||
|
|
||||||
|
box1.add(box3);
|
||||||
|
Info<<"union with " << box3 << " => " << box1 << endl;
|
||||||
|
|
||||||
|
box1.add(box4);
|
||||||
|
Info<<"union with " << box4 << " => " << box1 << endl;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -58,6 +58,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
labelRange range;
|
||||||
labelRanges ranges;
|
labelRanges ranges;
|
||||||
|
|
||||||
bool removeMode = false;
|
bool removeMode = false;
|
||||||
@ -74,14 +75,16 @@ int main(int argc, char *argv[])
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
label start = 0;
|
{
|
||||||
label size = 0;
|
label start = 0;
|
||||||
|
label size = 0;
|
||||||
|
|
||||||
IStringStream(args[argI])() >> start;
|
IStringStream(args[argI])() >> start;
|
||||||
++argI;
|
++argI;
|
||||||
IStringStream(args[argI])() >> size;
|
IStringStream(args[argI])() >> size;
|
||||||
|
|
||||||
labelRange range(start, size);
|
range.reset(start, size);
|
||||||
|
}
|
||||||
|
|
||||||
Info<< "---------------" << nl;
|
Info<< "---------------" << nl;
|
||||||
if (removeMode)
|
if (removeMode)
|
||||||
@ -107,10 +110,11 @@ int main(int argc, char *argv[])
|
|||||||
ranges.add(range);
|
ranges.add(range);
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "<list>" << ranges << "</list>" << nl;
|
Info<< "<list>" << ranges << "</list>" << nl
|
||||||
forAllConstIter(labelRanges, ranges, iter)
|
<< "content:";
|
||||||
|
for (auto i : ranges)
|
||||||
{
|
{
|
||||||
Info<< " " << iter();
|
Info<< " " << i;
|
||||||
}
|
}
|
||||||
Info<< nl;
|
Info<< nl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,6 +69,13 @@ int main(int argc, char *argv[])
|
|||||||
Info<<"trimRight: " << stringOps::trimRight(test) << endl;
|
Info<<"trimRight: " << stringOps::trimRight(test) << endl;
|
||||||
Info<<"trim: " << stringOps::trim(test) << endl;
|
Info<<"trim: " << stringOps::trim(test) << endl;
|
||||||
|
|
||||||
|
Info<< nl;
|
||||||
|
Info<<"camel-case => " << (word("camel") & "case") << nl;
|
||||||
|
for (const auto& s : { " text with \"spaces'", "08/15 value" })
|
||||||
|
{
|
||||||
|
Info<<"validated \"" << s << "\" => " << word::validated(s) << nl;
|
||||||
|
}
|
||||||
|
Info<< nl;
|
||||||
|
|
||||||
// test sub-strings via iterators
|
// test sub-strings via iterators
|
||||||
string::const_iterator iter = test.end();
|
string::const_iterator iter = test.end();
|
||||||
|
|||||||
@ -66,14 +66,14 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
pointField newPoints(mesh.points());
|
pointField newPoints(mesh.points());
|
||||||
|
|
||||||
const point half(0.5*(meshBb.min() + meshBb.max()));
|
const point half = meshBb.midpoint();
|
||||||
|
|
||||||
forAll(newPoints, pointi)
|
forAll(newPoints, pointi)
|
||||||
{
|
{
|
||||||
point& pt = newPoints[pointi];
|
point& pt = newPoints[pointi];
|
||||||
|
|
||||||
// expand around half
|
// expand around half
|
||||||
pt.y() += pt.y() - half.y();
|
pt.y() += pt.y() - half.y();
|
||||||
}
|
}
|
||||||
|
|
||||||
mesh.movePoints(newPoints);
|
mesh.movePoints(newPoints);
|
||||||
|
|||||||
@ -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 | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -49,6 +49,9 @@ Usage
|
|||||||
- \par -dict \<filename\>
|
- \par -dict \<filename\>
|
||||||
Specify alternative dictionary for the block mesh description.
|
Specify alternative dictionary for the block mesh description.
|
||||||
|
|
||||||
|
- \par -sets
|
||||||
|
Write cellZones as cellSets too (for processing purposes)
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
@ -85,7 +88,11 @@ int main(int argc, char *argv[])
|
|||||||
"file",
|
"file",
|
||||||
"specify alternative dictionary for the blockMesh description"
|
"specify alternative dictionary for the blockMesh description"
|
||||||
);
|
);
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"sets",
|
||||||
|
"write cellZones as cellSets too (for processing purposes)"
|
||||||
|
);
|
||||||
argList::addNote
|
argList::addNote
|
||||||
(
|
(
|
||||||
"Block description\n"
|
"Block description\n"
|
||||||
@ -187,7 +194,6 @@ int main(int argc, char *argv[])
|
|||||||
IOdictionary meshDict(meshDictIO);
|
IOdictionary meshDict(meshDictIO);
|
||||||
blockMesh blocks(meshDict, regionName);
|
blockMesh blocks(meshDict, regionName);
|
||||||
|
|
||||||
|
|
||||||
if (args.optionFound("blockTopology"))
|
if (args.optionFound("blockTopology"))
|
||||||
{
|
{
|
||||||
// Write mesh as edges.
|
// Write mesh as edges.
|
||||||
@ -251,7 +257,6 @@ int main(int argc, char *argv[])
|
|||||||
defaultFacesType
|
defaultFacesType
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Read in a list of dictionaries for the merge patch pairs
|
// Read in a list of dictionaries for the merge patch pairs
|
||||||
if (meshDict.found("mergePatchPairs"))
|
if (meshDict.found("mergePatchPairs"))
|
||||||
{
|
{
|
||||||
@ -271,8 +276,7 @@ int main(int argc, char *argv[])
|
|||||||
// Set any cellZones (note: cell labelling unaffected by above
|
// Set any cellZones (note: cell labelling unaffected by above
|
||||||
// mergePatchPairs)
|
// mergePatchPairs)
|
||||||
|
|
||||||
label nZones = blocks.numZonedBlocks();
|
const label nZones = blocks.numZonedBlocks();
|
||||||
|
|
||||||
if (nZones > 0)
|
if (nZones > 0)
|
||||||
{
|
{
|
||||||
Info<< nl << "Adding cell zones" << endl;
|
Info<< nl << "Adding cell zones" << endl;
|
||||||
@ -325,11 +329,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
List<cellZone*> cz(zoneMap.size());
|
List<cellZone*> cz(zoneMap.size());
|
||||||
|
|
||||||
Info<< nl << "Writing cell zones as cellSets" << endl;
|
|
||||||
|
|
||||||
forAllConstIter(HashTable<label>, zoneMap, iter)
|
forAllConstIter(HashTable<label>, zoneMap, iter)
|
||||||
{
|
{
|
||||||
label zoneI = iter();
|
label zoneI = iter();
|
||||||
@ -341,10 +341,6 @@ int main(int argc, char *argv[])
|
|||||||
zoneI,
|
zoneI,
|
||||||
mesh.cellZones()
|
mesh.cellZones()
|
||||||
);
|
);
|
||||||
|
|
||||||
// Write as cellSet for ease of processing
|
|
||||||
cellSet cset(mesh, iter.key(), zoneCells[zoneI].shrink());
|
|
||||||
cset.write();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mesh.pointZones().setSize(0);
|
mesh.pointZones().setSize(0);
|
||||||
@ -356,7 +352,14 @@ int main(int argc, char *argv[])
|
|||||||
// Set the precision of the points data to 10
|
// Set the precision of the points data to 10
|
||||||
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
|
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
|
||||||
|
|
||||||
Info<< nl << "Writing polyMesh" << endl;
|
Info<< nl << "Writing polyMesh with "
|
||||||
|
<< mesh.cellZones().size() << " cellZones";
|
||||||
|
if (args.optionFound("sets") && !mesh.cellZones().empty())
|
||||||
|
{
|
||||||
|
Info<< " (written as cellSets too)";
|
||||||
|
}
|
||||||
|
Info<< endl;
|
||||||
|
|
||||||
mesh.removeFiles();
|
mesh.removeFiles();
|
||||||
if (!mesh.write())
|
if (!mesh.write())
|
||||||
{
|
{
|
||||||
@ -365,6 +368,14 @@ int main(int argc, char *argv[])
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args.optionFound("sets"))
|
||||||
|
{
|
||||||
|
forAll(mesh.cellZones(), zonei)
|
||||||
|
{
|
||||||
|
const cellZone& cz = mesh.cellZones()[zonei];
|
||||||
|
cellSet(mesh, cz.name(), cz).write();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// write some information
|
// write some information
|
||||||
|
|||||||
@ -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) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -719,17 +719,13 @@ void Foam::backgroundMeshDecomposition::buildPatchAndTree()
|
|||||||
Pstream::gatherList(allBackgroundMeshBounds_);
|
Pstream::gatherList(allBackgroundMeshBounds_);
|
||||||
Pstream::scatterList(allBackgroundMeshBounds_);
|
Pstream::scatterList(allBackgroundMeshBounds_);
|
||||||
|
|
||||||
point bbMin(GREAT, GREAT, GREAT);
|
// find global bounding box
|
||||||
point bbMax(-GREAT, -GREAT, -GREAT);
|
globalBackgroundBounds_ = treeBoundBox(boundBox::invertedBox);
|
||||||
|
|
||||||
forAll(allBackgroundMeshBounds_, proci)
|
forAll(allBackgroundMeshBounds_, proci)
|
||||||
{
|
{
|
||||||
bbMin = min(bbMin, allBackgroundMeshBounds_[proci].min());
|
globalBackgroundBounds_.add(allBackgroundMeshBounds_[proci]);
|
||||||
bbMax = max(bbMax, allBackgroundMeshBounds_[proci].max());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
globalBackgroundBounds_ = treeBoundBox(bbMin, bbMax);
|
|
||||||
|
|
||||||
if (false)
|
if (false)
|
||||||
{
|
{
|
||||||
OFstream fStr
|
OFstream fStr
|
||||||
|
|||||||
@ -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) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -558,19 +558,11 @@ Foam::label Foam::checkTopology
|
|||||||
|
|
||||||
if (allGeometry)
|
if (allGeometry)
|
||||||
{
|
{
|
||||||
const pointField& pts = pp.points();
|
|
||||||
const labelList& mp = pp.meshPoints();
|
const labelList& mp = pp.meshPoints();
|
||||||
|
|
||||||
if (returnReduce(mp.size(), sumOp<label>()) > 0)
|
if (returnReduce(mp.size(), sumOp<label>()) > 0)
|
||||||
{
|
{
|
||||||
boundBox bb(point::max, point::min);
|
boundBox bb(pp.points(), mp, true); // reduce
|
||||||
forAll(mp, i)
|
|
||||||
{
|
|
||||||
bb.min() = min(bb.min(), pts[mp[i]]);
|
|
||||||
bb.max() = max(bb.max(), pts[mp[i]]);
|
|
||||||
}
|
|
||||||
reduce(bb.min(), minOp<vector>());
|
|
||||||
reduce(bb.max(), maxOp<vector>());
|
|
||||||
Info<< ' ' << bb;
|
Info<< ' ' << bb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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 | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -336,10 +336,7 @@ boundBox procBounds
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
boundBox domainBb(points, false);
|
bb.add(points);
|
||||||
|
|
||||||
bb.min() = min(bb.min(), domainBb.min());
|
|
||||||
bb.max() = max(bb.max(), domainBb.max());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return bb;
|
return bb;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
cd ${0%/*} || exit 1 # Run from this directory
|
cd ${0%/*} || exit 1 # Run from this directory
|
||||||
|
|
||||||
wclean libso vtkPVReaders
|
wclean libso foamPv
|
||||||
PVblockMeshReader/Allwclean
|
PVblockMeshReader/Allwclean
|
||||||
PVFoamReader/Allwclean
|
PVFoamReader/Allwclean
|
||||||
|
|
||||||
|
|||||||
@ -7,32 +7,8 @@ export WM_CONTINUE_ON_ERROR=true
|
|||||||
# Parse arguments for library compilation
|
# Parse arguments for library compilation
|
||||||
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
||||||
|
|
||||||
#
|
# Source CMake functions
|
||||||
# There are several prerequisites for building plugins
|
. $WM_PROJECT_DIR/wmake/scripts/cmakeFunctions
|
||||||
#
|
|
||||||
#set -x
|
|
||||||
canBuildPlugin()
|
|
||||||
{
|
|
||||||
[ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ] || {
|
|
||||||
echo "==> cannot build ParaView plugins without paraview directory"
|
|
||||||
echo " ParaView_DIR=$ParaView_DIR"
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
[ -n "$PV_PLUGIN_PATH" ] || {
|
|
||||||
echo "==> ${PWD##*/} : invalid PV_PLUGIN_PATH for building ParaView plugins"
|
|
||||||
echo " PV_PLUGIN_PATH=${PV_PLUGIN_PATH:-unset}"
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
type cmake > /dev/null 2>&1 || {
|
|
||||||
echo "==> cannot build ParaView plugins without cmake"
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0 # success
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -45,9 +21,9 @@ case "$major" in
|
|||||||
if canBuildPlugin
|
if canBuildPlugin
|
||||||
then
|
then
|
||||||
(
|
(
|
||||||
wmake $targetType vtkPVReaders
|
wmakeLibPv foamPv
|
||||||
PVblockMeshReader/Allwmake $targetType $*
|
PVblockMeshReader/Allwmake $targetType $*
|
||||||
PVFoamReader/Allwmake $targetType $*
|
PVFoamReader/Allwmake $targetType $*
|
||||||
|
|
||||||
# Dummy directory to trigger proper 'wclean all' behaviour
|
# Dummy directory to trigger proper 'wclean all' behaviour
|
||||||
# - the Allwclean will otherwise not be used
|
# - the Allwclean will otherwise not be used
|
||||||
|
|||||||
@ -2,17 +2,15 @@
|
|||||||
cd ${0%/*} || exit 1 # Run from this directory
|
cd ${0%/*} || exit 1 # Run from this directory
|
||||||
|
|
||||||
# Source the wmake functions
|
# Source the wmake functions
|
||||||
. $WM_DIR/scripts/wmakeFunctions
|
. $WM_PROJECT_DIR/wmake/scripts/wmakeFunctions
|
||||||
|
|
||||||
#set -x
|
# Cleanup client-server and/or combined plugins
|
||||||
|
|
||||||
# deal with client/server vs combined plugins
|
|
||||||
rm -f $FOAM_LIBBIN/libPVFoamReader* 2>/dev/null
|
rm -f $FOAM_LIBBIN/libPVFoamReader* 2>/dev/null
|
||||||
|
|
||||||
rm -rf PVFoamReader/Make # safety: old build location
|
rm -rf PVFoamReader/Make # safety: old build location
|
||||||
wclean libso vtkPVFoam
|
wclean libso vtkPVFoam
|
||||||
|
|
||||||
# Where are the generated files stored?
|
# Cleanup generated files
|
||||||
findObjectDir $PWD # remove entire top-level
|
findObjectDir $PWD # remove entire top-level
|
||||||
rm -rf "$objectsDir" > /dev/null 2>&1
|
rm -rf "$objectsDir" > /dev/null 2>&1
|
||||||
|
|
||||||
|
|||||||
@ -4,49 +4,18 @@ cd ${0%/*} || exit 1 # Run from this directory
|
|||||||
# Parse arguments for library compilation
|
# Parse arguments for library compilation
|
||||||
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
||||||
|
|
||||||
# Source the wmake functions
|
# Source CMake functions
|
||||||
. $WM_DIR/scripts/wmakeFunctions
|
. $WM_PROJECT_DIR/wmake/scripts/cmakeFunctions
|
||||||
|
|
||||||
# Ensure CMake gets the correct C/C++ compilers
|
|
||||||
[ -n "$WM_CC" ] && export CC="$WM_CC"
|
|
||||||
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
|
|
||||||
|
|
||||||
|
|
||||||
# CMake into objectsDir,
|
|
||||||
# with an additional attempt if (possibly incorrect) CMakeCache.txt existed
|
|
||||||
doCmake()
|
|
||||||
{
|
|
||||||
local sourceDir="$1"
|
|
||||||
|
|
||||||
findObjectDir $sourceDir # Where are generated files stored?
|
|
||||||
test -f "$objectsDir/CMakeCache.txt"
|
|
||||||
retry=$? # CMakeCache.txt exists, but sources may have moved
|
|
||||||
|
|
||||||
mkdir -p $objectsDir && \
|
|
||||||
(
|
|
||||||
cd $objectsDir || exit 1
|
|
||||||
|
|
||||||
cmake $sourceDir || {
|
|
||||||
if [ $retry -eq 0 ]
|
|
||||||
then
|
|
||||||
echo "Removing CMakeCache.txt and attempt again"
|
|
||||||
rm -f CMakeCache.txt
|
|
||||||
cmake $sourceDir
|
|
||||||
else
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
} && make
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
if [ -d "$ParaView_DIR" ]
|
if [ -d "$ParaView_DIR" ]
|
||||||
then
|
then
|
||||||
wmake $targetType vtkPVFoam
|
wmakeLibPv vtkPVFoam
|
||||||
|
|
||||||
if [ "$targetType" != objects ]
|
if [ "$targetType" != objects ]
|
||||||
then
|
then
|
||||||
doCmake $PWD/PVFoamReader || {
|
cmakePv $PWD/PVFoamReader || {
|
||||||
echo
|
echo
|
||||||
echo " WARNING: incomplete build of ParaView OpenFOAM plugin"
|
echo " WARNING: incomplete build of ParaView OpenFOAM plugin"
|
||||||
echo
|
echo
|
||||||
|
|||||||
@ -1,84 +1,70 @@
|
|||||||
# Create a plugin that adds a reader to the ParaView GUI
|
# Create a plugin to add a reader to the ParaView GUI
|
||||||
# it is added in the file dialog when doing opens/saves.
|
|
||||||
|
|
||||||
# The qrc file is processed by Qt's resource compiler (rcc)
|
cmake_minimum_required(VERSION 2.8)
|
||||||
# the qrc file must have a resource prefix of "/ParaViewResources"
|
|
||||||
# and ParaView will read anything contained under that prefix
|
|
||||||
# the pqReader.xml file contains xml defining readers with their
|
|
||||||
# file extensions and descriptions.
|
|
||||||
|
|
||||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
|
find_package(ParaView REQUIRED)
|
||||||
|
include(${PARAVIEW_USE_FILE})
|
||||||
|
|
||||||
FIND_PACKAGE(ParaView REQUIRED)
|
link_directories(
|
||||||
INCLUDE(${PARAVIEW_USE_FILE})
|
|
||||||
|
|
||||||
LINK_DIRECTORIES(
|
|
||||||
$ENV{FOAM_LIBBIN}
|
$ENV{FOAM_LIBBIN}
|
||||||
$ENV{FOAM_EXT_LIBBIN}
|
$ENV{FOAM_EXT_LIBBIN}
|
||||||
)
|
)
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(
|
include_directories(
|
||||||
$ENV{WM_PROJECT_DIR}/src/OpenFOAM/lnInclude
|
$ENV{WM_PROJECT_DIR}/src/OpenFOAM/lnInclude
|
||||||
$ENV{WM_PROJECT_DIR}/src/OSspecific/$ENV{WM_OSTYPE}/lnInclude
|
$ENV{WM_PROJECT_DIR}/src/OSspecific/$ENV{WM_OSTYPE}/lnInclude
|
||||||
$ENV{WM_PROJECT_DIR}/src/finiteVolume/lnInclude
|
$ENV{WM_PROJECT_DIR}/src/finiteVolume/lnInclude
|
||||||
${PROJECT_SOURCE_DIR}/../vtkPVFoam
|
${PROJECT_SOURCE_DIR}/../vtkPVFoam
|
||||||
|
${PROJECT_SOURCE_DIR}/../../foamPv/lnInclude
|
||||||
)
|
)
|
||||||
|
|
||||||
ADD_DEFINITIONS(
|
add_definitions(
|
||||||
-std=c++0x
|
-std=c++11
|
||||||
-DWM_$ENV{WM_PRECISION_OPTION}
|
-DWM_$ENV{WM_PRECISION_OPTION}
|
||||||
-DWM_LABEL_SIZE=$ENV{WM_LABEL_SIZE}
|
-DWM_LABEL_SIZE=$ENV{WM_LABEL_SIZE}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Set output library destination to plugin directory
|
# Set output library destination to plugin directory
|
||||||
SET(
|
set(
|
||||||
LIBRARY_OUTPUT_PATH $ENV{PV_PLUGIN_PATH}
|
LIBRARY_OUTPUT_PATH $ENV{PV_PLUGIN_PATH}
|
||||||
CACHE INTERNAL
|
CACHE INTERNAL
|
||||||
"Single output directory for building all libraries."
|
"Single output directory for building all libraries."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
#
|
if (PARAVIEW_QT_VERSION VERSION_GREATER "4")
|
||||||
# Defined combined plugin
|
qt5_wrap_cpp(MOC_SRCS
|
||||||
#
|
pqFoamReaderControls.h
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
qt4_wrap_cpp(MOC_SRCS
|
||||||
|
pqFoamReaderControls.h
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Extend the auto-generated panel
|
add_paraview_property_group_widget(IFACES0 IFACES0_SRCS
|
||||||
QT4_WRAP_CPP(MOC_SRCS pqPVFoamReaderPanel.h)
|
TYPE "openfoam_reader_general_controls"
|
||||||
|
CLASS_NAME pqFoamReaderControls
|
||||||
ADD_PARAVIEW_OBJECT_PANEL(IFACES IFACE_SRCS
|
|
||||||
CLASS_NAME pqPVFoamReaderPanel
|
|
||||||
XML_NAME PVFoamReader # name of SourceProxy in *SM.xml
|
|
||||||
XML_GROUP sources
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Separate GUI_RESOURCE_FILES deprecated with paraview 4.3
|
add_paraview_plugin(
|
||||||
# so check if version < 4.4
|
PVFoamReader_SM "1.0"
|
||||||
|
SERVER_MANAGER_XML PVFoamReader_SM.xml
|
||||||
|
SERVER_MANAGER_SOURCES vtkPVFoamReader.cxx
|
||||||
|
GUI_INTERFACES
|
||||||
|
${IFACES0}
|
||||||
|
SOURCES
|
||||||
|
${IFACES0_SRCS}
|
||||||
|
${MOC_SRCS}
|
||||||
|
pqFoamReaderControls.cxx
|
||||||
|
)
|
||||||
|
|
||||||
IF(("${PARAVIEW_VERSION_MAJOR}" LESS 5) AND ("${PARAVIEW_VERSION_MINOR}" LESS 4))
|
|
||||||
ADD_PARAVIEW_PLUGIN(
|
|
||||||
PVFoamReader_SM "1.0"
|
|
||||||
SERVER_MANAGER_XML PVFoamReader_SM.xml
|
|
||||||
SERVER_MANAGER_SOURCES vtkPVFoamReader.cxx
|
|
||||||
GUI_INTERFACES ${IFACES}
|
|
||||||
GUI_SOURCES pqPVFoamReaderPanel.cxx
|
|
||||||
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
|
|
||||||
GUI_RESOURCE_FILES PVFoamReader.xml
|
|
||||||
)
|
|
||||||
ELSE()
|
|
||||||
ADD_PARAVIEW_PLUGIN(
|
|
||||||
PVFoamReader_SM "1.0"
|
|
||||||
SERVER_MANAGER_XML PVFoamReader_SM.xml
|
|
||||||
SERVER_MANAGER_SOURCES vtkPVFoamReader.cxx
|
|
||||||
GUI_INTERFACES ${IFACES}
|
|
||||||
GUI_SOURCES pqPVFoamReaderPanel.cxx
|
|
||||||
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
|
|
||||||
)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(
|
target_link_libraries(
|
||||||
PVFoamReader_SM
|
PVFoamReader_SM
|
||||||
LINK_PUBLIC
|
LINK_PUBLIC
|
||||||
vtkPVFoam
|
vtkPVFoam-pv${PARAVIEW_VERSION_MAJOR}.${PARAVIEW_VERSION_MINOR}
|
||||||
|
foamPv-pv${PARAVIEW_VERSION_MAJOR}.${PARAVIEW_VERSION_MINOR}
|
||||||
finiteVolume
|
finiteVolume
|
||||||
OpenFOAM
|
OpenFOAM
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,5 +0,0 @@
|
|||||||
<RCC>
|
|
||||||
<qresource prefix="/ParaViewResources" >
|
|
||||||
<file>PVFoamReader.xml</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
<ParaViewReaders>
|
|
||||||
<!-- deprecated with paraview-4.3, use hints in *SM.xml -->
|
|
||||||
<Reader name="PVFoamReader"
|
|
||||||
extensions="OpenFOAM"
|
|
||||||
file_description="OpenFOAM Reader">
|
|
||||||
</Reader>
|
|
||||||
</ParaViewReaders>
|
|
||||||
@ -5,14 +5,14 @@
|
|||||||
class="vtkPVFoamReader">
|
class="vtkPVFoamReader">
|
||||||
|
|
||||||
<!-- File name - compulsory -->
|
<!-- File name - compulsory -->
|
||||||
<StringVectorProperty
|
<StringVectorProperty animateable="0"
|
||||||
name="FileName"
|
name="FileName"
|
||||||
command="SetFileName"
|
command="SetFileName"
|
||||||
number_of_elements="1"
|
number_of_elements="1"
|
||||||
animateable="0">
|
panel_visibility="never">
|
||||||
<FileListDomain name="files"/>
|
<FileListDomain name="files"/>
|
||||||
<Documentation>
|
<Documentation>
|
||||||
Specifies the filename for the OpenFOAM Reader.
|
The filename for the OpenFOAM reader module.
|
||||||
</Documentation>
|
</Documentation>
|
||||||
</StringVectorProperty>
|
</StringVectorProperty>
|
||||||
|
|
||||||
@ -27,163 +27,168 @@
|
|||||||
</Documentation>
|
</Documentation>
|
||||||
</DoubleVectorProperty>
|
</DoubleVectorProperty>
|
||||||
|
|
||||||
<!-- Cache Mesh check-box -->
|
<!-- Refresh (push button) -->
|
||||||
<IntVectorProperty
|
<Property
|
||||||
name="UiCacheMesh"
|
name="Refresh"
|
||||||
command="SetCacheMesh"
|
command="Refresh"
|
||||||
number_of_elements="1"
|
panel_visibility="default">
|
||||||
is_internal="1"
|
<Documentation>Rescan for updated times/fields.</Documentation>
|
||||||
default_values="1"
|
</Property>
|
||||||
animateable="0">
|
|
||||||
<BooleanDomain name="bool"/>
|
|
||||||
<Documentation>
|
|
||||||
Cache the fvMesh in memory.
|
|
||||||
</Documentation>
|
|
||||||
</IntVectorProperty>
|
|
||||||
|
|
||||||
<!-- Refresh button -->
|
<!-- General Controls -->
|
||||||
<IntVectorProperty
|
|
||||||
name="UiRefresh"
|
|
||||||
command="SetRefresh"
|
|
||||||
number_of_elements="1"
|
|
||||||
is_internal="0"
|
|
||||||
default_values="0"
|
|
||||||
animateable="0">
|
|
||||||
<BooleanDomain name="bool"/>
|
|
||||||
<Documentation>
|
|
||||||
Rescan for updated timesteps/fields.
|
|
||||||
</Documentation>
|
|
||||||
</IntVectorProperty>
|
|
||||||
|
|
||||||
<!-- Skip Zero Time check-box -->
|
<!-- Skip Zero Time (check-box) -->
|
||||||
<IntVectorProperty
|
<IntVectorProperty animateable="0"
|
||||||
name="UiZeroTime"
|
name="ZeroTime"
|
||||||
|
label="Skip Zero Time"
|
||||||
command="SetSkipZeroTime"
|
command="SetSkipZeroTime"
|
||||||
number_of_elements="1"
|
|
||||||
is_internal="1"
|
|
||||||
default_values="0"
|
|
||||||
animateable="0">
|
|
||||||
<BooleanDomain name="bool"/>
|
|
||||||
<Documentation>
|
|
||||||
Skip including the 0/ time directory
|
|
||||||
</Documentation>
|
|
||||||
</IntVectorProperty>
|
|
||||||
|
|
||||||
<!-- Interpolate Fields check-box -->
|
|
||||||
<IntVectorProperty
|
|
||||||
name="UiInterpolateVolFields"
|
|
||||||
command="SetInterpolateVolFields"
|
|
||||||
number_of_elements="1"
|
|
||||||
is_internal="1"
|
|
||||||
default_values="1"
|
default_values="1"
|
||||||
animateable="0">
|
number_of_elements="1"
|
||||||
|
panel_visibility="default">
|
||||||
<BooleanDomain name="bool"/>
|
<BooleanDomain name="bool"/>
|
||||||
<Documentation>
|
<Documentation>
|
||||||
Interpolate volume fields into point fields
|
Ignore the 0/ time directory.
|
||||||
</Documentation>
|
</Documentation>
|
||||||
</IntVectorProperty>
|
</IntVectorProperty>
|
||||||
|
|
||||||
<!-- Extrapolate Patches check-box -->
|
<!-- Include Sets (check-box) -->
|
||||||
<IntVectorProperty
|
<IntVectorProperty animateable="0"
|
||||||
name="UiExtrapolatePatches"
|
name="IncludeSets"
|
||||||
|
command="SetIncludeSets"
|
||||||
|
default_values="0"
|
||||||
|
number_of_elements="1"
|
||||||
|
panel_visibility="default">
|
||||||
|
<BooleanDomain name="bool"/>
|
||||||
|
<Documentation>
|
||||||
|
Search the polyMesh/sets/ directory
|
||||||
|
</Documentation>
|
||||||
|
</IntVectorProperty>
|
||||||
|
|
||||||
|
<!-- Include Zones (check-box) -->
|
||||||
|
<IntVectorProperty animateable="0"
|
||||||
|
name="IncludeZones"
|
||||||
|
command="SetIncludeZones"
|
||||||
|
default_values="0"
|
||||||
|
number_of_elements="1"
|
||||||
|
panel_visibility="default">
|
||||||
|
<BooleanDomain name="bool"/>
|
||||||
|
<Documentation>
|
||||||
|
ZoneMesh information is used to find {cell,face,point}Zones.
|
||||||
|
The polyMesh/ directory is only checked on startup.
|
||||||
|
</Documentation>
|
||||||
|
</IntVectorProperty>
|
||||||
|
|
||||||
|
<!-- Show Groups Only (check-box) -->
|
||||||
|
<IntVectorProperty animateable="0"
|
||||||
|
name="ShowGroupsOnly"
|
||||||
|
label="Groups Only"
|
||||||
|
command="SetShowGroupsOnly"
|
||||||
|
default_values="0"
|
||||||
|
number_of_elements="1"
|
||||||
|
panel_visibility="default">
|
||||||
|
<BooleanDomain name="bool"/>
|
||||||
|
<Documentation>
|
||||||
|
Show patchGroups only.
|
||||||
|
</Documentation>
|
||||||
|
</IntVectorProperty>
|
||||||
|
|
||||||
|
<!-- Show Patch Names (check-box) -->
|
||||||
|
<IntVectorProperty animateable="0"
|
||||||
|
name="ShowPatchNames"
|
||||||
|
label="Patch Names"
|
||||||
|
command="SetShowPatchNames"
|
||||||
|
default_values="0"
|
||||||
|
number_of_elements="1"
|
||||||
|
panel_visibility="default">
|
||||||
|
<BooleanDomain name="bool"/>
|
||||||
|
<Documentation>
|
||||||
|
Show patch names in render window.
|
||||||
|
</Documentation>
|
||||||
|
</IntVectorProperty>
|
||||||
|
|
||||||
|
<!-- Interpolate Fields (check-box) -->
|
||||||
|
<IntVectorProperty animateable="0"
|
||||||
|
name="InterpolateFields"
|
||||||
|
command="SetInterpolateVolFields"
|
||||||
|
default_values="1"
|
||||||
|
number_of_elements="1"
|
||||||
|
panel_visibility="default">
|
||||||
|
<BooleanDomain name="bool"/>
|
||||||
|
<Documentation>
|
||||||
|
Interpolate volFields into pointFields.
|
||||||
|
</Documentation>
|
||||||
|
</IntVectorProperty>
|
||||||
|
|
||||||
|
<!-- Extrapolate Patches (check-box) -->
|
||||||
|
<IntVectorProperty animateable="0"
|
||||||
|
name="ExtrapolatePatches"
|
||||||
command="SetExtrapolatePatches"
|
command="SetExtrapolatePatches"
|
||||||
number_of_elements="1"
|
|
||||||
is_internal="1"
|
|
||||||
default_values="0"
|
default_values="0"
|
||||||
animateable="0">
|
number_of_elements="1"
|
||||||
|
panel_visibility="default">
|
||||||
<BooleanDomain name="bool"/>
|
<BooleanDomain name="bool"/>
|
||||||
<Documentation>
|
<Documentation>
|
||||||
Extrapolate internalField to non-constraint patches
|
Extrapolate internalField to non-constraint patches.
|
||||||
</Documentation>
|
</Documentation>
|
||||||
</IntVectorProperty>
|
</IntVectorProperty>
|
||||||
|
|
||||||
<!-- Use VTK Polyhedron check-box -->
|
<!-- Force GUI update (check-box) -->
|
||||||
<IntVectorProperty
|
<IntVectorProperty animateable="0"
|
||||||
name="UseVTKPolyhedron"
|
name="UpdateGUI"
|
||||||
command="SetUseVTKPolyhedron"
|
command="SetUpdateGUI"
|
||||||
number_of_elements="1"
|
|
||||||
default_values="0"
|
default_values="0"
|
||||||
animateable="0">
|
number_of_elements="1"
|
||||||
|
panel_visibility="default">
|
||||||
|
<BooleanDomain name="bool"/>
|
||||||
|
<Documentation>
|
||||||
|
Force reader GUI update.
|
||||||
|
</Documentation>
|
||||||
|
</IntVectorProperty>
|
||||||
|
|
||||||
|
<!-- Use VTK Polyhedron (check-box) -->
|
||||||
|
<IntVectorProperty animateable="0"
|
||||||
|
name="UseVTKPolyhedron"
|
||||||
|
label="Use VTK Polyhedron"
|
||||||
|
command="SetUseVTKPolyhedron"
|
||||||
|
default_values="0"
|
||||||
|
number_of_elements="1"
|
||||||
|
panel_visibility="default">
|
||||||
<BooleanDomain name="bool"/>
|
<BooleanDomain name="bool"/>
|
||||||
<Documentation>
|
<Documentation>
|
||||||
Use vtkPolyhedron instead of decomposing polyhedra.
|
Use vtkPolyhedron instead of decomposing polyhedra.
|
||||||
</Documentation>
|
</Documentation>
|
||||||
</IntVectorProperty>
|
</IntVectorProperty>
|
||||||
|
|
||||||
<!-- Include Sets check-box -->
|
<!-- Cache Mesh (check-box) -->
|
||||||
<IntVectorProperty
|
<IntVectorProperty animateable="0"
|
||||||
name="UiIncludeSets"
|
name="CacheMesh"
|
||||||
command="SetIncludeSets"
|
command="SetCacheMesh"
|
||||||
|
default_values="1"
|
||||||
number_of_elements="1"
|
number_of_elements="1"
|
||||||
is_internal="1"
|
panel_visibility="default">
|
||||||
default_values="0"
|
|
||||||
animateable="0">
|
|
||||||
<Documentation>
|
|
||||||
Search the polyMesh/sets/ directory
|
|
||||||
</Documentation>
|
|
||||||
<BooleanDomain name="bool"/>
|
|
||||||
</IntVectorProperty>
|
|
||||||
|
|
||||||
<!-- Include Zones check-box -->
|
|
||||||
<IntVectorProperty
|
|
||||||
name="UiIncludeZones"
|
|
||||||
command="SetIncludeZones"
|
|
||||||
number_of_elements="1"
|
|
||||||
is_internal="1"
|
|
||||||
default_values="0"
|
|
||||||
animateable="0">
|
|
||||||
<Documentation>
|
|
||||||
ZoneMesh information is used to find {cell,face,point}Zones.
|
|
||||||
The polyMesh/ directory is only checked on startup.
|
|
||||||
</Documentation>
|
|
||||||
<BooleanDomain name="bool"/>
|
|
||||||
</IntVectorProperty>
|
|
||||||
|
|
||||||
<!-- Show Patch Names check-box -->
|
|
||||||
<IntVectorProperty
|
|
||||||
name="UiShowPatchNames"
|
|
||||||
command="SetShowPatchNames"
|
|
||||||
number_of_elements="1"
|
|
||||||
default_values="0"
|
|
||||||
is_internal="1"
|
|
||||||
animateable="0">
|
|
||||||
<BooleanDomain name="bool"/>
|
<BooleanDomain name="bool"/>
|
||||||
<Documentation>
|
<Documentation>
|
||||||
Show patch names in render window
|
Cache the fvMesh in memory.
|
||||||
</Documentation>
|
</Documentation>
|
||||||
</IntVectorProperty>
|
</IntVectorProperty>
|
||||||
|
|
||||||
<!-- Show Groups Only check-box -->
|
<PropertyGroup
|
||||||
<IntVectorProperty
|
label="General Controls"
|
||||||
name="UiShowGroupsOnly"
|
panel_widget="openfoam_reader_general_controls">
|
||||||
command="SetShowGroupsOnly"
|
<Property name="Refresh"/>
|
||||||
number_of_elements="1"
|
<Property name="ZeroTime"/>
|
||||||
default_values="0"
|
<Property name="IncludeSets"/>
|
||||||
is_internal="1"
|
<Property name="IncludeZones"/>
|
||||||
animateable="0">
|
<Property name="InterpolateFields"/>
|
||||||
<BooleanDomain name="bool"/>
|
<Property name="ExtrapolatePatches"/>
|
||||||
<Documentation>
|
<Property name="ShowGroupsOnly"/>
|
||||||
Show groups only
|
<Property name="ShowPatchNames"/>
|
||||||
</Documentation>
|
<Property name="UpdateGUI"/>
|
||||||
</IntVectorProperty>
|
<Property name="UseVTKPolyhedron"/>
|
||||||
|
<Property name="CacheMesh"/>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<!-- Force GUI update check box -->
|
<!-- Parts Selections -->
|
||||||
<IntVectorProperty
|
|
||||||
name="UpdateGUI"
|
|
||||||
command="SetUpdateGUI"
|
|
||||||
number_of_elements="1"
|
|
||||||
is_internal="1"
|
|
||||||
default_values="0"
|
|
||||||
animateable="0">
|
|
||||||
<BooleanDomain name="bool"/>
|
|
||||||
<Documentation>
|
|
||||||
A simple way to cause a reader GUI modification.
|
|
||||||
</Documentation>
|
|
||||||
</IntVectorProperty>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
| Selections
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!-- Available Parts (volume, patches, lagrangian) array -->
|
<!-- Available Parts (volume, patches, lagrangian) array -->
|
||||||
<StringVectorProperty
|
<StringVectorProperty
|
||||||
@ -191,7 +196,7 @@
|
|||||||
information_only="1">
|
information_only="1">
|
||||||
<ArraySelectionInformationHelper attribute_name="Part"/>
|
<ArraySelectionInformationHelper attribute_name="Part"/>
|
||||||
</StringVectorProperty>
|
</StringVectorProperty>
|
||||||
<StringVectorProperty
|
<StringVectorProperty animateable="0"
|
||||||
name="PartStatus"
|
name="PartStatus"
|
||||||
label="Mesh Parts"
|
label="Mesh Parts"
|
||||||
command="SetPartArrayStatus"
|
command="SetPartArrayStatus"
|
||||||
@ -199,26 +204,31 @@
|
|||||||
repeat_command="1"
|
repeat_command="1"
|
||||||
number_of_elements_per_command="2"
|
number_of_elements_per_command="2"
|
||||||
element_types="2 0"
|
element_types="2 0"
|
||||||
information_property="PartArrayStatus"
|
information_property="PartArrayStatus">
|
||||||
animateable="0">
|
|
||||||
<ArraySelectionDomain name="array_list">
|
<ArraySelectionDomain name="array_list">
|
||||||
<RequiredProperties>
|
<RequiredProperties>
|
||||||
<Property name="PartArrayStatus" function="ArrayList"/>
|
<Property name="PartArrayStatus" function="ArrayList"/>
|
||||||
</RequiredProperties>
|
</RequiredProperties>
|
||||||
</ArraySelectionDomain>
|
</ArraySelectionDomain>
|
||||||
<Documentation>
|
<Documentation>
|
||||||
This property contains a list of the mesh parts
|
The list of mesh parts (patches, groups, sets, zones).
|
||||||
(patches, groups, sets, zones).
|
|
||||||
</Documentation>
|
</Documentation>
|
||||||
</StringVectorProperty>
|
</StringVectorProperty>
|
||||||
|
|
||||||
|
<PropertyGroup label="Parts">
|
||||||
|
<Property name="PartArrayStatus"/>
|
||||||
|
<Property name="PartStatus"/>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<!-- Fields Selections -->
|
||||||
|
|
||||||
<!-- Available volFields array -->
|
<!-- Available volFields array -->
|
||||||
<StringVectorProperty
|
<StringVectorProperty
|
||||||
name="VolFieldArrayStatus"
|
name="VolFieldArrayStatus"
|
||||||
information_only="1">
|
information_only="1">
|
||||||
<ArraySelectionInformationHelper attribute_name="VolField"/>
|
<ArraySelectionInformationHelper attribute_name="VolField"/>
|
||||||
</StringVectorProperty>
|
</StringVectorProperty>
|
||||||
<StringVectorProperty
|
<StringVectorProperty animateable="0"
|
||||||
name="VolFieldStatus"
|
name="VolFieldStatus"
|
||||||
label="Volume Fields"
|
label="Volume Fields"
|
||||||
command="SetVolFieldArrayStatus"
|
command="SetVolFieldArrayStatus"
|
||||||
@ -226,16 +236,13 @@
|
|||||||
repeat_command="1"
|
repeat_command="1"
|
||||||
number_of_elements_per_command="2"
|
number_of_elements_per_command="2"
|
||||||
element_types="2 0"
|
element_types="2 0"
|
||||||
information_property="VolFieldArrayStatus"
|
information_property="VolFieldArrayStatus">
|
||||||
animateable="0">
|
|
||||||
<ArraySelectionDomain name="array_list">
|
<ArraySelectionDomain name="array_list">
|
||||||
<RequiredProperties>
|
<RequiredProperties>
|
||||||
<Property name="VolFieldArrayStatus" function="ArrayList"/>
|
<Property name="VolFieldArrayStatus" function="ArrayList"/>
|
||||||
</RequiredProperties>
|
</RequiredProperties>
|
||||||
</ArraySelectionDomain>
|
</ArraySelectionDomain>
|
||||||
<Documentation>
|
<Documentation>The list of volume fields.</Documentation>
|
||||||
This property contains a list of the volume fields
|
|
||||||
</Documentation>
|
|
||||||
</StringVectorProperty>
|
</StringVectorProperty>
|
||||||
|
|
||||||
<!-- Available Lagrangian fields array -->
|
<!-- Available Lagrangian fields array -->
|
||||||
@ -244,7 +251,7 @@
|
|||||||
information_only="1">
|
information_only="1">
|
||||||
<ArraySelectionInformationHelper attribute_name="LagrangianField"/>
|
<ArraySelectionInformationHelper attribute_name="LagrangianField"/>
|
||||||
</StringVectorProperty>
|
</StringVectorProperty>
|
||||||
<StringVectorProperty
|
<StringVectorProperty animateable="0"
|
||||||
name="LagrangianFieldStatus"
|
name="LagrangianFieldStatus"
|
||||||
label="Lagrangian Fields"
|
label="Lagrangian Fields"
|
||||||
command="SetLagrangianFieldArrayStatus"
|
command="SetLagrangianFieldArrayStatus"
|
||||||
@ -252,16 +259,13 @@
|
|||||||
repeat_command="1"
|
repeat_command="1"
|
||||||
number_of_elements_per_command="2"
|
number_of_elements_per_command="2"
|
||||||
element_types="2 0"
|
element_types="2 0"
|
||||||
information_property="LagrangianFieldArrayStatus"
|
information_property="LagrangianFieldArrayStatus">
|
||||||
animateable="0">
|
|
||||||
<ArraySelectionDomain name="array_list">
|
<ArraySelectionDomain name="array_list">
|
||||||
<RequiredProperties>
|
<RequiredProperties>
|
||||||
<Property name="LagrangianFieldArrayStatus" function="ArrayList"/>
|
<Property name="LagrangianFieldArrayStatus" function="ArrayList"/>
|
||||||
</RequiredProperties>
|
</RequiredProperties>
|
||||||
</ArraySelectionDomain>
|
</ArraySelectionDomain>
|
||||||
<Documentation>
|
<Documentation>The list of Lagrangian fields.</Documentation>
|
||||||
This property contains a list of the lagrangian fields
|
|
||||||
</Documentation>
|
|
||||||
</StringVectorProperty>
|
</StringVectorProperty>
|
||||||
|
|
||||||
<!-- Available pointFields array -->
|
<!-- Available pointFields array -->
|
||||||
@ -270,7 +274,7 @@
|
|||||||
information_only="1">
|
information_only="1">
|
||||||
<ArraySelectionInformationHelper attribute_name="PointField"/>
|
<ArraySelectionInformationHelper attribute_name="PointField"/>
|
||||||
</StringVectorProperty>
|
</StringVectorProperty>
|
||||||
<StringVectorProperty
|
<StringVectorProperty animateable="0"
|
||||||
name="PointFieldStatus"
|
name="PointFieldStatus"
|
||||||
label="Point Fields"
|
label="Point Fields"
|
||||||
command="SetPointFieldArrayStatus"
|
command="SetPointFieldArrayStatus"
|
||||||
@ -278,31 +282,42 @@
|
|||||||
repeat_command="1"
|
repeat_command="1"
|
||||||
number_of_elements_per_command="2"
|
number_of_elements_per_command="2"
|
||||||
element_types="2 0"
|
element_types="2 0"
|
||||||
information_property="PointFieldArrayStatus"
|
information_property="PointFieldArrayStatus">
|
||||||
animateable="0">
|
|
||||||
<ArraySelectionDomain name="array_list">
|
<ArraySelectionDomain name="array_list">
|
||||||
<RequiredProperties>
|
<RequiredProperties>
|
||||||
<Property name="PointFieldArrayStatus" function="ArrayList"/>
|
<Property name="PointFieldArrayStatus" function="ArrayList"/>
|
||||||
</RequiredProperties>
|
</RequiredProperties>
|
||||||
</ArraySelectionDomain>
|
</ArraySelectionDomain>
|
||||||
<Documentation>
|
<Documentation>The list of point fields.</Documentation>
|
||||||
This property contains a list of the point fields
|
|
||||||
</Documentation>
|
|
||||||
</StringVectorProperty>
|
</StringVectorProperty>
|
||||||
|
|
||||||
<Hints>
|
<PropertyGroup label="Fields">
|
||||||
<Property name="FileName" show="0"/>
|
<Property name="VolFieldArrayStatus"/>
|
||||||
<Property name="UiCacheMesh" show="0"/>
|
<Property name="VolFieldStatus"/>
|
||||||
<Property name="UiZeroTime" show="0"/>
|
<Property name="LagrangianFieldArrayStatus"/>
|
||||||
<Property name="UiRefresh" show="0"/>
|
<Property name="LagrangianFieldStatus"/>
|
||||||
<Property name="UiShowPatchNames" show="0"/>
|
<Property name="PointFieldArrayStatus"/>
|
||||||
<Property name="UiShowGroupsOnly" show="0"/>
|
<Property name="PointFieldStatus"/>
|
||||||
<Property name="UiIncludeSets" show="0"/>
|
</PropertyGroup>
|
||||||
<Property name="UiIncludeZones" show="0"/>
|
|
||||||
<ReaderFactory extensions="OpenFOAM"
|
|
||||||
file_description="OpenFOAM"/>
|
|
||||||
</Hints>
|
|
||||||
|
|
||||||
|
<!-- Miscellaneous -->
|
||||||
|
|
||||||
|
<!-- Print button -->
|
||||||
|
<Property animateable="0"
|
||||||
|
name="PrintInfo"
|
||||||
|
command="PrintInfo"
|
||||||
|
panel_widget="command_button"
|
||||||
|
panel_visibility="advanced">
|
||||||
|
<Documentation>
|
||||||
|
Print basic information to stdout
|
||||||
|
</Documentation>
|
||||||
|
</Property>
|
||||||
|
|
||||||
|
<Hints>
|
||||||
|
<ReaderFactory
|
||||||
|
extensions="OpenFOAM"
|
||||||
|
file_description="OpenFOAM reader module" />
|
||||||
|
</Hints>
|
||||||
|
|
||||||
</SourceProxy>
|
</SourceProxy>
|
||||||
</ProxyGroup>
|
</ProxyGroup>
|
||||||
|
|||||||
@ -0,0 +1,368 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 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 "pqFoamReaderControls.h"
|
||||||
|
|
||||||
|
#include <QCheckBox>
|
||||||
|
#include <QFrame>
|
||||||
|
#include <QGridLayout>
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
|
#include "pqPVApplicationCore.h"
|
||||||
|
#include "pqPipelineRepresentation.h"
|
||||||
|
#include "pqView.h"
|
||||||
|
#include "vtkSMDocumentation.h"
|
||||||
|
#include "vtkSMIntVectorProperty.h"
|
||||||
|
#include "vtkSMPropertyGroup.h"
|
||||||
|
#include "vtkSMSourceProxy.h"
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// file-scope
|
||||||
|
static QAbstractButton* setButtonProperties
|
||||||
|
(
|
||||||
|
QAbstractButton* b,
|
||||||
|
vtkSMProperty* prop
|
||||||
|
)
|
||||||
|
{
|
||||||
|
QString tip;
|
||||||
|
|
||||||
|
vtkSMDocumentation* doc = prop->GetDocumentation();
|
||||||
|
if (doc)
|
||||||
|
{
|
||||||
|
const char* txt = doc->GetDescription();
|
||||||
|
if (txt)
|
||||||
|
{
|
||||||
|
tip = QString(txt).simplified();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
b->setText(prop->GetXMLLabel());
|
||||||
|
if (tip.size())
|
||||||
|
{
|
||||||
|
b->setToolTip(tip);
|
||||||
|
}
|
||||||
|
b->setFocusPolicy(Qt::NoFocus); // avoid dotted border
|
||||||
|
|
||||||
|
vtkSMIntVectorProperty* intProp =
|
||||||
|
vtkSMIntVectorProperty::SafeDownCast(prop);
|
||||||
|
|
||||||
|
// initial checked state for integer (bool) properties
|
||||||
|
if (intProp)
|
||||||
|
{
|
||||||
|
b->setChecked(intProp->GetElement(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static vtkSMIntVectorProperty* lookupIntProp
|
||||||
|
(
|
||||||
|
vtkSMPropertyGroup* group,
|
||||||
|
const char* name
|
||||||
|
)
|
||||||
|
{
|
||||||
|
vtkSMProperty* prop = group->GetProperty(name);
|
||||||
|
|
||||||
|
if (prop)
|
||||||
|
{
|
||||||
|
return vtkSMIntVectorProperty::SafeDownCast(prop);
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void pqFoamReaderControls::fireCommand
|
||||||
|
(
|
||||||
|
vtkSMIntVectorProperty* prop,
|
||||||
|
bool checked
|
||||||
|
)
|
||||||
|
{
|
||||||
|
vtkSMProxy* pxy = this->proxy();
|
||||||
|
|
||||||
|
prop->SetElement(0, checked); // Toogle bool
|
||||||
|
|
||||||
|
// Fire off command
|
||||||
|
prop->Modified();
|
||||||
|
pxy->UpdateProperty(pxy->GetPropertyName(prop));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void pqFoamReaderControls::updateParts()
|
||||||
|
{
|
||||||
|
vtkSMProxy* pxy = this->proxy();
|
||||||
|
|
||||||
|
pxy->UpdatePropertyInformation(pxy->GetProperty("PartArrayStatus"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void pqFoamReaderControls::refreshPressed()
|
||||||
|
{
|
||||||
|
vtkSMProxy* pxy = this->proxy();
|
||||||
|
|
||||||
|
// Fire off command
|
||||||
|
refresh_->Modified();
|
||||||
|
pxy->UpdateProperty(pxy->GetPropertyName(refresh_));
|
||||||
|
|
||||||
|
vtkSMSourceProxy::SafeDownCast(pxy)->UpdatePipeline();
|
||||||
|
|
||||||
|
// Trigger a rendering (all views)
|
||||||
|
pqPVApplicationCore::instance()->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void pqFoamReaderControls::cacheMesh(bool checked)
|
||||||
|
{
|
||||||
|
fireCommand(cacheMesh_, checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void pqFoamReaderControls::showPatchNames(bool checked)
|
||||||
|
{
|
||||||
|
fireCommand(showPatchNames_, checked);
|
||||||
|
|
||||||
|
// update the active view
|
||||||
|
if (this->view())
|
||||||
|
{
|
||||||
|
this->view()->render();
|
||||||
|
}
|
||||||
|
// OR: update all views
|
||||||
|
// pqPVApplicationCore::instance()->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void pqFoamReaderControls::showGroupsOnly(bool checked)
|
||||||
|
{
|
||||||
|
fireCommand(showGroupsOnly_, checked);
|
||||||
|
updateParts();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void pqFoamReaderControls::includeSets(bool checked)
|
||||||
|
{
|
||||||
|
fireCommand(includeSets_, checked);
|
||||||
|
updateParts();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void pqFoamReaderControls::includeZones(bool checked)
|
||||||
|
{
|
||||||
|
fireCommand(includeZones_, checked);
|
||||||
|
updateParts();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
pqFoamReaderControls::pqFoamReaderControls
|
||||||
|
(
|
||||||
|
vtkSMProxy* proxy,
|
||||||
|
vtkSMPropertyGroup* group,
|
||||||
|
QWidget* parent
|
||||||
|
)
|
||||||
|
:
|
||||||
|
Superclass(proxy, parent),
|
||||||
|
refresh_(group->GetProperty("Refresh")),
|
||||||
|
showPatchNames_(lookupIntProp(group, "ShowPatchNames")),
|
||||||
|
showGroupsOnly_(lookupIntProp(group, "ShowGroupsOnly")),
|
||||||
|
includeSets_(lookupIntProp(group, "IncludeSets")),
|
||||||
|
includeZones_(lookupIntProp(group, "IncludeZones")),
|
||||||
|
cacheMesh_(lookupIntProp(group, "CacheMesh"))
|
||||||
|
{
|
||||||
|
typedef vtkSMIntVectorProperty intProp;
|
||||||
|
|
||||||
|
QGridLayout* form = new QGridLayout(this);
|
||||||
|
|
||||||
|
// ROW
|
||||||
|
// ~~~
|
||||||
|
int row = 0;
|
||||||
|
|
||||||
|
if (refresh_)
|
||||||
|
{
|
||||||
|
QPushButton* b = new QPushButton(this);
|
||||||
|
setButtonProperties(b, refresh_);
|
||||||
|
form->addWidget(b, row, 0, Qt::AlignLeft);
|
||||||
|
|
||||||
|
connect(b, SIGNAL(clicked()), this, SLOT(refreshPressed()));
|
||||||
|
}
|
||||||
|
|
||||||
|
intProp* zeroTime = lookupIntProp(group, "ZeroTime");
|
||||||
|
if (zeroTime)
|
||||||
|
{
|
||||||
|
QCheckBox* b = new QCheckBox(this);
|
||||||
|
setButtonProperties(b, zeroTime);
|
||||||
|
form->addWidget(b, row, 1, Qt::AlignLeft);
|
||||||
|
|
||||||
|
addPropertyLink(b, "checked", SIGNAL(toggled(bool)), zeroTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
// LINE
|
||||||
|
// ~~~~
|
||||||
|
++row;
|
||||||
|
{
|
||||||
|
QFrame* hline = new QFrame(this);
|
||||||
|
hline->setFrameStyle(QFrame::HLine | QFrame::Sunken);
|
||||||
|
form->addWidget(hline, row, 0, 1, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ROW
|
||||||
|
// ~~~
|
||||||
|
++row;
|
||||||
|
|
||||||
|
if (includeSets_)
|
||||||
|
{
|
||||||
|
QCheckBox* b = new QCheckBox(this);
|
||||||
|
setButtonProperties(b, includeSets_);
|
||||||
|
form->addWidget(b, row, 0, Qt::AlignLeft);
|
||||||
|
|
||||||
|
addPropertyLink(b, "checked", SIGNAL(toggled(bool)), includeSets_);
|
||||||
|
connect(b, SIGNAL(toggled(bool)), this, SLOT(includeSets(bool)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showGroupsOnly_)
|
||||||
|
{
|
||||||
|
QCheckBox* b = new QCheckBox(this);
|
||||||
|
setButtonProperties(b, showGroupsOnly_);
|
||||||
|
form->addWidget(b, row, 1, Qt::AlignLeft);
|
||||||
|
|
||||||
|
addPropertyLink(b, "checked", SIGNAL(toggled(bool)), showGroupsOnly_);
|
||||||
|
connect(b, SIGNAL(toggled(bool)), this, SLOT(showGroupsOnly(bool)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ROW
|
||||||
|
// ~~~
|
||||||
|
++row;
|
||||||
|
|
||||||
|
if (includeZones_)
|
||||||
|
{
|
||||||
|
QCheckBox* b = new QCheckBox(this);
|
||||||
|
setButtonProperties(b, includeZones_);
|
||||||
|
form->addWidget(b, row, 0, Qt::AlignLeft);
|
||||||
|
|
||||||
|
addPropertyLink(b, "checked", SIGNAL(toggled(bool)), includeZones_);
|
||||||
|
connect(b, SIGNAL(toggled(bool)), this, SLOT(includeZones(bool)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showPatchNames_)
|
||||||
|
{
|
||||||
|
QCheckBox* b = new QCheckBox(this);
|
||||||
|
setButtonProperties(b, showPatchNames_);
|
||||||
|
form->addWidget(b, row, 1, Qt::AlignLeft);
|
||||||
|
|
||||||
|
connect(b, SIGNAL(toggled(bool)), this, SLOT(showPatchNames(bool)));
|
||||||
|
}
|
||||||
|
|
||||||
|
// LINE
|
||||||
|
// ~~~~
|
||||||
|
++row;
|
||||||
|
{
|
||||||
|
QFrame* hline = new QFrame(this);
|
||||||
|
hline->setFrameStyle(QFrame::HLine | QFrame::Sunken);
|
||||||
|
form->addWidget(hline, row, 0, 1, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ROW
|
||||||
|
// ~~~
|
||||||
|
++row;
|
||||||
|
|
||||||
|
intProp* interpolate = lookupIntProp(group, "InterpolateFields");
|
||||||
|
if (interpolate)
|
||||||
|
{
|
||||||
|
QCheckBox* b = new QCheckBox(this);
|
||||||
|
setButtonProperties(b, interpolate);
|
||||||
|
form->addWidget(b, row, 0, Qt::AlignLeft);
|
||||||
|
|
||||||
|
addPropertyLink(b, "checked", SIGNAL(toggled(bool)), interpolate);
|
||||||
|
}
|
||||||
|
|
||||||
|
intProp* extrapolate = lookupIntProp(group, "ExtrapolatePatches");
|
||||||
|
if (extrapolate)
|
||||||
|
{
|
||||||
|
QCheckBox* b = new QCheckBox(this);
|
||||||
|
setButtonProperties(b, extrapolate);
|
||||||
|
form->addWidget(b, row, 1, Qt::AlignLeft);
|
||||||
|
|
||||||
|
addPropertyLink(b, "checked", SIGNAL(toggled(bool)), extrapolate);
|
||||||
|
}
|
||||||
|
|
||||||
|
// LINE
|
||||||
|
// ~~~~
|
||||||
|
++row;
|
||||||
|
{
|
||||||
|
QFrame* hline = new QFrame(this);
|
||||||
|
hline->setFrameStyle(QFrame::HLine | QFrame::Sunken);
|
||||||
|
form->addWidget(hline, row, 0, 1, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ROW
|
||||||
|
// ~~~
|
||||||
|
++row;
|
||||||
|
|
||||||
|
intProp* updateGui = lookupIntProp(group, "UpdateGUI");
|
||||||
|
if (updateGui)
|
||||||
|
{
|
||||||
|
QPushButton* b = new QPushButton(this);
|
||||||
|
setButtonProperties(b, updateGui);
|
||||||
|
form->addWidget(b, row, 0, Qt::AlignLeft);
|
||||||
|
|
||||||
|
addPropertyLink(b, "checked", SIGNAL(clicked()), updateGui);
|
||||||
|
}
|
||||||
|
|
||||||
|
intProp* usePolyhedron = lookupIntProp(group, "UseVTKPolyhedron");
|
||||||
|
if (usePolyhedron)
|
||||||
|
{
|
||||||
|
QCheckBox* b = new QCheckBox(this);
|
||||||
|
setButtonProperties(b, usePolyhedron);
|
||||||
|
form->addWidget(b, row, 1, Qt::AlignLeft);
|
||||||
|
|
||||||
|
addPropertyLink(b, "checked", SIGNAL(toggled(bool)), usePolyhedron);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cacheMesh_)
|
||||||
|
{
|
||||||
|
QCheckBox* b = new QCheckBox(this);
|
||||||
|
setButtonProperties(b, cacheMesh_);
|
||||||
|
form->addWidget(b, row, 2, Qt::AlignLeft);
|
||||||
|
|
||||||
|
connect(b, SIGNAL(toggled(bool)), this, SLOT(cacheMesh(bool)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
pqFoamReaderControls::~pqFoamReaderControls()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,132 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 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
|
||||||
|
pqFoamReaderControls
|
||||||
|
|
||||||
|
Description
|
||||||
|
A custom property group widget for the PVFoamReader.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
pqFoamReaderControls.cxx
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
#ifndef pqFoamReaderControls_h
|
||||||
|
#define pqFoamReaderControls_h
|
||||||
|
|
||||||
|
#include "pqPropertyWidget.h"
|
||||||
|
|
||||||
|
// Forward declarations
|
||||||
|
class vtkSMProperty;
|
||||||
|
class vtkSMIntVectorProperty;
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class pqFoamReaderControls Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class pqFoamReaderControls
|
||||||
|
:
|
||||||
|
public pqPropertyWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT;
|
||||||
|
typedef pqPropertyWidget Superclass;
|
||||||
|
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Refresh (push button)
|
||||||
|
vtkSMProperty* refresh_;
|
||||||
|
|
||||||
|
//- Show Patch Names (bool property)
|
||||||
|
vtkSMIntVectorProperty* showPatchNames_;
|
||||||
|
|
||||||
|
//- Show Groups Only (bool property)
|
||||||
|
vtkSMIntVectorProperty* showGroupsOnly_;
|
||||||
|
|
||||||
|
//- IncludeSets (bool property)
|
||||||
|
vtkSMIntVectorProperty* includeSets_;
|
||||||
|
|
||||||
|
//- IncludeZones (bool property)
|
||||||
|
vtkSMIntVectorProperty* includeZones_;
|
||||||
|
|
||||||
|
//- CacheMesh (bool property)
|
||||||
|
vtkSMIntVectorProperty* cacheMesh_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Update property
|
||||||
|
void fireCommand(vtkSMProperty* prop);
|
||||||
|
|
||||||
|
//- Toggle and update bool property
|
||||||
|
void fireCommand(vtkSMIntVectorProperty* prop, bool checked);
|
||||||
|
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
pqFoamReaderControls(const pqFoamReaderControls&) = delete;
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const pqFoamReaderControls&) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Update "PartArrayStatus" property information
|
||||||
|
void updateParts();
|
||||||
|
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
void refreshPressed();
|
||||||
|
void cacheMesh(bool checked);
|
||||||
|
void showPatchNames(bool checked);
|
||||||
|
void showGroupsOnly(bool checked);
|
||||||
|
void includeSets(bool checked);
|
||||||
|
void includeZones(bool checked);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
pqFoamReaderControls
|
||||||
|
(
|
||||||
|
vtkSMProxy* proxy,
|
||||||
|
vtkSMPropertyGroup* group,
|
||||||
|
QWidget* parent = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~pqFoamReaderControls();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -1,485 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
||||||
\\/ 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 "pqPVFoamReaderPanel.h"
|
|
||||||
|
|
||||||
// QT
|
|
||||||
#include <QGridLayout>
|
|
||||||
#include <QCheckBox>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QLayout>
|
|
||||||
#include <QString>
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QtDebug>
|
|
||||||
|
|
||||||
// Paraview <-> QT UI
|
|
||||||
#include "pqAnimationScene.h"
|
|
||||||
#include "pqApplicationCore.h"
|
|
||||||
#include "pqPipelineRepresentation.h"
|
|
||||||
#include "pqServerManagerModel.h"
|
|
||||||
#include "pqView.h"
|
|
||||||
|
|
||||||
// Paraview Server Manager
|
|
||||||
#include "vtkSMDoubleVectorProperty.h"
|
|
||||||
#include "vtkSMIntVectorProperty.h"
|
|
||||||
#include "vtkSMProperty.h"
|
|
||||||
#include "vtkSMSourceProxy.h"
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
pqPVFoamReaderPanel::pqPVFoamReaderPanel
|
|
||||||
(
|
|
||||||
pqProxy *proxy,
|
|
||||||
QWidget *p
|
|
||||||
)
|
|
||||||
:
|
|
||||||
pqAutoGeneratedObjectPanel(proxy, p)
|
|
||||||
{
|
|
||||||
// create first sublayout (at top of the panel)
|
|
||||||
QGridLayout* form = new QGridLayout();
|
|
||||||
this->PanelLayout->addLayout(form, 0, 0, 1, -1);
|
|
||||||
|
|
||||||
// ROW 0
|
|
||||||
// ~~~~~
|
|
||||||
|
|
||||||
vtkSMProperty* prop = 0;
|
|
||||||
|
|
||||||
// refresh button for updating times/fields
|
|
||||||
if ((prop = this->proxy()->GetProperty("UiRefresh")) != 0)
|
|
||||||
{
|
|
||||||
prop->SetImmediateUpdate(1);
|
|
||||||
QPushButton* refresh = new QPushButton("Refresh Times");
|
|
||||||
refresh->setToolTip("Rescan for updated times/fields.");
|
|
||||||
|
|
||||||
form->addWidget(refresh, 0, 0, Qt::AlignLeft);
|
|
||||||
QObject::connect
|
|
||||||
(
|
|
||||||
refresh,
|
|
||||||
SIGNAL(clicked()),
|
|
||||||
this,
|
|
||||||
SLOT(RefreshPressed())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// checkbox for skip zeroTime
|
|
||||||
if ((prop = this->proxy()->GetProperty("UiZeroTime")) != 0)
|
|
||||||
{
|
|
||||||
// immediate update on the Server Manager side
|
|
||||||
prop->SetImmediateUpdate(true);
|
|
||||||
|
|
||||||
ZeroTime_ = new QCheckBox("Skip Zero Time");
|
|
||||||
ZeroTime_->setChecked
|
|
||||||
(
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
|
|
||||||
);
|
|
||||||
ZeroTime_->setToolTip
|
|
||||||
(
|
|
||||||
"Skip including the 0/ time directory."
|
|
||||||
);
|
|
||||||
|
|
||||||
form->addWidget(ZeroTime_, 0, 1, Qt::AlignLeft);
|
|
||||||
connect
|
|
||||||
(
|
|
||||||
ZeroTime_,
|
|
||||||
SIGNAL(stateChanged(int)),
|
|
||||||
this,
|
|
||||||
SLOT(ZeroTimeToggled())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ROW 1
|
|
||||||
// ~~~~~
|
|
||||||
|
|
||||||
QFrame* hline1 = new QFrame(this);
|
|
||||||
hline1->setFrameStyle(QFrame::HLine | QFrame::Sunken);
|
|
||||||
form->addWidget(hline1, 1, 0, 1, 3);
|
|
||||||
|
|
||||||
// ROW 2
|
|
||||||
// ~~~~~
|
|
||||||
|
|
||||||
// checkbox for caching mesh
|
|
||||||
if ((prop = this->proxy()->GetProperty("UiCacheMesh")) != 0)
|
|
||||||
{
|
|
||||||
// immediate update on the Server Manager side
|
|
||||||
prop->SetImmediateUpdate(true);
|
|
||||||
|
|
||||||
CacheMesh_ = new QCheckBox("Cache Mesh");
|
|
||||||
CacheMesh_->setChecked
|
|
||||||
(
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
|
|
||||||
);
|
|
||||||
CacheMesh_->setToolTip
|
|
||||||
(
|
|
||||||
"Cache the fvMesh in memory."
|
|
||||||
);
|
|
||||||
|
|
||||||
form->addWidget(CacheMesh_, 2, 0, Qt::AlignLeft);
|
|
||||||
connect
|
|
||||||
(
|
|
||||||
CacheMesh_,
|
|
||||||
SIGNAL(stateChanged(int)),
|
|
||||||
this,
|
|
||||||
SLOT(CacheMeshToggled())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// cell 2,1 empty
|
|
||||||
|
|
||||||
// ROW 3
|
|
||||||
// ~~~~~
|
|
||||||
|
|
||||||
// checkbox for include sets
|
|
||||||
if ((prop = this->proxy()->GetProperty("UiIncludeSets")) != 0)
|
|
||||||
{
|
|
||||||
// immediate update on the Server Manager side
|
|
||||||
prop->SetImmediateUpdate(true);
|
|
||||||
|
|
||||||
IncludeSets_ = new QCheckBox("Include Sets");
|
|
||||||
IncludeSets_->setChecked
|
|
||||||
(
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
|
|
||||||
);
|
|
||||||
IncludeSets_->setToolTip
|
|
||||||
(
|
|
||||||
"Search the polyMesh/sets/ directory."
|
|
||||||
);
|
|
||||||
|
|
||||||
// row/col 1,0
|
|
||||||
form->addWidget(IncludeSets_, 3, 0, Qt::AlignLeft);
|
|
||||||
connect
|
|
||||||
(
|
|
||||||
IncludeSets_,
|
|
||||||
SIGNAL(stateChanged(int)),
|
|
||||||
this,
|
|
||||||
SLOT(IncludeSetsToggled())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// checkbox for Groups Only
|
|
||||||
if ((prop = this->proxy()->GetProperty("UiShowGroupsOnly")) != 0)
|
|
||||||
{
|
|
||||||
// immediate update on the Server Manager side
|
|
||||||
prop->SetImmediateUpdate(true);
|
|
||||||
|
|
||||||
ShowGroupsOnly_ = new QCheckBox("Groups Only");
|
|
||||||
ShowGroupsOnly_->setChecked
|
|
||||||
(
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
|
|
||||||
);
|
|
||||||
ShowGroupsOnly_->setToolTip
|
|
||||||
(
|
|
||||||
"Show patchGroups only."
|
|
||||||
);
|
|
||||||
|
|
||||||
// row/col 2, 2
|
|
||||||
form->addWidget(ShowGroupsOnly_, 3, 1, Qt::AlignLeft);
|
|
||||||
connect
|
|
||||||
(
|
|
||||||
ShowGroupsOnly_,
|
|
||||||
SIGNAL(stateChanged(int)),
|
|
||||||
this,
|
|
||||||
SLOT(ShowGroupsOnlyToggled())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ROW 4
|
|
||||||
// ~~~~~
|
|
||||||
|
|
||||||
// checkbox for include zones
|
|
||||||
if ((prop = this->proxy()->GetProperty("UiIncludeZones")) != 0)
|
|
||||||
{
|
|
||||||
// immediate update on the Server Manager side
|
|
||||||
prop->SetImmediateUpdate(true);
|
|
||||||
|
|
||||||
IncludeZones_ = new QCheckBox("Include Zones");
|
|
||||||
IncludeZones_->setChecked
|
|
||||||
(
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
|
|
||||||
);
|
|
||||||
IncludeZones_->setToolTip
|
|
||||||
(
|
|
||||||
"ZoneMesh information is used to find {cell,face,point}Zones. "
|
|
||||||
"The polyMesh/ directory is only checked on startup."
|
|
||||||
);
|
|
||||||
|
|
||||||
// row/col 1,1
|
|
||||||
form->addWidget(IncludeZones_, 4, 0, Qt::AlignLeft);
|
|
||||||
connect
|
|
||||||
(
|
|
||||||
IncludeZones_,
|
|
||||||
SIGNAL(stateChanged(int)),
|
|
||||||
this,
|
|
||||||
SLOT(IncludeZonesToggled())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// checkbox for patch names
|
|
||||||
if ((prop = this->proxy()->GetProperty("UiShowPatchNames")) != 0)
|
|
||||||
{
|
|
||||||
// immediate update on the Server Manager side
|
|
||||||
prop->SetImmediateUpdate(true);
|
|
||||||
|
|
||||||
ShowPatchNames_ = new QCheckBox("Patch Names");
|
|
||||||
ShowPatchNames_->setChecked
|
|
||||||
(
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
|
|
||||||
);
|
|
||||||
ShowPatchNames_->setToolTip
|
|
||||||
(
|
|
||||||
"Show patch names in render window."
|
|
||||||
);
|
|
||||||
|
|
||||||
// row/col 0,1
|
|
||||||
form->addWidget(ShowPatchNames_, 4, 1, Qt::AlignLeft);
|
|
||||||
connect
|
|
||||||
(
|
|
||||||
ShowPatchNames_,
|
|
||||||
SIGNAL(stateChanged(int)),
|
|
||||||
this,
|
|
||||||
SLOT(ShowPatchNamesToggled())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ROW 5
|
|
||||||
// ~~~~~
|
|
||||||
|
|
||||||
QFrame* hline2 = new QFrame(this);
|
|
||||||
hline2->setFrameStyle(QFrame::HLine | QFrame::Sunken);
|
|
||||||
form->addWidget(hline2, 5, 0, 1, 3);
|
|
||||||
|
|
||||||
// ROW 6
|
|
||||||
// ~~~~~
|
|
||||||
|
|
||||||
// checkbox for vol field interpolation
|
|
||||||
if ((prop = this->proxy()->GetProperty("UiInterpolateVolFields")) != 0)
|
|
||||||
{
|
|
||||||
// immediate update on the Server Manager side
|
|
||||||
prop->SetImmediateUpdate(true);
|
|
||||||
|
|
||||||
InterpolateVolFields_ = new QCheckBox("Interpolate volFields");
|
|
||||||
InterpolateVolFields_->setChecked
|
|
||||||
(
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
|
|
||||||
);
|
|
||||||
InterpolateVolFields_->setToolTip
|
|
||||||
(
|
|
||||||
"Interpolate volFields into pointFields"
|
|
||||||
);
|
|
||||||
|
|
||||||
// row/col 1,1
|
|
||||||
form->addWidget(InterpolateVolFields_, 6, 0, Qt::AlignLeft);
|
|
||||||
connect
|
|
||||||
(
|
|
||||||
InterpolateVolFields_,
|
|
||||||
SIGNAL(stateChanged(int)),
|
|
||||||
this,
|
|
||||||
SLOT(InterpolateVolFieldsToggled())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// checkbox for extrapolate patches
|
|
||||||
if ((prop = this->proxy()->GetProperty("UiExtrapolatePatches")) != 0)
|
|
||||||
{
|
|
||||||
// immediate update on the Server Manager side
|
|
||||||
prop->SetImmediateUpdate(true);
|
|
||||||
|
|
||||||
ExtrapolatePatches_ = new QCheckBox("Extrapolate Patches");
|
|
||||||
ExtrapolatePatches_->setChecked
|
|
||||||
(
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
|
|
||||||
);
|
|
||||||
ExtrapolatePatches_->setToolTip
|
|
||||||
(
|
|
||||||
"Extrapolate internalField to non-constraint patches"
|
|
||||||
);
|
|
||||||
|
|
||||||
// row/col 1,1
|
|
||||||
form->addWidget(ExtrapolatePatches_, 6, 1, Qt::AlignLeft);
|
|
||||||
connect
|
|
||||||
(
|
|
||||||
ExtrapolatePatches_,
|
|
||||||
SIGNAL(stateChanged(int)),
|
|
||||||
this,
|
|
||||||
SLOT(ExtrapolatePatchesToggled())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ROW 7
|
|
||||||
// ~~~~~
|
|
||||||
|
|
||||||
QFrame* hline3 = new QFrame(this);
|
|
||||||
hline3->setFrameStyle(QFrame::HLine | QFrame::Sunken);
|
|
||||||
form->addWidget(hline3, 7, 0, 1, 3);
|
|
||||||
|
|
||||||
// update GUI button
|
|
||||||
if ((prop = this->proxy()->GetProperty("UpdateGUI")) != 0)
|
|
||||||
{
|
|
||||||
prop->SetImmediateUpdate(1);
|
|
||||||
QPushButton* updateGUI = new QPushButton("Update GUI");
|
|
||||||
updateGUI->setToolTip("Update GUI");
|
|
||||||
|
|
||||||
form->addWidget(updateGUI, 8, 0, Qt::AlignLeft);
|
|
||||||
QObject::connect
|
|
||||||
(
|
|
||||||
updateGUI,
|
|
||||||
SIGNAL(clicked()),
|
|
||||||
this,
|
|
||||||
SLOT(setModified())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
void pqPVFoamReaderPanel::CacheMeshToggled()
|
|
||||||
{
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast
|
|
||||||
(
|
|
||||||
this->proxy()->GetProperty("UiCacheMesh")
|
|
||||||
)->SetElement(0, CacheMesh_->isChecked());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void pqPVFoamReaderPanel::RefreshPressed()
|
|
||||||
{
|
|
||||||
// update everything
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast
|
|
||||||
(
|
|
||||||
this->proxy()->GetProperty("UiRefresh")
|
|
||||||
)->Modified();
|
|
||||||
|
|
||||||
vtkSMSourceProxy::SafeDownCast(this->proxy())->UpdatePipeline();
|
|
||||||
|
|
||||||
// render all views
|
|
||||||
pqApplicationCore::instance()->render();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void pqPVFoamReaderPanel::ZeroTimeToggled()
|
|
||||||
{
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast
|
|
||||||
(
|
|
||||||
this->proxy()->GetProperty("UiZeroTime")
|
|
||||||
)->SetElement(0, ZeroTime_->isChecked());
|
|
||||||
|
|
||||||
this->setModified();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void pqPVFoamReaderPanel::ShowPatchNamesToggled()
|
|
||||||
{
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast
|
|
||||||
(
|
|
||||||
this->proxy()->GetProperty("UiShowPatchNames")
|
|
||||||
)->SetElement(0, ShowPatchNames_->isChecked());
|
|
||||||
|
|
||||||
// update the active view
|
|
||||||
if (this->view())
|
|
||||||
{
|
|
||||||
this->view()->render();
|
|
||||||
}
|
|
||||||
// OR: update all views
|
|
||||||
// pqApplicationCore::instance()->render();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void pqPVFoamReaderPanel::ShowGroupsOnlyToggled()
|
|
||||||
{
|
|
||||||
vtkSMProperty* prop;
|
|
||||||
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast
|
|
||||||
(
|
|
||||||
this->proxy()->GetProperty("UiShowGroupsOnly")
|
|
||||||
)->SetElement(0, ShowGroupsOnly_->isChecked());
|
|
||||||
|
|
||||||
if ((prop = this->proxy()->GetProperty("PartArrayStatus")) != 0)
|
|
||||||
{
|
|
||||||
this->proxy()->UpdatePropertyInformation(prop);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void pqPVFoamReaderPanel::IncludeSetsToggled()
|
|
||||||
{
|
|
||||||
vtkSMProperty* prop;
|
|
||||||
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast
|
|
||||||
(
|
|
||||||
this->proxy()->GetProperty("UiIncludeSets")
|
|
||||||
)->SetElement(0, IncludeSets_->isChecked());
|
|
||||||
|
|
||||||
if ((prop = this->proxy()->GetProperty("PartArrayStatus")) != 0)
|
|
||||||
{
|
|
||||||
this->proxy()->UpdatePropertyInformation(prop);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void pqPVFoamReaderPanel::IncludeZonesToggled()
|
|
||||||
{
|
|
||||||
vtkSMProperty* prop;
|
|
||||||
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast
|
|
||||||
(
|
|
||||||
this->proxy()->GetProperty("UiIncludeZones")
|
|
||||||
)->SetElement(0, IncludeZones_->isChecked());
|
|
||||||
|
|
||||||
if ((prop = this->proxy()->GetProperty("PartArrayStatus")) != 0)
|
|
||||||
{
|
|
||||||
this->proxy()->UpdatePropertyInformation(prop);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void pqPVFoamReaderPanel::ExtrapolatePatchesToggled()
|
|
||||||
{
|
|
||||||
vtkSMProperty* prop;
|
|
||||||
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast
|
|
||||||
(
|
|
||||||
this->proxy()->GetProperty("UiExtrapolatePatches")
|
|
||||||
)->SetElement(0, ExtrapolatePatches_->isChecked());
|
|
||||||
|
|
||||||
this->setModified();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void pqPVFoamReaderPanel::InterpolateVolFieldsToggled()
|
|
||||||
{
|
|
||||||
vtkSMProperty* prop;
|
|
||||||
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast
|
|
||||||
(
|
|
||||||
this->proxy()->GetProperty("UiInterpolateVolFields")
|
|
||||||
)->SetElement(0, InterpolateVolFields_->isChecked());
|
|
||||||
|
|
||||||
this->setModified();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,116 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
||||||
\\/ 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
|
|
||||||
pqPVFoamReaderPanel
|
|
||||||
|
|
||||||
Description
|
|
||||||
GUI modifications for the ParaView reader panel
|
|
||||||
|
|
||||||
A custom panel for the PVFoamReader.
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
pqPVFoamReaderPanel.cxx
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
#ifndef pqPVFoamReaderPanel_h
|
|
||||||
#define pqPVFoamReaderPanel_h
|
|
||||||
|
|
||||||
|
|
||||||
#include "pqAutoGeneratedObjectPanel.h"
|
|
||||||
|
|
||||||
// Forward declaration of QT classes
|
|
||||||
|
|
||||||
class QCheckBox;
|
|
||||||
class QLineEdit;
|
|
||||||
class QTimer;
|
|
||||||
class QToolButton;
|
|
||||||
|
|
||||||
// Forward declaration of ParaView classes
|
|
||||||
class vtkSMSourceProxy;
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
Class pqPVFoamReaderPanel Declaration
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
class pqPVFoamReaderPanel
|
|
||||||
:
|
|
||||||
public pqAutoGeneratedObjectPanel
|
|
||||||
{
|
|
||||||
// Private data
|
|
||||||
Q_OBJECT;
|
|
||||||
typedef pqAutoGeneratedObjectPanel Superclass;
|
|
||||||
|
|
||||||
//- ZeroTime checkbox
|
|
||||||
QCheckBox* ZeroTime_;
|
|
||||||
|
|
||||||
//- CacheMesh checkbox
|
|
||||||
QCheckBox* CacheMesh_;
|
|
||||||
|
|
||||||
//- Show Patch Names checkbox
|
|
||||||
QCheckBox* ShowPatchNames_;
|
|
||||||
|
|
||||||
//- Show Groups Only checkbox
|
|
||||||
QCheckBox* ShowGroupsOnly_;
|
|
||||||
|
|
||||||
//- IncludeSets checkbox
|
|
||||||
QCheckBox* IncludeSets_;
|
|
||||||
|
|
||||||
//- IncludeZones checkbox
|
|
||||||
QCheckBox* IncludeZones_;
|
|
||||||
|
|
||||||
//- InterpolateVolFields checkbox
|
|
||||||
QCheckBox* InterpolateVolFields_;
|
|
||||||
|
|
||||||
//- ExtrapolatePatches checkbox
|
|
||||||
QCheckBox* ExtrapolatePatches_;
|
|
||||||
|
|
||||||
|
|
||||||
protected slots:
|
|
||||||
|
|
||||||
void CacheMeshToggled();
|
|
||||||
void ZeroTimeToggled();
|
|
||||||
void RefreshPressed();
|
|
||||||
void ShowPatchNamesToggled();
|
|
||||||
void ShowGroupsOnlyToggled();
|
|
||||||
void IncludeSetsToggled();
|
|
||||||
void IncludeZonesToggled();
|
|
||||||
void InterpolateVolFieldsToggled();
|
|
||||||
void ExtrapolatePatchesToggled();
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
//- Construct from components
|
|
||||||
pqPVFoamReaderPanel(pqProxy*, QWidget*);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#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) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -33,6 +33,7 @@ License
|
|||||||
#include "vtkDataArraySelection.h"
|
#include "vtkDataArraySelection.h"
|
||||||
#include "vtkInformation.h"
|
#include "vtkInformation.h"
|
||||||
#include "vtkInformationVector.h"
|
#include "vtkInformationVector.h"
|
||||||
|
#include "vtkInformationDoubleVectorKey.h"
|
||||||
#include "vtkMultiBlockDataSet.h"
|
#include "vtkMultiBlockDataSet.h"
|
||||||
#include "vtkObjectFactory.h"
|
#include "vtkObjectFactory.h"
|
||||||
#include "vtkSMRenderViewProxy.h"
|
#include "vtkSMRenderViewProxy.h"
|
||||||
@ -42,6 +43,9 @@ License
|
|||||||
// OpenFOAM includes
|
// OpenFOAM includes
|
||||||
#include "vtkPVFoam.H"
|
#include "vtkPVFoam.H"
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#undef EXPERIMENTAL_TIME_CACHING
|
#undef EXPERIMENTAL_TIME_CACHING
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
@ -58,10 +62,9 @@ vtkPVFoamReader::vtkPVFoamReader()
|
|||||||
|
|
||||||
SetNumberOfInputPorts(0);
|
SetNumberOfInputPorts(0);
|
||||||
|
|
||||||
FileName = nullptr;
|
FileName = nullptr;
|
||||||
foamData_ = nullptr;
|
backend_ = nullptr;
|
||||||
|
output0_ = nullptr;
|
||||||
output0_ = nullptr;
|
|
||||||
|
|
||||||
#ifdef VTKPVFOAM_DUALPORT
|
#ifdef VTKPVFOAM_DUALPORT
|
||||||
// Add second output for the Lagrangian
|
// Add second output for the Lagrangian
|
||||||
@ -76,19 +79,18 @@ vtkPVFoamReader::vtkPVFoamReader()
|
|||||||
TimeStepRange[0] = 0;
|
TimeStepRange[0] = 0;
|
||||||
TimeStepRange[1] = 0;
|
TimeStepRange[1] = 0;
|
||||||
|
|
||||||
CacheMesh = 1;
|
CacheMesh = true;
|
||||||
Refresh = 0;
|
|
||||||
|
|
||||||
SkipZeroTime = 0;
|
SkipZeroTime = false;
|
||||||
ExtrapolatePatches = 0;
|
ExtrapolatePatches = false;
|
||||||
UseVTKPolyhedron = 0;
|
UseVTKPolyhedron = false;
|
||||||
IncludeSets = 0;
|
IncludeSets = false;
|
||||||
IncludeZones = 0;
|
IncludeZones = false;
|
||||||
ShowPatchNames = 0;
|
ShowPatchNames = false;
|
||||||
ShowGroupsOnly = 0;
|
ShowGroupsOnly = false;
|
||||||
InterpolateVolFields = 1;
|
InterpolateVolFields = true;
|
||||||
|
|
||||||
UpdateGUI = 0;
|
UpdateGUI = false;
|
||||||
|
|
||||||
PartSelection = vtkDataArraySelection::New();
|
PartSelection = vtkDataArraySelection::New();
|
||||||
VolFieldSelection = vtkDataArraySelection::New();
|
VolFieldSelection = vtkDataArraySelection::New();
|
||||||
@ -133,11 +135,13 @@ vtkPVFoamReader::~vtkPVFoamReader()
|
|||||||
{
|
{
|
||||||
vtkDebugMacro(<<"Deconstructor");
|
vtkDebugMacro(<<"Deconstructor");
|
||||||
|
|
||||||
if (foamData_)
|
if (backend_)
|
||||||
{
|
{
|
||||||
// remove patch names
|
// Remove text actors
|
||||||
updatePatchNamesView(false);
|
updatePatchNamesView(false);
|
||||||
delete foamData_;
|
|
||||||
|
delete backend_;
|
||||||
|
backend_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FileName)
|
if (FileName)
|
||||||
@ -151,10 +155,10 @@ vtkPVFoamReader::~vtkPVFoamReader()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PartSelection->RemoveObserver(this->SelectionObserver);
|
PartSelection->RemoveAllObservers();
|
||||||
VolFieldSelection->RemoveObserver(this->SelectionObserver);
|
VolFieldSelection->RemoveAllObservers();
|
||||||
PointFieldSelection->RemoveObserver(this->SelectionObserver);
|
PointFieldSelection->RemoveAllObservers();
|
||||||
LagrangianFieldSelection->RemoveObserver(this->SelectionObserver);
|
LagrangianFieldSelection->RemoveAllObservers();
|
||||||
|
|
||||||
SelectionObserver->Delete();
|
SelectionObserver->Delete();
|
||||||
|
|
||||||
@ -188,7 +192,7 @@ int vtkPVFoamReader::RequestInformation
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nInfo = outputVector->GetNumberOfInformationObjects();
|
const int nInfo = outputVector->GetNumberOfInformationObjects();
|
||||||
|
|
||||||
if (Foam::vtkPVFoam::debug)
|
if (Foam::vtkPVFoam::debug)
|
||||||
{
|
{
|
||||||
@ -199,60 +203,70 @@ int vtkPVFoamReader::RequestInformation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!foamData_)
|
if (backend_)
|
||||||
{
|
{
|
||||||
foamData_ = new Foam::vtkPVFoam(FileName, this);
|
backend_->updateInfo();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foamData_->updateInfo();
|
backend_ = new Foam::vtkPVFoam(FileName, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
int nTimeSteps = 0;
|
std::vector<double> times = backend_->findTimes(this->SkipZeroTime);
|
||||||
double* timeSteps = foamData_->findTimes(nTimeSteps);
|
|
||||||
|
|
||||||
if (!nTimeSteps)
|
if (times.empty())
|
||||||
{
|
{
|
||||||
vtkErrorMacro("could not find valid OpenFOAM mesh");
|
vtkErrorMacro("could not find valid OpenFOAM mesh");
|
||||||
|
|
||||||
// delete foamData and flag it as fatal error
|
// delete foamData and flag it as fatal error
|
||||||
delete foamData_;
|
delete backend_;
|
||||||
foamData_ = nullptr;
|
backend_ = nullptr;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set identical time steps for all ports
|
// set identical time steps for all ports
|
||||||
for (int infoI = 0; infoI < nInfo; ++infoI)
|
for (int infoI = 0; infoI < nInfo; ++infoI)
|
||||||
{
|
{
|
||||||
outputVector->GetInformationObject(infoI)->Set
|
vtkInformation *outInfo = outputVector->GetInformationObject(infoI);
|
||||||
|
|
||||||
|
outInfo->Set
|
||||||
(
|
(
|
||||||
vtkStreamingDemandDrivenPipeline::TIME_STEPS(),
|
vtkStreamingDemandDrivenPipeline::TIME_STEPS(),
|
||||||
timeSteps,
|
times.data(),
|
||||||
nTimeSteps
|
static_cast<int>(times.size())
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Something like this may be useful:
|
||||||
|
// outInfo->Set
|
||||||
|
// (
|
||||||
|
// vtkStreamingDemandDrivenPipeline::TIME_DEPENDENT_INFORMATION(),
|
||||||
|
// 1
|
||||||
|
// );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nTimeSteps)
|
if (times.size())
|
||||||
{
|
{
|
||||||
double timeRange[2];
|
double timeRange[2]{ times.front(), times.back() };
|
||||||
timeRange[0] = timeSteps[0];
|
|
||||||
timeRange[1] = timeSteps[nTimeSteps-1];
|
|
||||||
|
|
||||||
if (Foam::vtkPVFoam::debug > 1)
|
if (Foam::vtkPVFoam::debug > 1)
|
||||||
{
|
{
|
||||||
cout<<"nTimeSteps " << nTimeSteps << "\n"
|
cout
|
||||||
<<"timeRange " << timeRange[0] << " to " << timeRange[1]
|
<<"nInfo " << nInfo << "\n"
|
||||||
<< "\n";
|
<<"time-range " << times.front() << ':' << times.back() << "\n"
|
||||||
|
<<"times " << times.size() << "(";
|
||||||
|
|
||||||
for (int timeI = 0; timeI < nTimeSteps; ++timeI)
|
for (const double& val : times)
|
||||||
{
|
{
|
||||||
cout<< "step[" << timeI << "] = " << timeSteps[timeI] << "\n";
|
cout<< ' ' << val;
|
||||||
}
|
}
|
||||||
|
cout << " )" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int infoI = 0; infoI < nInfo; ++infoI)
|
for (int infoI = 0; infoI < nInfo; ++infoI)
|
||||||
{
|
{
|
||||||
outputVector->GetInformationObject(infoI)->Set
|
vtkInformation *outInfo = outputVector->GetInformationObject(infoI);
|
||||||
|
|
||||||
|
outInfo->Set
|
||||||
(
|
(
|
||||||
vtkStreamingDemandDrivenPipeline::TIME_RANGE(),
|
vtkStreamingDemandDrivenPipeline::TIME_RANGE(),
|
||||||
timeRange,
|
timeRange,
|
||||||
@ -261,8 +275,6 @@ int vtkPVFoamReader::RequestInformation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete timeSteps;
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,15 +294,14 @@ int vtkPVFoamReader::RequestData
|
|||||||
vtkErrorMacro("FileName has to be specified!");
|
vtkErrorMacro("FileName has to be specified!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (!backend_)
|
||||||
// catch previous error
|
|
||||||
if (!foamData_)
|
|
||||||
{
|
{
|
||||||
|
// catch some previous error
|
||||||
vtkErrorMacro("Reader failed - perhaps no mesh?");
|
vtkErrorMacro("Reader failed - perhaps no mesh?");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nInfo = outputVector->GetNumberOfInformationObjects();
|
const int nInfo = outputVector->GetNumberOfInformationObjects();
|
||||||
|
|
||||||
if (Foam::vtkPVFoam::debug)
|
if (Foam::vtkPVFoam::debug)
|
||||||
{
|
{
|
||||||
@ -315,23 +326,31 @@ int vtkPVFoamReader::RequestData
|
|||||||
{
|
{
|
||||||
vtkInformation *outInfo = outputVector->GetInformationObject(infoI);
|
vtkInformation *outInfo = outputVector->GetInformationObject(infoI);
|
||||||
|
|
||||||
|
int nsteps = outInfo->Length(vtkStreamingDemandDrivenPipeline::TIME_STEPS());
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP())
|
outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP())
|
||||||
&& outInfo->Length(vtkStreamingDemandDrivenPipeline::TIME_STEPS()) > 0
|
&& nsteps > 0
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
requestTime[nRequestTime++] =
|
requestTime[nRequestTime] =
|
||||||
outInfo->Get
|
(
|
||||||
(
|
1 == nsteps
|
||||||
vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP()
|
// Only one time-step available, UPDATE_TIME_STEP is unreliable
|
||||||
);
|
? outInfo->Get(vtkStreamingDemandDrivenPipeline::TIME_STEPS(), 0)
|
||||||
|
: outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP())
|
||||||
|
);
|
||||||
|
|
||||||
|
// outInfo->Set(vtkDataObject::DATA_TIME_STEP(), requestTime[nRequestTime]);
|
||||||
|
// this->SetTimeValue(requestedTimeValue);
|
||||||
|
++nRequestTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nRequestTime)
|
if (nRequestTime)
|
||||||
{
|
{
|
||||||
foamData_->setTime(nRequestTime, requestTime);
|
backend_->setTime(nRequestTime, requestTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkMultiBlockDataSet* output = vtkMultiBlockDataSet::SafeDownCast
|
vtkMultiBlockDataSet* output = vtkMultiBlockDataSet::SafeDownCast
|
||||||
@ -362,7 +381,7 @@ int vtkPVFoamReader::RequestData
|
|||||||
// but trashes the fields and still triggers the GeometryFilter
|
// but trashes the fields and still triggers the GeometryFilter
|
||||||
if (needsUpdate)
|
if (needsUpdate)
|
||||||
{
|
{
|
||||||
foamData_->Update(output);
|
backend_->Update(output);
|
||||||
output0_->ShallowCopy(output);
|
output0_->ShallowCopy(output);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -391,7 +410,7 @@ int vtkPVFoamReader::RequestData
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
#ifdef VTKPVFOAM_DUALPORT
|
#ifdef VTKPVFOAM_DUALPORT
|
||||||
foamData_->Update
|
backend_->Update
|
||||||
(
|
(
|
||||||
output,
|
output,
|
||||||
vtkMultiBlockDataSet::SafeDownCast
|
vtkMultiBlockDataSet::SafeDownCast
|
||||||
@ -403,7 +422,7 @@ int vtkPVFoamReader::RequestData
|
|||||||
);
|
);
|
||||||
);
|
);
|
||||||
#else
|
#else
|
||||||
foamData_->Update(output, output);
|
backend_->Update(output, output);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
updatePatchNamesView(ShowPatchNames);
|
updatePatchNamesView(ShowPatchNames);
|
||||||
@ -411,45 +430,60 @@ int vtkPVFoamReader::RequestData
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Do any cleanup on the OpenFOAM side
|
// Do any cleanup on the OpenFOAM side
|
||||||
foamData_->CleanUp();
|
backend_->CleanUp();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void vtkPVFoamReader::SetRefresh(int val)
|
void vtkPVFoamReader::PrintInfo()
|
||||||
|
{
|
||||||
|
if (backend_)
|
||||||
|
{
|
||||||
|
backend_->printInfo();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cout
|
||||||
|
<<"OpenFOAM reader not initialized\n"
|
||||||
|
<< std::flush;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void vtkPVFoamReader::Refresh()
|
||||||
{
|
{
|
||||||
Modified();
|
Modified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void vtkPVFoamReader::SetIncludeSets(int val)
|
void vtkPVFoamReader::SetIncludeSets(bool val)
|
||||||
{
|
{
|
||||||
if (IncludeSets != val)
|
if (IncludeSets != val)
|
||||||
{
|
{
|
||||||
IncludeSets = val;
|
IncludeSets = val;
|
||||||
if (foamData_)
|
if (backend_)
|
||||||
{
|
{
|
||||||
foamData_->updateInfo();
|
backend_->updateInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void vtkPVFoamReader::SetIncludeZones(int val)
|
void vtkPVFoamReader::SetIncludeZones(bool val)
|
||||||
{
|
{
|
||||||
if (IncludeZones != val)
|
if (IncludeZones != val)
|
||||||
{
|
{
|
||||||
IncludeZones = val;
|
IncludeZones = val;
|
||||||
if (foamData_)
|
if (backend_)
|
||||||
{
|
{
|
||||||
foamData_->updateInfo();
|
backend_->updateInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void vtkPVFoamReader::SetShowPatchNames(int val)
|
void vtkPVFoamReader::SetShowPatchNames(bool val)
|
||||||
{
|
{
|
||||||
if (ShowPatchNames != val)
|
if (ShowPatchNames != val)
|
||||||
{
|
{
|
||||||
@ -459,14 +493,14 @@ void vtkPVFoamReader::SetShowPatchNames(int val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void vtkPVFoamReader::SetShowGroupsOnly(int val)
|
void vtkPVFoamReader::SetShowGroupsOnly(bool val)
|
||||||
{
|
{
|
||||||
if (ShowGroupsOnly != val)
|
if (ShowGroupsOnly != val)
|
||||||
{
|
{
|
||||||
ShowGroupsOnly = val;
|
ShowGroupsOnly = val;
|
||||||
if (foamData_)
|
if (backend_)
|
||||||
{
|
{
|
||||||
foamData_->updateInfo();
|
backend_->updateInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -485,7 +519,7 @@ void vtkPVFoamReader::updatePatchNamesView(const bool show)
|
|||||||
// Server manager model for querying items in the server manager
|
// Server manager model for querying items in the server manager
|
||||||
pqServerManagerModel* smModel = appCore->getServerManagerModel();
|
pqServerManagerModel* smModel = appCore->getServerManagerModel();
|
||||||
|
|
||||||
if (!smModel || !foamData_)
|
if (!smModel || !backend_)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -495,14 +529,14 @@ void vtkPVFoamReader::updatePatchNamesView(const bool show)
|
|||||||
|
|
||||||
for (int viewI=0; viewI < renderViews.size(); ++viewI)
|
for (int viewI=0; viewI < renderViews.size(); ++viewI)
|
||||||
{
|
{
|
||||||
foamData_->renderPatchNames
|
backend_->renderPatchNames
|
||||||
(
|
(
|
||||||
renderViews[viewI]->getRenderViewProxy()->GetRenderer(),
|
renderViews[viewI]->getRenderViewProxy()->GetRenderer(),
|
||||||
show
|
show
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// use refresh here?
|
// Use refresh here?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -514,7 +548,7 @@ void vtkPVFoamReader::PrintSelf(ostream& os, vtkIndent indent)
|
|||||||
os << indent << "File name: "
|
os << indent << "File name: "
|
||||||
<< (this->FileName ? this->FileName : "(none)") << "\n";
|
<< (this->FileName ? this->FileName : "(none)") << "\n";
|
||||||
|
|
||||||
foamData_->PrintSelf(os, indent);
|
backend_->PrintSelf(os, indent);
|
||||||
|
|
||||||
os << indent << "Time step range: "
|
os << indent << "Time step range: "
|
||||||
<< this->TimeStepRange[0] << " - " << this->TimeStepRange[1] << "\n"
|
<< this->TimeStepRange[0] << " - " << this->TimeStepRange[1] << "\n"
|
||||||
@ -524,7 +558,7 @@ void vtkPVFoamReader::PrintSelf(ostream& os, vtkIndent indent)
|
|||||||
|
|
||||||
int vtkPVFoamReader::GetTimeStep()
|
int vtkPVFoamReader::GetTimeStep()
|
||||||
{
|
{
|
||||||
return foamData_ ? foamData_->timeIndex() : -1;
|
return backend_ ? backend_->timeIndex() : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -533,32 +567,24 @@ int vtkPVFoamReader::GetTimeStep()
|
|||||||
|
|
||||||
vtkDataArraySelection* vtkPVFoamReader::GetPartSelection()
|
vtkDataArraySelection* vtkPVFoamReader::GetPartSelection()
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetPartSelection");
|
|
||||||
return PartSelection;
|
return PartSelection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int vtkPVFoamReader::GetNumberOfPartArrays()
|
int vtkPVFoamReader::GetNumberOfPartArrays()
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetNumberOfPartArrays");
|
|
||||||
return PartSelection->GetNumberOfArrays();
|
return PartSelection->GetNumberOfArrays();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char* vtkPVFoamReader::GetPartArrayName(int index)
|
const char* vtkPVFoamReader::GetPartArrayName(int index)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetPartArrayName");
|
|
||||||
return PartSelection->GetArrayName(index);
|
return PartSelection->GetArrayName(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int vtkPVFoamReader::GetPartArrayStatus(const char* name)
|
int vtkPVFoamReader::GetPartArrayStatus(const char* name)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetPartArrayStatus");
|
|
||||||
return PartSelection->ArrayIsEnabled(name);
|
return PartSelection->ArrayIsEnabled(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void vtkPVFoamReader::SetPartArrayStatus(const char* name, int status)
|
void vtkPVFoamReader::SetPartArrayStatus(const char* name, int status)
|
||||||
{
|
{
|
||||||
vtkDebugMacro("Set mesh part \"" << name << "\" status to: " << status);
|
vtkDebugMacro("Set mesh part \"" << name << "\" status to: " << status);
|
||||||
@ -579,35 +605,26 @@ void vtkPVFoamReader::SetPartArrayStatus(const char* name, int status)
|
|||||||
|
|
||||||
vtkDataArraySelection* vtkPVFoamReader::GetVolFieldSelection()
|
vtkDataArraySelection* vtkPVFoamReader::GetVolFieldSelection()
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetVolFieldSelection");
|
|
||||||
return VolFieldSelection;
|
return VolFieldSelection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int vtkPVFoamReader::GetNumberOfVolFieldArrays()
|
int vtkPVFoamReader::GetNumberOfVolFieldArrays()
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetNumberOfVolFieldArrays");
|
|
||||||
return VolFieldSelection->GetNumberOfArrays();
|
return VolFieldSelection->GetNumberOfArrays();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char* vtkPVFoamReader::GetVolFieldArrayName(int index)
|
const char* vtkPVFoamReader::GetVolFieldArrayName(int index)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetVolFieldArrayName");
|
|
||||||
return VolFieldSelection->GetArrayName(index);
|
return VolFieldSelection->GetArrayName(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int vtkPVFoamReader::GetVolFieldArrayStatus(const char* name)
|
int vtkPVFoamReader::GetVolFieldArrayStatus(const char* name)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetVolFieldArrayStatus");
|
|
||||||
return VolFieldSelection->ArrayIsEnabled(name);
|
return VolFieldSelection->ArrayIsEnabled(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void vtkPVFoamReader::SetVolFieldArrayStatus(const char* name, int status)
|
void vtkPVFoamReader::SetVolFieldArrayStatus(const char* name, int status)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"SetVolFieldArrayStatus");
|
|
||||||
if (status)
|
if (status)
|
||||||
{
|
{
|
||||||
VolFieldSelection->EnableArray(name);
|
VolFieldSelection->EnableArray(name);
|
||||||
@ -624,35 +641,26 @@ void vtkPVFoamReader::SetVolFieldArrayStatus(const char* name, int status)
|
|||||||
|
|
||||||
vtkDataArraySelection* vtkPVFoamReader::GetPointFieldSelection()
|
vtkDataArraySelection* vtkPVFoamReader::GetPointFieldSelection()
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetPointFieldSelection");
|
|
||||||
return PointFieldSelection;
|
return PointFieldSelection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int vtkPVFoamReader::GetNumberOfPointFieldArrays()
|
int vtkPVFoamReader::GetNumberOfPointFieldArrays()
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetNumberOfPointFieldArrays");
|
|
||||||
return PointFieldSelection->GetNumberOfArrays();
|
return PointFieldSelection->GetNumberOfArrays();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char* vtkPVFoamReader::GetPointFieldArrayName(int index)
|
const char* vtkPVFoamReader::GetPointFieldArrayName(int index)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetPointFieldArrayName");
|
|
||||||
return PointFieldSelection->GetArrayName(index);
|
return PointFieldSelection->GetArrayName(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int vtkPVFoamReader::GetPointFieldArrayStatus(const char* name)
|
int vtkPVFoamReader::GetPointFieldArrayStatus(const char* name)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetPointFieldArrayStatus");
|
|
||||||
return PointFieldSelection->ArrayIsEnabled(name);
|
return PointFieldSelection->ArrayIsEnabled(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void vtkPVFoamReader::SetPointFieldArrayStatus(const char* name, int status)
|
void vtkPVFoamReader::SetPointFieldArrayStatus(const char* name, int status)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"SetPointFieldArrayStatus");
|
|
||||||
if (status)
|
if (status)
|
||||||
{
|
{
|
||||||
PointFieldSelection->EnableArray(name);
|
PointFieldSelection->EnableArray(name);
|
||||||
@ -669,39 +677,30 @@ void vtkPVFoamReader::SetPointFieldArrayStatus(const char* name, int status)
|
|||||||
|
|
||||||
vtkDataArraySelection* vtkPVFoamReader::GetLagrangianFieldSelection()
|
vtkDataArraySelection* vtkPVFoamReader::GetLagrangianFieldSelection()
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetLagrangianFieldSelection");
|
|
||||||
return LagrangianFieldSelection;
|
return LagrangianFieldSelection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int vtkPVFoamReader::GetNumberOfLagrangianFieldArrays()
|
int vtkPVFoamReader::GetNumberOfLagrangianFieldArrays()
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetNumberOfLagrangianFieldArrays");
|
|
||||||
return LagrangianFieldSelection->GetNumberOfArrays();
|
return LagrangianFieldSelection->GetNumberOfArrays();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char* vtkPVFoamReader::GetLagrangianFieldArrayName(int index)
|
const char* vtkPVFoamReader::GetLagrangianFieldArrayName(int index)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetLagrangianFieldArrayName");
|
|
||||||
return LagrangianFieldSelection->GetArrayName(index);
|
return LagrangianFieldSelection->GetArrayName(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int vtkPVFoamReader::GetLagrangianFieldArrayStatus(const char* name)
|
int vtkPVFoamReader::GetLagrangianFieldArrayStatus(const char* name)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetLagrangianFieldArrayStatus");
|
|
||||||
return LagrangianFieldSelection->ArrayIsEnabled(name);
|
return LagrangianFieldSelection->ArrayIsEnabled(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void vtkPVFoamReader::SetLagrangianFieldArrayStatus
|
void vtkPVFoamReader::SetLagrangianFieldArrayStatus
|
||||||
(
|
(
|
||||||
const char* name,
|
const char* name,
|
||||||
int status
|
int status
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"SetLagrangianFieldArrayStatus");
|
|
||||||
if (status)
|
if (status)
|
||||||
{
|
{
|
||||||
LagrangianFieldSelection->EnableArray(name);
|
LagrangianFieldSelection->EnableArray(name);
|
||||||
|
|||||||
@ -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) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -77,59 +77,63 @@ public:
|
|||||||
vtkSetStringMacro(FileName);
|
vtkSetStringMacro(FileName);
|
||||||
vtkGetStringMacro(FileName);
|
vtkGetStringMacro(FileName);
|
||||||
|
|
||||||
|
// Description:
|
||||||
|
// Print some case information
|
||||||
|
virtual void PrintInfo();
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// OpenFOAM mesh caching control
|
// OpenFOAM mesh caching control
|
||||||
vtkSetMacro(CacheMesh, int);
|
vtkSetMacro(CacheMesh, bool);
|
||||||
vtkGetMacro(CacheMesh, int);
|
vtkGetMacro(CacheMesh, bool);
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// OpenFOAM refresh times/fields
|
// OpenFOAM refresh times/fields
|
||||||
virtual void SetRefresh(int);
|
virtual void Refresh();
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// OpenFOAM skip/include the 0/ time directory
|
// OpenFOAM skip/include the 0/ time directory
|
||||||
vtkSetMacro(SkipZeroTime, int);
|
vtkSetMacro(SkipZeroTime, bool);
|
||||||
vtkGetMacro(SkipZeroTime, int);
|
vtkGetMacro(SkipZeroTime, bool);
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// GUI update control
|
// GUI update control
|
||||||
vtkSetMacro(UpdateGUI, int);
|
vtkSetMacro(UpdateGUI, bool);
|
||||||
vtkGetMacro(UpdateGUI, int);
|
vtkGetMacro(UpdateGUI, bool);
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// OpenFOAM extrapolate internal values onto the patches
|
// OpenFOAM extrapolate internal values onto the patches
|
||||||
vtkSetMacro(ExtrapolatePatches, int);
|
vtkSetMacro(ExtrapolatePatches, bool);
|
||||||
vtkGetMacro(ExtrapolatePatches, int);
|
vtkGetMacro(ExtrapolatePatches, bool);
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// OpenFOAM use vtkPolyhedron instead of decomposing polyhedra
|
// OpenFOAM use vtkPolyhedron instead of decomposing polyhedra
|
||||||
vtkSetMacro(UseVTKPolyhedron, int);
|
vtkSetMacro(UseVTKPolyhedron, bool);
|
||||||
vtkGetMacro(UseVTKPolyhedron, int);
|
vtkGetMacro(UseVTKPolyhedron, bool);
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// OpenFOAM read sets control
|
// OpenFOAM read sets control
|
||||||
virtual void SetIncludeSets(int);
|
virtual void SetIncludeSets(bool);
|
||||||
vtkGetMacro(IncludeSets, int);
|
vtkGetMacro(IncludeSets, bool);
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// OpenFOAM read zones control
|
// OpenFOAM read zones control
|
||||||
virtual void SetIncludeZones(int);
|
virtual void SetIncludeZones(bool);
|
||||||
vtkGetMacro(IncludeZones, int);
|
vtkGetMacro(IncludeZones, bool);
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// OpenFOAM display patch names control
|
// OpenFOAM display patch names control
|
||||||
virtual void SetShowPatchNames(int);
|
virtual void SetShowPatchNames(bool);
|
||||||
vtkGetMacro(ShowPatchNames, int);
|
vtkGetMacro(ShowPatchNames, bool);
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// OpenFOAM display patchGroups
|
// OpenFOAM display patchGroups
|
||||||
virtual void SetShowGroupsOnly(int);
|
virtual void SetShowGroupsOnly(bool);
|
||||||
vtkGetMacro(ShowGroupsOnly, int);
|
vtkGetMacro(ShowGroupsOnly, bool);
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// OpenFOAM volField interpolation
|
// OpenFOAM volField interpolation
|
||||||
vtkSetMacro(InterpolateVolFields, int);
|
vtkSetMacro(InterpolateVolFields, bool);
|
||||||
vtkGetMacro(InterpolateVolFields, int);
|
vtkGetMacro(InterpolateVolFields, bool);
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// Get the current timestep
|
// Get the current timestep
|
||||||
@ -218,29 +222,28 @@ protected:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
vtkPVFoamReader(const vtkPVFoamReader&);
|
vtkPVFoamReader(const vtkPVFoamReader&) = delete;
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const vtkPVFoamReader&);
|
void operator=(const vtkPVFoamReader&) = delete;
|
||||||
|
|
||||||
//- Add/remove patch names to/from the view
|
//- Add/remove patch names to/from the view
|
||||||
void updatePatchNamesView(const bool show);
|
void updatePatchNamesView(const bool show);
|
||||||
|
|
||||||
int TimeStepRange[2];
|
int TimeStepRange[2];
|
||||||
int Refresh;
|
bool CacheMesh;
|
||||||
int CacheMesh;
|
bool SkipZeroTime;
|
||||||
int SkipZeroTime;
|
|
||||||
|
|
||||||
int ExtrapolatePatches;
|
bool ExtrapolatePatches;
|
||||||
int UseVTKPolyhedron;
|
bool UseVTKPolyhedron;
|
||||||
int IncludeSets;
|
bool IncludeSets;
|
||||||
int IncludeZones;
|
bool IncludeZones;
|
||||||
int ShowPatchNames;
|
bool ShowPatchNames;
|
||||||
int ShowGroupsOnly;
|
bool ShowGroupsOnly;
|
||||||
int InterpolateVolFields;
|
bool InterpolateVolFields;
|
||||||
|
|
||||||
//- Dummy variable/switch to invoke a reader update
|
//- Dummy variable/switch to invoke a reader update
|
||||||
int UpdateGUI;
|
bool UpdateGUI;
|
||||||
|
|
||||||
vtkDataArraySelection* PartSelection;
|
vtkDataArraySelection* PartSelection;
|
||||||
vtkDataArraySelection* VolFieldSelection;
|
vtkDataArraySelection* VolFieldSelection;
|
||||||
@ -250,9 +253,8 @@ private:
|
|||||||
//- Cached data for output port0 (experimental!)
|
//- Cached data for output port0 (experimental!)
|
||||||
vtkMultiBlockDataSet* output0_;
|
vtkMultiBlockDataSet* output0_;
|
||||||
|
|
||||||
//BTX
|
//- Backend portion of the reader
|
||||||
Foam::vtkPVFoam* foamData_;
|
Foam::vtkPVFoam* backend_;
|
||||||
//ETX
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -2,10 +2,7 @@ vtkPVFoam.C
|
|||||||
vtkPVFoamFields.C
|
vtkPVFoamFields.C
|
||||||
vtkPVFoamMesh.C
|
vtkPVFoamMesh.C
|
||||||
vtkPVFoamMeshLagrangian.C
|
vtkPVFoamMeshLagrangian.C
|
||||||
vtkPVFoamMeshSet.C
|
|
||||||
vtkPVFoamMeshVolume.C
|
vtkPVFoamMeshVolume.C
|
||||||
vtkPVFoamMeshZone.C
|
|
||||||
vtkPVFoamUpdateInfo.C
|
vtkPVFoamUpdateInfo.C
|
||||||
vtkPVFoamUtils.C
|
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libvtkPVFoam
|
LIB = $(FOAM_LIBBIN)/libvtkPVFoam-pv${ParaView_MAJOR}
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
sinclude $(GENERAL_RULES)/paraview
|
||||||
|
|
||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
${c++LESSWARN} \
|
${c++LESSWARN} \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
@ -8,7 +10,7 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/conversion/lnInclude \
|
-I$(LIB_SRC)/conversion/lnInclude \
|
||||||
-I$(ParaView_INCLUDE_DIR) \
|
-I$(ParaView_INCLUDE_DIR) \
|
||||||
-I$(ParaView_INCLUDE_DIR)/vtkkwiml \
|
-I$(ParaView_INCLUDE_DIR)/vtkkwiml \
|
||||||
-I../../vtkPVReaders/lnInclude \
|
-I../../foamPv/lnInclude \
|
||||||
-I../PVFoamReader
|
-I../PVFoamReader
|
||||||
|
|
||||||
LIB_LIBS = \
|
LIB_LIBS = \
|
||||||
@ -16,5 +18,5 @@ LIB_LIBS = \
|
|||||||
-lconversion \
|
-lconversion \
|
||||||
-lgenericPatchFields \
|
-lgenericPatchFields \
|
||||||
-llagrangian \
|
-llagrangian \
|
||||||
-L$(FOAM_LIBBIN) -lvtkPVReaders \
|
-L$(FOAM_LIBBIN) -lfoamPv-pv${ParaView_MAJOR} \
|
||||||
$(GLIBS)
|
$(GLIBS)
|
||||||
|
|||||||
@ -1,79 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
||||||
\\/ 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/>.
|
|
||||||
|
|
||||||
InClass
|
|
||||||
vtkPVFoam
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef vtkOpenFOAMPoints_H
|
|
||||||
#define vtkOpenFOAMPoints_H
|
|
||||||
|
|
||||||
// VTK includes
|
|
||||||
#include "vtkPoints.h"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
inline void vtkInsertNextOpenFOAMPoint
|
|
||||||
(
|
|
||||||
vtkPoints *points,
|
|
||||||
const Foam::point& p
|
|
||||||
)
|
|
||||||
{
|
|
||||||
points->InsertNextPoint(p.x(), p.y(), p.z());
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
// this should be faster, but didn't get it working ...
|
|
||||||
inline void vtkSetOpenFOAMPoint
|
|
||||||
(
|
|
||||||
vtkPoints *points,
|
|
||||||
const Foam::label id,
|
|
||||||
const Foam::point& p
|
|
||||||
)
|
|
||||||
{
|
|
||||||
points->SetPoint(id, p.x(), p.y(), p.z());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Convert OpenFOAM mesh vertices to VTK
|
|
||||||
inline vtkPoints* vtkSetOpenFOAMPoints(const Foam::pointField& points)
|
|
||||||
{
|
|
||||||
vtkPoints *vtkpoints = vtkPoints::New();
|
|
||||||
vtkpoints->SetNumberOfPoints(points.size());
|
|
||||||
forAll(points, i)
|
|
||||||
{
|
|
||||||
const Foam::point& p = points[i];
|
|
||||||
vtkpoints->SetPoint(i, p.x(), p.y(), p.z());
|
|
||||||
}
|
|
||||||
|
|
||||||
return vtkpoints;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#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) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -42,15 +42,40 @@ License
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(vtkPVFoam, 0);
|
defineTypeNameAndDebug(vtkPVFoam, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
vtkTextActor* Foam::vtkPVFoam::createTextActor
|
||||||
|
(
|
||||||
|
const string& s,
|
||||||
|
const point& pt
|
||||||
|
)
|
||||||
|
{
|
||||||
|
vtkTextActor* txt = vtkTextActor::New();
|
||||||
|
txt->SetInput(s.c_str());
|
||||||
|
|
||||||
|
// Set text properties
|
||||||
|
vtkTextProperty* tprop = txt->GetTextProperty();
|
||||||
|
tprop->SetFontFamilyToArial();
|
||||||
|
tprop->BoldOn();
|
||||||
|
tprop->ShadowOff();
|
||||||
|
tprop->SetLineSpacing(1.0);
|
||||||
|
tprop->SetFontSize(14);
|
||||||
|
tprop->SetColor(1.0, 0.0, 1.0);
|
||||||
|
tprop->SetJustificationToCentered();
|
||||||
|
|
||||||
|
txt->GetPositionCoordinate()->SetCoordinateSystemToWorld();
|
||||||
|
txt->GetPositionCoordinate()->SetValue(pt.x(), pt.y(), pt.z());
|
||||||
|
|
||||||
|
return txt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
#include "vtkPVFoamAddToSelection.H"
|
|
||||||
#include "vtkPVFoamUpdateInfoFields.H"
|
|
||||||
|
|
||||||
void Foam::vtkPVFoam::resetCounters()
|
void Foam::vtkPVFoam::resetCounters()
|
||||||
{
|
{
|
||||||
// Reset array range information (ids and sizes)
|
// Reset array range information (ids and sizes)
|
||||||
@ -116,14 +141,10 @@ int Foam::vtkPVFoam::setTime(int nRequest, const double requestTimes[])
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVFoam::setTime(";
|
Info<< "<beg> setTime(";
|
||||||
for (int requestI = 0; requestI < nRequest; ++requestI)
|
for (int requestI = 0; requestI < nRequest; ++requestI)
|
||||||
{
|
{
|
||||||
if (requestI)
|
if (requestI) Info<< ", ";
|
||||||
{
|
|
||||||
Info<< ", ";
|
|
||||||
}
|
|
||||||
|
|
||||||
Info<< requestTimes[requestI];
|
Info<< requestTimes[requestI];
|
||||||
}
|
}
|
||||||
Info<< ") - previousIndex = " << timeIndex_
|
Info<< ") - previousIndex = " << timeIndex_
|
||||||
@ -160,7 +181,7 @@ int Foam::vtkPVFoam::setTime(int nRequest, const double requestTimes[])
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPVFoam::setTime() - selectedTime="
|
Info<< "<end> setTime() - selectedTime="
|
||||||
<< Times[nearestIndex].name() << " index=" << timeIndex_
|
<< Times[nearestIndex].name() << " index=" << timeIndex_
|
||||||
<< "/" << Times.size()
|
<< "/" << Times.size()
|
||||||
<< " meshChanged=" << Switch(meshChanged_)
|
<< " meshChanged=" << Switch(meshChanged_)
|
||||||
@ -175,7 +196,7 @@ void Foam::vtkPVFoam::updateMeshPartsStatus()
|
|||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVFoam::updateMeshPartsStatus" << endl;
|
Info<< "<beg> updateMeshPartsStatus" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkDataArraySelection* selection = reader_->GetPartSelection();
|
vtkDataArraySelection* selection = reader_->GetPartSelection();
|
||||||
@ -203,7 +224,7 @@ void Foam::vtkPVFoam::updateMeshPartsStatus()
|
|||||||
meshChanged_ = true;
|
meshChanged_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
if (debug > 1)
|
||||||
{
|
{
|
||||||
Info<< " part[" << partId << "] = "
|
Info<< " part[" << partId << "] = "
|
||||||
<< partStatus_[partId]
|
<< partStatus_[partId]
|
||||||
@ -212,11 +233,17 @@ void Foam::vtkPVFoam::updateMeshPartsStatus()
|
|||||||
}
|
}
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPVFoam::updateMeshPartsStatus" << endl;
|
Info<< "<end> updateMeshPartsStatus" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::word Foam::vtkPVFoam::getPartName(const int partId)
|
||||||
|
{
|
||||||
|
return getFirstWord(reader_->GetPartArrayName(partId));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::vtkPVFoam::vtkPVFoam
|
Foam::vtkPVFoam::vtkPVFoam
|
||||||
@ -245,7 +272,7 @@ Foam::vtkPVFoam::vtkPVFoam
|
|||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "Foam::vtkPVFoam::vtkPVFoam - " << FileName << endl;
|
Info<< "vtkPVFoam - " << FileName << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,7 +360,7 @@ Foam::vtkPVFoam::~vtkPVFoam()
|
|||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPVFoam::~vtkPVFoam" << endl;
|
Info<< "~vtkPVFoam" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete meshPtr_;
|
delete meshPtr_;
|
||||||
@ -346,7 +373,7 @@ void Foam::vtkPVFoam::updateInfo()
|
|||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVFoam::updateInfo"
|
Info<< "<beg> updateInfo"
|
||||||
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "] timeIndex="
|
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "] timeIndex="
|
||||||
<< timeIndex_ << endl;
|
<< timeIndex_ << endl;
|
||||||
}
|
}
|
||||||
@ -363,16 +390,15 @@ void Foam::vtkPVFoam::updateInfo()
|
|||||||
// time of the vtkDataArraySelection, but the qt/paraview proxy
|
// time of the vtkDataArraySelection, but the qt/paraview proxy
|
||||||
// layer doesn't care about that anyhow.
|
// layer doesn't care about that anyhow.
|
||||||
|
|
||||||
// enable 'internalMesh' on the first call
|
|
||||||
// or preserve the enabled selections
|
|
||||||
stringList enabledEntries;
|
stringList enabledEntries;
|
||||||
if (!partSelection->GetNumberOfArrays() && !meshPtr_)
|
if (!partSelection->GetNumberOfArrays() && !meshPtr_)
|
||||||
{
|
{
|
||||||
enabledEntries.setSize(1);
|
// enable 'internalMesh' on the first call
|
||||||
enabledEntries[0] = "internalMesh";
|
enabledEntries = { "internalMesh" };
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// preserve the enabled selections
|
||||||
enabledEntries = getSelectedArrayEntries(partSelection);
|
enabledEntries = getSelectedArrayEntries(partSelection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -395,23 +421,12 @@ void Foam::vtkPVFoam::updateInfo()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update volume, point and lagrangian fields
|
// Update volume, point and lagrangian fields
|
||||||
updateInfoFields<fvPatchField, volMesh>
|
updateInfoFields();
|
||||||
(
|
|
||||||
reader_->GetVolFieldSelection()
|
|
||||||
);
|
|
||||||
updateInfoFields<pointPatchField, pointMesh>
|
|
||||||
(
|
|
||||||
reader_->GetPointFieldSelection()
|
|
||||||
);
|
|
||||||
updateInfoLagrangianFields();
|
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
// just for debug info
|
Info<< "<end> updateInfo" << endl;
|
||||||
getSelectedArrayEntries(partSelection);
|
|
||||||
Info<< "<end> Foam::vtkPVFoam::updateInfo" << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -419,7 +434,7 @@ void Foam::vtkPVFoam::updateFoamMesh()
|
|||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVFoam::updateFoamMesh" << endl;
|
Info<< "<beg> updateFoamMesh" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -463,7 +478,7 @@ void Foam::vtkPVFoam::updateFoamMesh()
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPVFoam::updateFoamMesh" << endl;
|
Info<< "<end> updateFoamMesh" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -532,7 +547,7 @@ void Foam::vtkPVFoam::Update
|
|||||||
convertLagrangianFields(lagrangianOutput);
|
convertLagrangianFields(lagrangianOutput);
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "done reader part" << endl;
|
Info<< "done reader part" << nl << endl;
|
||||||
}
|
}
|
||||||
reader_->UpdateProgress(0.95);
|
reader_->UpdateProgress(0.95);
|
||||||
|
|
||||||
@ -548,68 +563,58 @@ void Foam::vtkPVFoam::CleanUp()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double* Foam::vtkPVFoam::findTimes(int& nTimeSteps)
|
std::vector<double> Foam::vtkPVFoam::findTimes(const bool skipZero) const
|
||||||
{
|
{
|
||||||
int nTimes = 0;
|
std::vector<double> times;
|
||||||
double* tsteps = nullptr;
|
|
||||||
|
|
||||||
if (dbPtr_.valid())
|
if (dbPtr_.valid())
|
||||||
{
|
{
|
||||||
Time& runTime = dbPtr_();
|
const Time& runTime = dbPtr_();
|
||||||
instantList timeLst = runTime.times();
|
instantList timeLst = runTime.times();
|
||||||
|
|
||||||
// find the first time for which this mesh appears to exist
|
// find the first time for which this mesh appears to exist
|
||||||
label timeI = 0;
|
label begIndex = timeLst.size();
|
||||||
for (; timeI < timeLst.size(); ++timeI)
|
forAll(timeLst, timeI)
|
||||||
{
|
{
|
||||||
const word& timeName = timeLst[timeI].name();
|
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
isFile(runTime.path()/timeName/meshDir_/"points")
|
IOobject
|
||||||
&& IOobject
|
|
||||||
(
|
(
|
||||||
"points",
|
"points",
|
||||||
timeName,
|
timeLst[timeI].name(),
|
||||||
meshDir_,
|
meshDir_,
|
||||||
runTime
|
runTime
|
||||||
).typeHeaderOk<pointIOField>(true)
|
).typeHeaderOk<pointIOField>(false, false)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
begIndex = timeI;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nTimes = timeLst.size() - timeI;
|
label nTimes = timeLst.size() - begIndex;
|
||||||
|
|
||||||
// skip "constant" time whenever possible
|
// skip "constant" time whenever possible
|
||||||
if (timeI == 0 && nTimes > 1)
|
if (begIndex == 0 && nTimes > 1)
|
||||||
{
|
{
|
||||||
if (timeLst[timeI].name() == runTime.constant())
|
if (timeLst[begIndex].name() == runTime.constant())
|
||||||
{
|
{
|
||||||
++timeI;
|
++begIndex;
|
||||||
--nTimes;
|
--nTimes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// skip "0/" time if requested and possible
|
// skip "0/" time if requested and possible
|
||||||
if (nTimes > 1 && reader_->GetSkipZeroTime())
|
if (skipZero && nTimes > 1 && timeLst[begIndex].name() == "0")
|
||||||
{
|
{
|
||||||
if (mag(timeLst[timeI].value()) < SMALL)
|
++begIndex;
|
||||||
{
|
--nTimes;
|
||||||
++timeI;
|
|
||||||
--nTimes;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nTimes)
|
times.reserve(nTimes);
|
||||||
|
while (nTimes-- > 0)
|
||||||
{
|
{
|
||||||
tsteps = new double[nTimes];
|
times.push_back(timeLst[begIndex++].value());
|
||||||
for (label stepI = 0; stepI < nTimes; ++stepI, ++timeI)
|
|
||||||
{
|
|
||||||
tsteps[stepI] = timeLst[timeI].value();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -620,10 +625,7 @@ double* Foam::vtkPVFoam::findTimes(int& nTimeSteps)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// vector length returned via the parameter
|
return times;
|
||||||
nTimeSteps = nTimes;
|
|
||||||
|
|
||||||
return tsteps;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -633,11 +635,6 @@ void Foam::vtkPVFoam::renderPatchNames
|
|||||||
const bool show
|
const bool show
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (!meshPtr_)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// always remove old actors first
|
// always remove old actors first
|
||||||
|
|
||||||
forAll(patchTextActorsPtrs_, patchi)
|
forAll(patchTextActorsPtrs_, patchi)
|
||||||
@ -647,10 +644,10 @@ void Foam::vtkPVFoam::renderPatchNames
|
|||||||
}
|
}
|
||||||
patchTextActorsPtrs_.clear();
|
patchTextActorsPtrs_.clear();
|
||||||
|
|
||||||
if (show)
|
if (show && meshPtr_)
|
||||||
{
|
{
|
||||||
// get the display patches, strip off any suffix
|
// get the display patches, strip off any suffix
|
||||||
wordHashSet selectedPatches = getSelected
|
hashedWordList selectedPatches = getSelected
|
||||||
(
|
(
|
||||||
reader_->GetPartSelection(),
|
reader_->GetPartSelection(),
|
||||||
arrayRangePatches_
|
arrayRangePatches_
|
||||||
@ -764,17 +761,16 @@ void Foam::vtkPVFoam::renderPatchNames
|
|||||||
{
|
{
|
||||||
const polyPatch& pp = pbMesh[patchi];
|
const polyPatch& pp = pbMesh[patchi];
|
||||||
|
|
||||||
label globalZoneI = 0;
|
|
||||||
|
|
||||||
// Only selected patches will have a non-zero number of zones
|
// Only selected patches will have a non-zero number of zones
|
||||||
label nDisplayZones = min(MAXPATCHZONES, nZones[patchi]);
|
const label nDisplayZones = min(MAXPATCHZONES, nZones[patchi]);
|
||||||
label increment = 1;
|
label increment = 1;
|
||||||
if (nZones[patchi] >= MAXPATCHZONES)
|
if (nZones[patchi] >= MAXPATCHZONES)
|
||||||
{
|
{
|
||||||
increment = nZones[patchi]/MAXPATCHZONES;
|
increment = nZones[patchi]/MAXPATCHZONES;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (label i = 0; i < nDisplayZones; i++)
|
label globalZoneI = 0;
|
||||||
|
for (label i = 0; i < nDisplayZones; ++i, globalZoneI += increment)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -783,45 +779,24 @@ void Foam::vtkPVFoam::renderPatchNames
|
|||||||
<< "globalZoneI = " << globalZoneI << endl;
|
<< "globalZoneI = " << globalZoneI << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkTextActor* txt = vtkTextActor::New();
|
// Into a list for later removal
|
||||||
|
patchTextActorsPtrs_[displayZoneI++] = createTextActor
|
||||||
txt->SetInput(pp.name().c_str());
|
|
||||||
|
|
||||||
// Set text properties
|
|
||||||
vtkTextProperty* tprop = txt->GetTextProperty();
|
|
||||||
tprop->SetFontFamilyToArial();
|
|
||||||
tprop->BoldOff();
|
|
||||||
tprop->ShadowOff();
|
|
||||||
tprop->SetLineSpacing(1.0);
|
|
||||||
tprop->SetFontSize(12);
|
|
||||||
tprop->SetColor(1.0, 0.0, 0.0);
|
|
||||||
tprop->SetJustificationToCentered();
|
|
||||||
|
|
||||||
// Set text to use 3-D world co-ordinates
|
|
||||||
txt->GetPositionCoordinate()->SetCoordinateSystemToWorld();
|
|
||||||
|
|
||||||
txt->GetPositionCoordinate()->SetValue
|
|
||||||
(
|
(
|
||||||
zoneCentre[patchi][globalZoneI].x(),
|
pp.name(),
|
||||||
zoneCentre[patchi][globalZoneI].y(),
|
zoneCentre[patchi][globalZoneI]
|
||||||
zoneCentre[patchi][globalZoneI].z()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add text to each renderer
|
|
||||||
renderer->AddViewProp(txt);
|
|
||||||
|
|
||||||
// Maintain a list of text labels added so that they can be
|
|
||||||
// removed later
|
|
||||||
patchTextActorsPtrs_[displayZoneI] = txt;
|
|
||||||
|
|
||||||
globalZoneI += increment;
|
|
||||||
displayZoneI++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resize the patch names list to the actual number of patch names added
|
// Resize the patch names list to the actual number of patch names added
|
||||||
patchTextActorsPtrs_.setSize(displayZoneI);
|
patchTextActorsPtrs_.setSize(displayZoneI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add text to each renderer
|
||||||
|
forAll(patchTextActorsPtrs_, actori)
|
||||||
|
{
|
||||||
|
renderer->AddViewProp(patchTextActorsPtrs_[actori]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -840,4 +815,24 @@ void Foam::vtkPVFoam::PrintSelf(ostream& os, vtkIndent indent) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::vtkPVFoam::printInfo() const
|
||||||
|
{
|
||||||
|
std::cout
|
||||||
|
<< "Region: " << meshRegion_ << "\n"
|
||||||
|
<< "nPoints: " << (meshPtr_ ? meshPtr_->nPoints() : 0) << "\n"
|
||||||
|
<< "nCells: " << (meshPtr_ ? meshPtr_->nCells() : 0) << "\n"
|
||||||
|
<< "nTimes: "
|
||||||
|
<< (dbPtr_.valid() ? dbPtr_().times().size() : 0) << "\n";
|
||||||
|
|
||||||
|
std::vector<double> times = this->findTimes(reader_->GetSkipZeroTime());
|
||||||
|
|
||||||
|
std::cout<<" " << times.size() << "(";
|
||||||
|
for (const double& val : times)
|
||||||
|
{
|
||||||
|
std::cout<< ' ' << val;
|
||||||
|
}
|
||||||
|
std::cout << " )" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -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) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -29,24 +29,15 @@ Description
|
|||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
vtkPVFoam.C
|
vtkPVFoam.C
|
||||||
vtkPVFoam.H
|
|
||||||
vtkPVFoamFields.C
|
vtkPVFoamFields.C
|
||||||
vtkPVFoamMesh.C
|
vtkPVFoamMesh.C
|
||||||
vtkPVFoamMeshLagrangian.C
|
vtkPVFoamMeshLagrangian.C
|
||||||
vtkPVFoamTemplates.C
|
|
||||||
vtkPVFoamMeshSet.C
|
|
||||||
vtkPVFoamMeshVolume.C
|
vtkPVFoamMeshVolume.C
|
||||||
vtkPVFoamMeshZone.C
|
vtkPVFoamTemplates.C
|
||||||
vtkPVFoamFaceField.H
|
|
||||||
vtkPVFoamLagrangianFields.H
|
|
||||||
vtkPVFoamPatchField.H
|
|
||||||
vtkPVFoamPointFields.H
|
|
||||||
vtkPVFoamPoints.H
|
|
||||||
vtkPVFoamUpdateInfo.C
|
vtkPVFoamUpdateInfo.C
|
||||||
vtkPVFoamUpdateInfoFields.H
|
|
||||||
vtkPVFoamUtils.C
|
vtkPVFoamUtils.C
|
||||||
vtkPVFoamVolFields.H
|
vtkPVFoamFieldTemplates.C
|
||||||
vtkPVFoamAddToSelection.H
|
vtkPVFoamUpdateTemplates.C
|
||||||
|
|
||||||
// Needed by VTK:
|
// Needed by VTK:
|
||||||
vtkDataArrayTemplateImplicit.txx
|
vtkDataArrayTemplateImplicit.txx
|
||||||
@ -56,11 +47,6 @@ SourceFiles
|
|||||||
#ifndef vtkPVFoam_H
|
#ifndef vtkPVFoam_H
|
||||||
#define vtkPVFoam_H
|
#define vtkPVFoam_H
|
||||||
|
|
||||||
// do not include legacy strstream headers
|
|
||||||
#ifndef VTK_EXCLUDE_STRSTREAM_HEADERS
|
|
||||||
# define VTK_EXCLUDE_STRSTREAM_HEADERS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "className.H"
|
#include "className.H"
|
||||||
#include "fileName.H"
|
#include "fileName.H"
|
||||||
#include "stringList.H"
|
#include "stringList.H"
|
||||||
@ -68,6 +54,7 @@ SourceFiles
|
|||||||
#include "primitivePatch.H"
|
#include "primitivePatch.H"
|
||||||
#include "PrimitivePatchInterpolation.H"
|
#include "PrimitivePatchInterpolation.H"
|
||||||
#include "volPointInterpolation.H"
|
#include "volPointInterpolation.H"
|
||||||
|
#include "foamPvCore.H"
|
||||||
|
|
||||||
#undef VTKPVFOAM_DUALPORT
|
#undef VTKPVFOAM_DUALPORT
|
||||||
|
|
||||||
@ -75,6 +62,7 @@ SourceFiles
|
|||||||
|
|
||||||
class vtkDataArraySelection;
|
class vtkDataArraySelection;
|
||||||
class vtkDataSet;
|
class vtkDataSet;
|
||||||
|
class vtkFloatArray;
|
||||||
class vtkPoints;
|
class vtkPoints;
|
||||||
class vtkPVFoamReader;
|
class vtkPVFoamReader;
|
||||||
class vtkRenderer;
|
class vtkRenderer;
|
||||||
@ -95,10 +83,9 @@ class Time;
|
|||||||
class fvMesh;
|
class fvMesh;
|
||||||
class IOobjectList;
|
class IOobjectList;
|
||||||
class polyPatch;
|
class polyPatch;
|
||||||
class faceSet;
|
|
||||||
class pointSet;
|
|
||||||
|
|
||||||
template<class Type> class IOField;
|
template<class Type> class IOField;
|
||||||
|
template<class Type> class Field;
|
||||||
template<class Type> class List;
|
template<class Type> class List;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
@ -106,84 +93,15 @@ template<class Type> class List;
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class vtkPVFoam
|
class vtkPVFoam
|
||||||
|
:
|
||||||
|
private foamPvCore
|
||||||
{
|
{
|
||||||
|
// Convenience typedefs
|
||||||
|
typedef PrimitivePatchInterpolation<primitivePatch> patchInterpolator;
|
||||||
|
|
||||||
|
|
||||||
// Private classes
|
// Private classes
|
||||||
|
|
||||||
//- Bookkeeping for GUI checklists and the multi-block organization
|
|
||||||
class arrayRange
|
|
||||||
{
|
|
||||||
const char *name_;
|
|
||||||
int block_;
|
|
||||||
int start_;
|
|
||||||
int size_;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
arrayRange(const char *name, const int blockNo=0)
|
|
||||||
:
|
|
||||||
name_(name),
|
|
||||||
block_(blockNo),
|
|
||||||
start_(0),
|
|
||||||
size_(0)
|
|
||||||
{}
|
|
||||||
|
|
||||||
//- Return the block holding these datasets
|
|
||||||
int block() const
|
|
||||||
{
|
|
||||||
return block_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Assign block number, return previous value
|
|
||||||
int block(int blockNo)
|
|
||||||
{
|
|
||||||
int prev = block_;
|
|
||||||
block_ = blockNo;
|
|
||||||
return prev;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return block name
|
|
||||||
const char* name() const
|
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return array start index
|
|
||||||
int start() const
|
|
||||||
{
|
|
||||||
return start_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return array end index
|
|
||||||
int end() const
|
|
||||||
{
|
|
||||||
return start_ + size_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return sublist size
|
|
||||||
int size() const
|
|
||||||
{
|
|
||||||
return size_;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool empty() const
|
|
||||||
{
|
|
||||||
return !size_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Reset the size to zero and optionally assign a new start
|
|
||||||
void reset(const int startAt = 0)
|
|
||||||
{
|
|
||||||
start_ = startAt;
|
|
||||||
size_ = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Increment the size
|
|
||||||
void operator+=(const int n)
|
|
||||||
{
|
|
||||||
size_ += n;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//- Bookkeeping for polyhedral cell decomposition
|
//- Bookkeeping for polyhedral cell decomposition
|
||||||
// hide in extra pointMap (cellSet/cellZone) for now
|
// hide in extra pointMap (cellSet/cellZone) for now
|
||||||
class polyDecomp
|
class polyDecomp
|
||||||
@ -302,372 +220,261 @@ class vtkPVFoam
|
|||||||
//- List of patch names for rendering to window
|
//- List of patch names for rendering to window
|
||||||
List<vtkTextActor*> patchTextActorsPtrs_;
|
List<vtkTextActor*> patchTextActorsPtrs_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
// Convenience method use to convert the readers from VTK 5
|
//- Create a text actor
|
||||||
// multiblock API to the current composite data infrastructure
|
static vtkTextActor* createTextActor(const string& s, const point& pt);
|
||||||
static void AddToBlock
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
vtkDataSet* dataset,
|
|
||||||
const arrayRange&,
|
|
||||||
const label datasetNo,
|
|
||||||
const std::string& datasetName
|
|
||||||
);
|
|
||||||
|
|
||||||
// Convenience method use to convert the readers from VTK 5
|
|
||||||
// multiblock API to the current composite data infrastructure
|
|
||||||
static vtkDataSet* GetDataSetFromBlock
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const arrayRange&,
|
|
||||||
const label datasetNo
|
|
||||||
);
|
|
||||||
|
|
||||||
// Convenience method use to convert the readers from VTK 5
|
|
||||||
// multiblock API to the current composite data infrastructure
|
|
||||||
static label GetNumberOfDataSets
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const arrayRange&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Reset data counters
|
//- Reset data counters
|
||||||
void resetCounters();
|
void resetCounters();
|
||||||
|
|
||||||
// Update information helper functions
|
// Update information helper functions
|
||||||
|
|
||||||
//- Update the mesh parts selected in the GUI
|
//- Update the mesh parts selected in the GUI
|
||||||
void updateMeshPartsStatus();
|
void updateMeshPartsStatus();
|
||||||
|
|
||||||
//- Internal mesh info
|
//- Internal mesh info
|
||||||
void updateInfoInternalMesh(vtkDataArraySelection*);
|
void updateInfoInternalMesh(vtkDataArraySelection*);
|
||||||
|
|
||||||
//- Lagrangian info
|
//- Lagrangian info
|
||||||
void updateInfoLagrangian(vtkDataArraySelection*);
|
void updateInfoLagrangian(vtkDataArraySelection*);
|
||||||
|
|
||||||
//- Patch info
|
//- Patch info
|
||||||
void updateInfoPatches(vtkDataArraySelection*, stringList&);
|
void updateInfoPatches(vtkDataArraySelection*, stringList&);
|
||||||
|
|
||||||
//- Set info
|
//- Set info
|
||||||
void updateInfoSets(vtkDataArraySelection*);
|
void updateInfoSets(vtkDataArraySelection*);
|
||||||
|
|
||||||
//- Zone info
|
//- Zone info
|
||||||
void updateInfoZones(vtkDataArraySelection*);
|
void updateInfoZones(vtkDataArraySelection*);
|
||||||
|
|
||||||
//- Get non-empty zone names for zoneType from file
|
//- Get non-empty zone names for zoneType from file
|
||||||
wordList getZoneNames(const word& zoneType) const;
|
wordList getZoneNames(const word& zoneType) const;
|
||||||
|
|
||||||
//- Get non-empty zone names from mesh info
|
//- Get names of on non-empty zones from the mesh info
|
||||||
template<class ZoneType>
|
template<class ZoneType>
|
||||||
wordList getZoneNames
|
static wordList getZoneNames
|
||||||
(
|
|
||||||
const ZoneMesh<ZoneType, polyMesh>&
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Add objects of Type to paraview array selection
|
|
||||||
template<class Type>
|
|
||||||
label addToSelection
|
|
||||||
(
|
|
||||||
vtkDataArraySelection*,
|
|
||||||
const IOobjectList&,
|
|
||||||
const string& suffix=string::null
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Field info
|
|
||||||
template<template<class> class patchType, class meshType>
|
|
||||||
void updateInfoFields(vtkDataArraySelection*);
|
|
||||||
|
|
||||||
//- Lagrangian field info
|
|
||||||
void updateInfoLagrangianFields();
|
|
||||||
|
|
||||||
|
|
||||||
// Update helper functions
|
|
||||||
|
|
||||||
//- OpenFOAM mesh
|
|
||||||
void updateFoamMesh();
|
|
||||||
|
|
||||||
//- Reduce memory footprint after conversion
|
|
||||||
void reduceMemory();
|
|
||||||
|
|
||||||
|
|
||||||
// Mesh conversion functions
|
|
||||||
|
|
||||||
//- Volume mesh
|
|
||||||
void convertMeshVolume(vtkMultiBlockDataSet*, int& blockNo);
|
|
||||||
|
|
||||||
//- Lagrangian mesh
|
|
||||||
void convertMeshLagrangian(vtkMultiBlockDataSet*, int& blockNo);
|
|
||||||
|
|
||||||
//- Patch meshes
|
|
||||||
void convertMeshPatches(vtkMultiBlockDataSet*, int& blockNo);
|
|
||||||
|
|
||||||
//- Cell zone meshes
|
|
||||||
void convertMeshCellZones(vtkMultiBlockDataSet*, int& blockNo);
|
|
||||||
|
|
||||||
//- Face zone meshes
|
|
||||||
void convertMeshFaceZones(vtkMultiBlockDataSet*, int& blockNo);
|
|
||||||
|
|
||||||
//- Point zone meshes
|
|
||||||
void convertMeshPointZones(vtkMultiBlockDataSet*, int& blockNo);
|
|
||||||
|
|
||||||
//- Cell set meshes
|
|
||||||
void convertMeshCellSets(vtkMultiBlockDataSet*, int& blockNo);
|
|
||||||
|
|
||||||
//- Face set meshes
|
|
||||||
void convertMeshFaceSets(vtkMultiBlockDataSet*, int& blockNo);
|
|
||||||
|
|
||||||
//- Point set meshes
|
|
||||||
void convertMeshPointSets(vtkMultiBlockDataSet*, int& blockNo);
|
|
||||||
|
|
||||||
|
|
||||||
// Add mesh functions
|
|
||||||
|
|
||||||
//- Add internal mesh/cell set meshes
|
|
||||||
vtkUnstructuredGrid* volumeVTKMesh(const fvMesh&, polyDecomp&);
|
|
||||||
|
|
||||||
//- Add Lagrangian mesh
|
|
||||||
vtkPolyData* lagrangianVTKMesh
|
|
||||||
(
|
|
||||||
const fvMesh&,
|
|
||||||
const word& cloudName
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Add patch mesh
|
|
||||||
template<class PatchType>
|
|
||||||
vtkPolyData* patchVTKMesh(const word& name, const PatchType&);
|
|
||||||
|
|
||||||
//- Add point zone
|
|
||||||
vtkPolyData* pointZoneVTKMesh
|
|
||||||
(
|
|
||||||
const fvMesh&,
|
|
||||||
const labelList& pointLabels
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Add face set mesh
|
|
||||||
vtkPolyData* faceSetVTKMesh
|
|
||||||
(
|
|
||||||
const fvMesh&,
|
|
||||||
const faceSet&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Add point mesh
|
|
||||||
vtkPolyData* pointSetVTKMesh
|
|
||||||
(
|
|
||||||
const fvMesh&,
|
|
||||||
const pointSet&
|
|
||||||
);
|
|
||||||
|
|
||||||
// Field conversion functions
|
|
||||||
|
|
||||||
//- Convert volume fields
|
|
||||||
void convertVolFields(vtkMultiBlockDataSet*);
|
|
||||||
|
|
||||||
//- Convert point fields
|
|
||||||
void convertPointFields(vtkMultiBlockDataSet*);
|
|
||||||
|
|
||||||
//- Convert Lagrangian fields
|
|
||||||
void convertLagrangianFields(vtkMultiBlockDataSet*);
|
|
||||||
|
|
||||||
|
|
||||||
//- Add the fields in the selected time directory to the selection
|
|
||||||
// lists
|
|
||||||
template<class GeoField>
|
|
||||||
label addObjectsToSelection
|
|
||||||
(
|
(
|
||||||
vtkDataArraySelection*,
|
const ZoneMesh<ZoneType, polyMesh>& zmesh
|
||||||
const IOobjectList&,
|
);
|
||||||
const string& suffix=string::null
|
|
||||||
|
//- Field (volume, point, lagrangian) info
|
||||||
|
void updateInfoFields();
|
||||||
|
|
||||||
|
//- Field info
|
||||||
|
template<template<class> class patchType, class meshType>
|
||||||
|
void updateInfoFields
|
||||||
|
(
|
||||||
|
vtkDataArraySelection* select
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Lagrangian field info
|
||||||
|
void updateInfoLagrangianFields(vtkDataArraySelection* select);
|
||||||
|
|
||||||
|
|
||||||
|
// Update helper functions
|
||||||
|
|
||||||
|
//- OpenFOAM mesh
|
||||||
|
void updateFoamMesh();
|
||||||
|
|
||||||
|
//- Reduce memory footprint after conversion
|
||||||
|
void reduceMemory();
|
||||||
|
|
||||||
|
|
||||||
|
// Mesh conversion functions
|
||||||
|
|
||||||
|
//- Convert volume mesh
|
||||||
|
void convertMeshVolume(vtkMultiBlockDataSet* output, int& blockNo);
|
||||||
|
|
||||||
|
//- Convert Lagrangian points
|
||||||
|
void convertMeshLagrangian(vtkMultiBlockDataSet* output, int& blockNo);
|
||||||
|
|
||||||
|
//- Convert mesh patches
|
||||||
|
void convertMeshPatches(vtkMultiBlockDataSet* output, int& blockNo);
|
||||||
|
|
||||||
|
//- Convert cell zones
|
||||||
|
void convertMeshCellZones(vtkMultiBlockDataSet* output, int& blockNo);
|
||||||
|
|
||||||
|
//- Convert face zones
|
||||||
|
void convertMeshFaceZones(vtkMultiBlockDataSet* output, int& blockNo);
|
||||||
|
|
||||||
|
//- Convert point zones
|
||||||
|
void convertMeshPointZones(vtkMultiBlockDataSet* output, int& blockNo);
|
||||||
|
|
||||||
|
//- Convert cell sets
|
||||||
|
void convertMeshCellSets(vtkMultiBlockDataSet* output, int& blockNo);
|
||||||
|
|
||||||
|
//- Convert face sets
|
||||||
|
void convertMeshFaceSets(vtkMultiBlockDataSet* output, int& blockNo);
|
||||||
|
|
||||||
|
//- Convert point sets
|
||||||
|
void convertMeshPointSets(vtkMultiBlockDataSet* output, int& blockNo);
|
||||||
|
|
||||||
|
|
||||||
|
// Add mesh functions
|
||||||
|
|
||||||
|
//- Volume meshes as vtkUnstructuredGrid
|
||||||
|
vtkUnstructuredGrid* volumeVTKMesh
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
polyDecomp& decompInfo
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Lagrangian positions as vtkPolyData
|
||||||
|
vtkPolyData* lagrangianVTKMesh
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const word& cloudName
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Patches (mesh or primitive) as vtkPolyData
|
||||||
|
template<class PatchType>
|
||||||
|
vtkPolyData* patchVTKMesh
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const PatchType& p
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Convert OpenFOAM fields
|
// Field conversion functions
|
||||||
|
|
||||||
//- Volume field - all types
|
//- Convert Field to VTK field
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void convertVolField
|
vtkFloatArray* convertFieldToVTK
|
||||||
(
|
(
|
||||||
const PtrList<PrimitivePatchInterpolation<primitivePatch>>&,
|
const word& name,
|
||||||
const GeometricField<Type, fvPatchField, volMesh>&,
|
const Field<Type>& fld
|
||||||
const bool interpFields,
|
);
|
||||||
vtkMultiBlockDataSet* output
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Volume fields - all types
|
//- Face set/zone field
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void convertVolFields
|
vtkFloatArray* convertFaceFieldToVTK
|
||||||
(
|
(
|
||||||
const fvMesh&,
|
const GeometricField<Type, fvPatchField, volMesh>& fld,
|
||||||
const PtrList<PrimitivePatchInterpolation<primitivePatch>>&,
|
const labelUList& faceLabels
|
||||||
const IOobjectList&,
|
);
|
||||||
const bool interpFields,
|
|
||||||
vtkMultiBlockDataSet* output
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Volume internal fields (DimensionedField)- all types
|
//- Volume field
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void convertDimFields
|
vtkFloatArray* convertVolFieldToVTK
|
||||||
(
|
(
|
||||||
const fvMesh&,
|
const GeometricField<Type, fvPatchField, volMesh>& fld,
|
||||||
const PtrList<PrimitivePatchInterpolation<primitivePatch>>&,
|
const polyDecomp& decompInfo
|
||||||
const IOobjectList&,
|
);
|
||||||
const bool interpFields,
|
|
||||||
vtkMultiBlockDataSet* output
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Volume field - all selected parts
|
|
||||||
template<class Type>
|
|
||||||
void convertVolFieldBlock
|
|
||||||
(
|
|
||||||
const GeometricField<Type, fvPatchField, volMesh>&,
|
|
||||||
autoPtr<GeometricField<Type, pointPatchField, pointMesh>>&,
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const arrayRange&,
|
|
||||||
const List<polyDecomp>& decompLst
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Volume field
|
|
||||||
template<class Type>
|
|
||||||
void convertVolField
|
|
||||||
(
|
|
||||||
const GeometricField<Type, fvPatchField, volMesh>&,
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const arrayRange&,
|
|
||||||
const label datasetNo,
|
|
||||||
const polyDecomp&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Patch field
|
|
||||||
template<class Type>
|
|
||||||
void convertPatchField
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const Field<Type>&,
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const arrayRange&,
|
|
||||||
const label datasetNo
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Face set/zone field
|
|
||||||
template<class Type>
|
|
||||||
void convertFaceField
|
|
||||||
(
|
|
||||||
const GeometricField<Type, fvPatchField, volMesh>&,
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const arrayRange&,
|
|
||||||
const label datasetNo,
|
|
||||||
const fvMesh&,
|
|
||||||
const labelList& faceLabels
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Lagrangian fields - all types
|
|
||||||
template<class Type>
|
|
||||||
void convertLagrangianFields
|
|
||||||
(
|
|
||||||
const IOobjectList&,
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const label datasetNo
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Lagrangian field
|
|
||||||
template<class Type>
|
|
||||||
void convertLagrangianField
|
|
||||||
(
|
|
||||||
const IOField<Type>&,
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const arrayRange&,
|
|
||||||
const label datasetNo
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Point fields - all types
|
|
||||||
template<class Type>
|
|
||||||
void convertPointFields
|
|
||||||
(
|
|
||||||
const fvMesh&,
|
|
||||||
const pointMesh&,
|
|
||||||
const IOobjectList&,
|
|
||||||
vtkMultiBlockDataSet* output
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Point field - all selected parts
|
|
||||||
template<class Type>
|
|
||||||
void convertPointFieldBlock
|
|
||||||
(
|
|
||||||
const GeometricField<Type, pointPatchField, pointMesh>&,
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const arrayRange&,
|
|
||||||
const List<polyDecomp>&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Point fields
|
|
||||||
template<class Type>
|
|
||||||
void convertPointField
|
|
||||||
(
|
|
||||||
const GeometricField<Type, pointPatchField, pointMesh>&,
|
|
||||||
const GeometricField<Type, fvPatchField, volMesh>&,
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const arrayRange&,
|
|
||||||
const label datasetNo,
|
|
||||||
const polyDecomp&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Patch point field
|
|
||||||
template<class Type>
|
|
||||||
void convertPatchPointField
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const Field<Type>&,
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const arrayRange&,
|
|
||||||
const label datasetNo
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// GUI selection helper functions
|
//- Convert volume fields
|
||||||
|
void convertVolFields(vtkMultiBlockDataSet* output);
|
||||||
|
|
||||||
//- Only keep what is listed in hashSet
|
//- Convert point fields
|
||||||
static void pruneObjectList
|
void convertPointFields(vtkMultiBlockDataSet* output);
|
||||||
(
|
|
||||||
IOobjectList&,
|
|
||||||
const wordHashSet&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Retrieve the current selections
|
//- Convert Lagrangian fields
|
||||||
static wordHashSet getSelected(vtkDataArraySelection*);
|
void convertLagrangianFields(vtkMultiBlockDataSet* output);
|
||||||
|
|
||||||
//- Retrieve a sub-list of the current selections
|
|
||||||
static wordHashSet getSelected
|
|
||||||
(
|
|
||||||
vtkDataArraySelection*,
|
|
||||||
const arrayRange&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Retrieve the current selections
|
// Convert OpenFOAM fields
|
||||||
static stringList getSelectedArrayEntries(vtkDataArraySelection*);
|
|
||||||
|
|
||||||
//- Retrieve a sub-list of the current selections
|
//- Volume field - all types
|
||||||
static stringList getSelectedArrayEntries
|
template<class Type>
|
||||||
(
|
void convertVolField
|
||||||
vtkDataArraySelection*,
|
(
|
||||||
const arrayRange&
|
const PtrList<patchInterpolator>& patchInterpList,
|
||||||
);
|
const GeometricField<Type, fvPatchField, volMesh>& fld,
|
||||||
|
vtkMultiBlockDataSet* output
|
||||||
|
);
|
||||||
|
|
||||||
//- Set selection(s)
|
//- Volume fields - all types
|
||||||
static void setSelectedArrayEntries
|
template<class Type>
|
||||||
(
|
void convertVolFields
|
||||||
vtkDataArraySelection*,
|
(
|
||||||
const stringList&
|
const fvMesh& mesh,
|
||||||
);
|
const PtrList<patchInterpolator>& patchInterpList,
|
||||||
|
const IOobjectList& objects,
|
||||||
|
vtkMultiBlockDataSet* output
|
||||||
|
);
|
||||||
|
|
||||||
//- Get the first word from the mesh parts selection
|
//- Volume internal fields (DimensionedField)- all types
|
||||||
word getPartName(const int);
|
template<class Type>
|
||||||
|
void convertDimFields
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const PtrList<patchInterpolator>& patchInterpList,
|
||||||
|
const IOobjectList& objects,
|
||||||
|
vtkMultiBlockDataSet* output
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Volume field - all selected parts
|
||||||
|
template<class Type>
|
||||||
|
void convertVolFieldBlock
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& fld,
|
||||||
|
autoPtr<GeometricField<Type, pointPatchField, pointMesh>>& ptfPtr,
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
const arrayRange& range,
|
||||||
|
const List<polyDecomp>& decompLst
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Lagrangian fields - all types
|
||||||
|
template<class Type>
|
||||||
|
void convertLagrangianFields
|
||||||
|
(
|
||||||
|
const IOobjectList& objects,
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
const label datasetNo
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Point fields - all types
|
||||||
|
template<class Type>
|
||||||
|
void convertPointFields
|
||||||
|
(
|
||||||
|
const pointMesh& pMesh,
|
||||||
|
const IOobjectList& objects,
|
||||||
|
vtkMultiBlockDataSet* output
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Point field - all selected parts
|
||||||
|
template<class Type>
|
||||||
|
void convertPointFieldBlock
|
||||||
|
(
|
||||||
|
const GeometricField<Type, pointPatchField, pointMesh>& pfld,
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
const arrayRange& range,
|
||||||
|
const List<polyDecomp>& decompLst
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Point field
|
||||||
|
template<class Type>
|
||||||
|
void convertPointField
|
||||||
|
(
|
||||||
|
vtkUnstructuredGrid* vtkmesh,
|
||||||
|
const GeometricField<Type, pointPatchField, pointMesh>& pfld,
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& vfld,
|
||||||
|
const polyDecomp& decomp
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// GUI selection helper functions
|
||||||
|
|
||||||
|
//- Only retain specified fields
|
||||||
|
static void pruneObjectList
|
||||||
|
(
|
||||||
|
IOobjectList& objects,
|
||||||
|
const hashedWordList& retain
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Get the first word from the reader 'parts' selection
|
||||||
|
word getPartName(const int partId);
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
vtkPVFoam(const vtkPVFoam&);
|
vtkPVFoam(const vtkPVFoam&) = delete;
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const vtkPVFoam&);
|
void operator=(const vtkPVFoam&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -705,9 +512,9 @@ public:
|
|||||||
//- Clean any storage
|
//- Clean any storage
|
||||||
void CleanUp();
|
void CleanUp();
|
||||||
|
|
||||||
//- Allocate and return a list of selected times
|
//- Return a list of selected times.
|
||||||
// returns the count via the parameter
|
// Use STL container since these values are used by the plugin
|
||||||
double* findTimes(int& nTimeSteps);
|
std::vector<double> findTimes(const bool skipZero = false) const;
|
||||||
|
|
||||||
//- Add/remove patch names to/from the view
|
//- Add/remove patch names to/from the view
|
||||||
void renderPatchNames(vtkRenderer*, const bool show);
|
void renderPatchNames(vtkRenderer*, const bool show);
|
||||||
@ -730,9 +537,7 @@ public:
|
|||||||
//- Debug information
|
//- Debug information
|
||||||
void PrintSelf(ostream&, vtkIndent) const;
|
void PrintSelf(ostream&, vtkIndent) const;
|
||||||
|
|
||||||
//- Simple memory used debugging information
|
void printInfo() const;
|
||||||
static void printMemory();
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,117 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
||||||
\\/ 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/>.
|
|
||||||
|
|
||||||
InClass
|
|
||||||
vtkPVFoam
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef vtkPVFoamFaceField_H
|
|
||||||
#define vtkPVFoamFaceField_H
|
|
||||||
|
|
||||||
// VTK includes
|
|
||||||
#include "vtkCellData.h"
|
|
||||||
#include "vtkFloatArray.h"
|
|
||||||
#include "vtkMultiBlockDataSet.h"
|
|
||||||
#include "vtkPolyData.h"
|
|
||||||
|
|
||||||
#include "vtkOpenFOAMTupleRemap.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::vtkPVFoam::convertFaceField
|
|
||||||
(
|
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& tf,
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const arrayRange& range,
|
|
||||||
const label datasetNo,
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const labelList& faceLabels
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const label nComp = pTraits<Type>::nComponents;
|
|
||||||
const label nInternalFaces = mesh.nInternalFaces();
|
|
||||||
const labelList& faceOwner = mesh.faceOwner();
|
|
||||||
const labelList& faceNeigh = mesh.faceNeighbour();
|
|
||||||
|
|
||||||
vtkFloatArray* cellData = vtkFloatArray::New();
|
|
||||||
cellData->SetNumberOfTuples(faceLabels.size());
|
|
||||||
cellData->SetNumberOfComponents(nComp);
|
|
||||||
cellData->Allocate(nComp*faceLabels.size());
|
|
||||||
cellData->SetName(tf.name().c_str());
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "convert convertFaceField: "
|
|
||||||
<< tf.name()
|
|
||||||
<< " size = " << tf.size()
|
|
||||||
<< " nComp=" << nComp
|
|
||||||
<< " nTuples = " << faceLabels.size() << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
float vec[nComp];
|
|
||||||
|
|
||||||
// for interior faces: average owner/neighbour
|
|
||||||
// for boundary faces: owner
|
|
||||||
forAll(faceLabels, facei)
|
|
||||||
{
|
|
||||||
const label faceNo = faceLabels[facei];
|
|
||||||
if (faceNo < nInternalFaces)
|
|
||||||
{
|
|
||||||
Type t = 0.5*(tf[faceOwner[faceNo]] + tf[faceNeigh[faceNo]]);
|
|
||||||
|
|
||||||
for (direction d=0; d<nComp; ++d)
|
|
||||||
{
|
|
||||||
vec[d] = component(t, d);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const Type& t = tf[faceOwner[faceNo]];
|
|
||||||
for (direction d=0; d<nComp; ++d)
|
|
||||||
{
|
|
||||||
vec[d] = component(t, d);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
vtkOpenFOAMTupleRemap<Type>(vec);
|
|
||||||
|
|
||||||
cellData->InsertTuple(facei, vec);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
vtkPolyData::SafeDownCast
|
|
||||||
(
|
|
||||||
GetDataSetFromBlock(output, range, datasetNo)
|
|
||||||
) ->GetCellData()
|
|
||||||
->AddArray(cellData);
|
|
||||||
|
|
||||||
cellData->Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -0,0 +1,909 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 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/>.
|
||||||
|
|
||||||
|
InClass
|
||||||
|
vtkPVFoam
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef vtkPVFoamFieldTemplates_C
|
||||||
|
#define vtkPVFoamFieldTemplates_C
|
||||||
|
|
||||||
|
// OpenFOAM includes
|
||||||
|
#include "emptyFvPatchField.H"
|
||||||
|
#include "wallPolyPatch.H"
|
||||||
|
#include "faceSet.H"
|
||||||
|
#include "volPointInterpolation.H"
|
||||||
|
#include "zeroGradientFvPatchField.H"
|
||||||
|
#include "interpolatePointToCell.H"
|
||||||
|
#include "foamPvFields.H"
|
||||||
|
|
||||||
|
// vtk includes
|
||||||
|
#include "vtkFloatArray.h"
|
||||||
|
#include "vtkCellData.h"
|
||||||
|
#include "vtkPointData.h"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
//
|
||||||
|
// volume-fields
|
||||||
|
//
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::vtkPVFoam::convertVolField
|
||||||
|
(
|
||||||
|
const PtrList<patchInterpolator>& patchInterpList,
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& fld,
|
||||||
|
vtkMultiBlockDataSet* output
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const fvMesh& mesh = fld.mesh();
|
||||||
|
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||||
|
|
||||||
|
const bool interpField = !patchInterpList.empty();
|
||||||
|
const bool extrapPatch = reader_->GetExtrapolatePatches();
|
||||||
|
|
||||||
|
// Interpolated field (demand driven)
|
||||||
|
autoPtr<GeometricField<Type, pointPatchField, pointMesh>> ptfPtr;
|
||||||
|
if (interpField)
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "convertVolField interpolating:" << fld.name() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
ptfPtr.reset
|
||||||
|
(
|
||||||
|
volPointInterpolation::New(mesh).interpolate(fld).ptr()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert activated internalMesh regions
|
||||||
|
convertVolFieldBlock
|
||||||
|
(
|
||||||
|
fld,
|
||||||
|
ptfPtr,
|
||||||
|
output,
|
||||||
|
arrayRangeVolume_,
|
||||||
|
regionPolyDecomp_
|
||||||
|
);
|
||||||
|
|
||||||
|
// Convert activated cellZones
|
||||||
|
convertVolFieldBlock
|
||||||
|
(
|
||||||
|
fld,
|
||||||
|
ptfPtr,
|
||||||
|
output,
|
||||||
|
arrayRangeCellZones_,
|
||||||
|
zonePolyDecomp_
|
||||||
|
);
|
||||||
|
|
||||||
|
// Convert activated cellSets
|
||||||
|
convertVolFieldBlock
|
||||||
|
(
|
||||||
|
fld,
|
||||||
|
ptfPtr,
|
||||||
|
output,
|
||||||
|
arrayRangeCellSets_,
|
||||||
|
csetPolyDecomp_
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Convert patches - if activated
|
||||||
|
//
|
||||||
|
for
|
||||||
|
(
|
||||||
|
int partId = arrayRangePatches_.start();
|
||||||
|
partId < arrayRangePatches_.end();
|
||||||
|
++partId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const word patchName = getPartName(partId);
|
||||||
|
const label datasetNo = partDataset_[partId];
|
||||||
|
const label patchId = patches.findPatchID(patchName);
|
||||||
|
|
||||||
|
if (!partStatus_[partId] || patchId < 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkPolyData* vtkmesh = getDataFromBlock<vtkPolyData>
|
||||||
|
(
|
||||||
|
output, arrayRangePatches_, datasetNo
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!vtkmesh)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fvPatchField<Type>& ptf = fld.boundaryField()[patchId];
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
isType<emptyFvPatchField<Type>>(ptf)
|
||||||
|
||
|
||||||
|
(
|
||||||
|
extrapPatch
|
||||||
|
&& !polyPatch::constraintType(patches[patchId].type())
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
fvPatch p(ptf.patch().patch(), mesh.boundary());
|
||||||
|
|
||||||
|
tmp<Field<Type>> tpptf
|
||||||
|
(
|
||||||
|
fvPatchField<Type>(p, fld).patchInternalField()
|
||||||
|
);
|
||||||
|
|
||||||
|
vtkFloatArray* cdata = convertFieldToVTK(fld.name(), tpptf());
|
||||||
|
vtkmesh->GetCellData()->AddArray(cdata);
|
||||||
|
cdata->Delete();
|
||||||
|
|
||||||
|
if (patchId < patchInterpList.size())
|
||||||
|
{
|
||||||
|
vtkFloatArray* pdata = convertFieldToVTK
|
||||||
|
(
|
||||||
|
fld.name(),
|
||||||
|
patchInterpList[patchId].faceToPointInterpolate(tpptf)()
|
||||||
|
);
|
||||||
|
|
||||||
|
vtkmesh->GetPointData()->AddArray(pdata);
|
||||||
|
pdata->Delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vtkFloatArray* cdata = convertFieldToVTK(fld.name(), ptf);
|
||||||
|
vtkmesh->GetCellData()->AddArray(cdata);
|
||||||
|
cdata->Delete();
|
||||||
|
|
||||||
|
if (patchId < patchInterpList.size())
|
||||||
|
{
|
||||||
|
vtkFloatArray* pdata = convertFieldToVTK
|
||||||
|
(
|
||||||
|
fld.name(),
|
||||||
|
patchInterpList[patchId].faceToPointInterpolate(ptf)()
|
||||||
|
);
|
||||||
|
|
||||||
|
vtkmesh->GetPointData()->AddArray(pdata);
|
||||||
|
pdata->Delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Convert face zones - if activated
|
||||||
|
//
|
||||||
|
for
|
||||||
|
(
|
||||||
|
int partId = arrayRangeFaceZones_.start();
|
||||||
|
partId < arrayRangeFaceZones_.end();
|
||||||
|
++partId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const word zoneName = getPartName(partId);
|
||||||
|
const label datasetNo = partDataset_[partId];
|
||||||
|
|
||||||
|
if (!partStatus_[partId] || datasetNo < 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const faceZoneMesh& zMesh = mesh.faceZones();
|
||||||
|
const label zoneId = zMesh.findZoneID(zoneName);
|
||||||
|
|
||||||
|
if (zoneId < 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkPolyData* vtkmesh = getDataFromBlock<vtkPolyData>
|
||||||
|
(
|
||||||
|
output, arrayRangeFaceZones_, datasetNo
|
||||||
|
);
|
||||||
|
|
||||||
|
if (vtkmesh)
|
||||||
|
{
|
||||||
|
vtkFloatArray* cdata = convertFaceFieldToVTK
|
||||||
|
(
|
||||||
|
fld,
|
||||||
|
zMesh[zoneId]
|
||||||
|
);
|
||||||
|
|
||||||
|
vtkmesh->GetCellData()->AddArray(cdata);
|
||||||
|
cdata->Delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: points
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Convert face sets - if activated
|
||||||
|
//
|
||||||
|
for
|
||||||
|
(
|
||||||
|
int partId = arrayRangeFaceSets_.start();
|
||||||
|
partId < arrayRangeFaceSets_.end();
|
||||||
|
++partId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const word selectName = getPartName(partId);
|
||||||
|
const label datasetNo = partDataset_[partId];
|
||||||
|
|
||||||
|
if (!partStatus_[partId])
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkPolyData* vtkmesh = getDataFromBlock<vtkPolyData>
|
||||||
|
(
|
||||||
|
output, arrayRangeFaceSets_, datasetNo
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!vtkmesh)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const faceSet fSet(mesh, selectName);
|
||||||
|
|
||||||
|
vtkFloatArray* cdata = convertFaceFieldToVTK
|
||||||
|
(
|
||||||
|
fld,
|
||||||
|
fSet.sortedToc()
|
||||||
|
);
|
||||||
|
|
||||||
|
vtkmesh->GetCellData()->AddArray(cdata);
|
||||||
|
cdata->Delete();
|
||||||
|
|
||||||
|
// TODO: points
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::vtkPVFoam::convertVolFields
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const PtrList<patchInterpolator>& patchInterpList,
|
||||||
|
const IOobjectList& objects,
|
||||||
|
vtkMultiBlockDataSet* output
|
||||||
|
)
|
||||||
|
{
|
||||||
|
forAllConstIter(IOobjectList, objects, iter)
|
||||||
|
{
|
||||||
|
// restrict to GeometricField<Type, ...>
|
||||||
|
if
|
||||||
|
(
|
||||||
|
iter()->headerClassName()
|
||||||
|
!= GeometricField<Type, fvPatchField, volMesh>::typeName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load field
|
||||||
|
GeometricField<Type, fvPatchField, volMesh> fld
|
||||||
|
(
|
||||||
|
*iter(),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
// Convert
|
||||||
|
convertVolField(patchInterpList, fld, output);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::vtkPVFoam::convertDimFields
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const PtrList<patchInterpolator>& patchInterpList,
|
||||||
|
const IOobjectList& objects,
|
||||||
|
vtkMultiBlockDataSet* output
|
||||||
|
)
|
||||||
|
{
|
||||||
|
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
||||||
|
|
||||||
|
forAllConstIter(IOobjectList, objects, iter)
|
||||||
|
{
|
||||||
|
// restrict to DimensionedField<Type, ...>
|
||||||
|
if
|
||||||
|
(
|
||||||
|
iter()->headerClassName()
|
||||||
|
!= DimensionedField<Type, volMesh>::typeName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load field
|
||||||
|
DimensionedField<Type, volMesh> dimFld(*iter(), mesh);
|
||||||
|
|
||||||
|
// Construct volField with zero-gradient patch fields
|
||||||
|
|
||||||
|
IOobject io(dimFld);
|
||||||
|
io.readOpt() = IOobject::NO_READ;
|
||||||
|
|
||||||
|
PtrList<fvPatchField<Type>> patchFields(mesh.boundary().size());
|
||||||
|
forAll(patchFields, patchI)
|
||||||
|
{
|
||||||
|
patchFields.set
|
||||||
|
(
|
||||||
|
patchI,
|
||||||
|
fvPatchField<Type>::New
|
||||||
|
(
|
||||||
|
zeroGradientFvPatchField<Type>::typeName,
|
||||||
|
mesh.boundary()[patchI],
|
||||||
|
dimFld
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
VolFieldType volFld
|
||||||
|
(
|
||||||
|
io,
|
||||||
|
dimFld.mesh(),
|
||||||
|
dimFld.dimensions(),
|
||||||
|
dimFld,
|
||||||
|
patchFields
|
||||||
|
);
|
||||||
|
volFld.correctBoundaryConditions();
|
||||||
|
|
||||||
|
convertVolField(patchInterpList, volFld, output);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::vtkPVFoam::convertVolFieldBlock
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& fld,
|
||||||
|
autoPtr<GeometricField<Type, pointPatchField, pointMesh>>& ptfPtr,
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
const arrayRange& range,
|
||||||
|
const List<polyDecomp>& decompLst
|
||||||
|
)
|
||||||
|
{
|
||||||
|
for (int partId = range.start(); partId < range.end(); ++partId)
|
||||||
|
{
|
||||||
|
const label datasetNo = partDataset_[partId];
|
||||||
|
|
||||||
|
if (!partStatus_[partId])
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkUnstructuredGrid* vtkmesh =
|
||||||
|
getDataFromBlock<vtkUnstructuredGrid>(output, range, datasetNo);
|
||||||
|
|
||||||
|
if (!vtkmesh)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkFloatArray* cdata = convertVolFieldToVTK
|
||||||
|
(
|
||||||
|
fld,
|
||||||
|
decompLst[datasetNo]
|
||||||
|
);
|
||||||
|
|
||||||
|
vtkmesh->GetCellData()->AddArray(cdata);
|
||||||
|
cdata->Delete();
|
||||||
|
|
||||||
|
if (ptfPtr.valid())
|
||||||
|
{
|
||||||
|
convertPointField(vtkmesh, ptfPtr(), fld, decompLst[datasetNo]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
//
|
||||||
|
// point-fields
|
||||||
|
//
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::vtkPVFoam::convertPointFields
|
||||||
|
(
|
||||||
|
const pointMesh& pMesh,
|
||||||
|
const IOobjectList& objects,
|
||||||
|
vtkMultiBlockDataSet* output
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const polyMesh& mesh = pMesh.mesh();
|
||||||
|
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||||
|
|
||||||
|
forAllConstIter(IOobjectList, objects, iter)
|
||||||
|
{
|
||||||
|
const word& fieldName = iter()->name();
|
||||||
|
// restrict to this GeometricField<Type, ...>
|
||||||
|
if
|
||||||
|
(
|
||||||
|
iter()->headerClassName()
|
||||||
|
!= GeometricField<Type, pointPatchField, pointMesh>::typeName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "convertPointFields : " << fieldName << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
GeometricField<Type, pointPatchField, pointMesh> pfld(*iter(), pMesh);
|
||||||
|
|
||||||
|
|
||||||
|
// Convert activated internalMesh regions
|
||||||
|
convertPointFieldBlock
|
||||||
|
(
|
||||||
|
pfld,
|
||||||
|
output,
|
||||||
|
arrayRangeVolume_,
|
||||||
|
regionPolyDecomp_
|
||||||
|
);
|
||||||
|
|
||||||
|
// Convert activated cellZones
|
||||||
|
convertPointFieldBlock
|
||||||
|
(
|
||||||
|
pfld,
|
||||||
|
output,
|
||||||
|
arrayRangeCellZones_,
|
||||||
|
zonePolyDecomp_
|
||||||
|
);
|
||||||
|
|
||||||
|
// Convert activated cellSets
|
||||||
|
convertPointFieldBlock
|
||||||
|
(
|
||||||
|
pfld,
|
||||||
|
output,
|
||||||
|
arrayRangeCellSets_,
|
||||||
|
csetPolyDecomp_
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Convert patches - if activated
|
||||||
|
//
|
||||||
|
for
|
||||||
|
(
|
||||||
|
int partId = arrayRangePatches_.start();
|
||||||
|
partId < arrayRangePatches_.end();
|
||||||
|
++partId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const word patchName = getPartName(partId);
|
||||||
|
const label datasetNo = partDataset_[partId];
|
||||||
|
const label patchId = patches.findPatchID(patchName);
|
||||||
|
|
||||||
|
if (!partStatus_[partId] || patchId < 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkPolyData* vtkmesh = getDataFromBlock<vtkPolyData>
|
||||||
|
(
|
||||||
|
output, arrayRangePatches_, datasetNo
|
||||||
|
);
|
||||||
|
|
||||||
|
if (vtkmesh)
|
||||||
|
{
|
||||||
|
vtkFloatArray* pdata = convertFieldToVTK
|
||||||
|
(
|
||||||
|
fieldName,
|
||||||
|
pfld.boundaryField()[patchId].patchInternalField()()
|
||||||
|
);
|
||||||
|
|
||||||
|
vtkmesh->GetPointData()->AddArray(pdata);
|
||||||
|
pdata->Delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Convert faceZones - if activated
|
||||||
|
//
|
||||||
|
for
|
||||||
|
(
|
||||||
|
int partId = arrayRangeFaceZones_.start();
|
||||||
|
partId < arrayRangeFaceZones_.end();
|
||||||
|
++partId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const word zoneName = getPartName(partId);
|
||||||
|
const label datasetNo = partDataset_[partId];
|
||||||
|
const label zoneId = mesh.faceZones().findZoneID(zoneName);
|
||||||
|
|
||||||
|
if (!partStatus_[partId] || zoneId < 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkPolyData* vtkmesh = getDataFromBlock<vtkPolyData>
|
||||||
|
(
|
||||||
|
output, arrayRangeFaceZones_, datasetNo
|
||||||
|
);
|
||||||
|
|
||||||
|
if (vtkmesh)
|
||||||
|
{
|
||||||
|
// Extract the field on the zone
|
||||||
|
Field<Type> znfld
|
||||||
|
(
|
||||||
|
pfld.primitiveField(),
|
||||||
|
mesh.faceZones()[zoneId]().meshPoints()
|
||||||
|
);
|
||||||
|
|
||||||
|
vtkFloatArray* pdata = convertFieldToVTK(fieldName, znfld);
|
||||||
|
|
||||||
|
vtkmesh->GetPointData()->AddArray(pdata);
|
||||||
|
pdata->Delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::vtkPVFoam::convertPointFieldBlock
|
||||||
|
(
|
||||||
|
const GeometricField<Type, pointPatchField, pointMesh>& pfld,
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
const arrayRange& range,
|
||||||
|
const List<polyDecomp>& decompLst
|
||||||
|
)
|
||||||
|
{
|
||||||
|
for (int partId = range.start(); partId < range.end(); ++partId)
|
||||||
|
{
|
||||||
|
const label datasetNo = partDataset_[partId];
|
||||||
|
|
||||||
|
if (!partStatus_[partId])
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkUnstructuredGrid* vtkmesh = getDataFromBlock<vtkUnstructuredGrid>
|
||||||
|
(
|
||||||
|
output, range, datasetNo
|
||||||
|
);
|
||||||
|
|
||||||
|
if (vtkmesh)
|
||||||
|
{
|
||||||
|
convertPointField
|
||||||
|
(
|
||||||
|
vtkmesh,
|
||||||
|
pfld,
|
||||||
|
GeometricField<Type, fvPatchField, volMesh>::null(),
|
||||||
|
decompLst[datasetNo]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::vtkPVFoam::convertPointField
|
||||||
|
(
|
||||||
|
vtkUnstructuredGrid* vtkmesh,
|
||||||
|
const GeometricField<Type, pointPatchField, pointMesh>& pfld,
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& vfld,
|
||||||
|
const polyDecomp& decomp
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (!vtkmesh)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const label nComp = pTraits<Type>::nComponents;
|
||||||
|
const labelUList& addPointCellLabels = decomp.addPointCellLabels();
|
||||||
|
const labelUList& pointMap = decomp.pointMap();
|
||||||
|
|
||||||
|
// use a pointMap or address directly into mesh
|
||||||
|
const label nPoints = (pointMap.size() ? pointMap.size() : pfld.size());
|
||||||
|
|
||||||
|
vtkFloatArray* fldData = vtkFloatArray::New();
|
||||||
|
fldData->SetNumberOfTuples(nPoints + addPointCellLabels.size());
|
||||||
|
fldData->SetNumberOfComponents(nComp);
|
||||||
|
fldData->Allocate(nComp*(nPoints + addPointCellLabels.size()));
|
||||||
|
|
||||||
|
// Note: using the name of the original volField
|
||||||
|
// not the name generated by the interpolation "volPointInterpolate(<name>)"
|
||||||
|
|
||||||
|
if (&vfld != &GeometricField<Type, fvPatchField, volMesh>::null())
|
||||||
|
{
|
||||||
|
fldData->SetName(vfld.name().c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fldData->SetName(pfld.name().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "convert Point field: "
|
||||||
|
<< pfld.name()
|
||||||
|
<< " size=" << (nPoints + addPointCellLabels.size())
|
||||||
|
<< " (" << nPoints << " + " << addPointCellLabels.size()
|
||||||
|
<< ") nComp=" << nComp << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
float vec[nComp];
|
||||||
|
|
||||||
|
if (pointMap.size())
|
||||||
|
{
|
||||||
|
forAll(pointMap, i)
|
||||||
|
{
|
||||||
|
const Type& t = pfld[pointMap[i]];
|
||||||
|
for (direction d=0; d<nComp; ++d)
|
||||||
|
{
|
||||||
|
vec[d] = component(t, d);
|
||||||
|
}
|
||||||
|
foamPvFields::remapTuple<Type>(vec);
|
||||||
|
|
||||||
|
fldData->InsertTuple(i, vec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
forAll(pfld, i)
|
||||||
|
{
|
||||||
|
const Type& t = pfld[i];
|
||||||
|
for (direction d=0; d<nComp; ++d)
|
||||||
|
{
|
||||||
|
vec[d] = component(t, d);
|
||||||
|
}
|
||||||
|
foamPvFields::remapTuple<Type>(vec);
|
||||||
|
|
||||||
|
fldData->InsertTuple(i, vec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// continue insertion from here
|
||||||
|
label i = nPoints;
|
||||||
|
|
||||||
|
if (&vfld != &GeometricField<Type, fvPatchField, volMesh>::null())
|
||||||
|
{
|
||||||
|
forAll(addPointCellLabels, apI)
|
||||||
|
{
|
||||||
|
const Type& t = vfld[addPointCellLabels[apI]];
|
||||||
|
for (direction d=0; d<nComp; ++d)
|
||||||
|
{
|
||||||
|
vec[d] = component(t, d);
|
||||||
|
}
|
||||||
|
foamPvFields::remapTuple<Type>(vec);
|
||||||
|
|
||||||
|
fldData->InsertTuple(i++, vec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
forAll(addPointCellLabels, apI)
|
||||||
|
{
|
||||||
|
Type t = interpolatePointToCell(pfld, addPointCellLabels[apI]);
|
||||||
|
for (direction d=0; d<nComp; ++d)
|
||||||
|
{
|
||||||
|
vec[d] = component(t, d);
|
||||||
|
}
|
||||||
|
foamPvFields::remapTuple<Type>(vec);
|
||||||
|
|
||||||
|
fldData->InsertTuple(i++, vec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkmesh->GetPointData()->AddArray(fldData);
|
||||||
|
fldData->Delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
//
|
||||||
|
// lagrangian-fields
|
||||||
|
//
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::vtkPVFoam::convertLagrangianFields
|
||||||
|
(
|
||||||
|
const IOobjectList& objects,
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
const label datasetNo
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const arrayRange& range = arrayRangeLagrangian_;
|
||||||
|
|
||||||
|
forAllConstIter(IOobjectList, objects, iter)
|
||||||
|
{
|
||||||
|
// restrict to this IOField<Type>
|
||||||
|
if (iter()->headerClassName() == IOField<Type>::typeName)
|
||||||
|
{
|
||||||
|
vtkPolyData* vtkmesh =
|
||||||
|
getDataFromBlock<vtkPolyData>(output, range, datasetNo);
|
||||||
|
|
||||||
|
if (vtkmesh)
|
||||||
|
{
|
||||||
|
IOField<Type> fld(*iter());
|
||||||
|
|
||||||
|
vtkFloatArray* fldData = convertFieldToVTK(fld.name(), fld);
|
||||||
|
vtkmesh->GetPointData()->AddArray(fldData);
|
||||||
|
fldData->Delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
//
|
||||||
|
// low-level conversions
|
||||||
|
//
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
vtkFloatArray* Foam::vtkPVFoam::convertFieldToVTK
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const Field<Type>& fld
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "convert Field<" << pTraits<Type>::typeName << "> "
|
||||||
|
<< name
|
||||||
|
<< " size=" << fld.size()
|
||||||
|
<< " nComp=" << label(pTraits<Type>::nComponents) << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
const label nComp = pTraits<Type>::nComponents;
|
||||||
|
|
||||||
|
vtkFloatArray* fldData = vtkFloatArray::New();
|
||||||
|
fldData->SetNumberOfTuples(fld.size());
|
||||||
|
fldData->SetNumberOfComponents(nComp);
|
||||||
|
fldData->Allocate(nComp*fld.size());
|
||||||
|
fldData->SetName(name.c_str());
|
||||||
|
|
||||||
|
float vec[nComp];
|
||||||
|
forAll(fld, i)
|
||||||
|
{
|
||||||
|
const Type& t = fld[i];
|
||||||
|
for (direction d=0; d<nComp; ++d)
|
||||||
|
{
|
||||||
|
vec[d] = component(t, d);
|
||||||
|
}
|
||||||
|
foamPvFields::remapTuple<Type>(vec);
|
||||||
|
|
||||||
|
fldData->InsertTuple(i, vec);
|
||||||
|
}
|
||||||
|
|
||||||
|
return fldData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
vtkFloatArray* Foam::vtkPVFoam::convertFaceFieldToVTK
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& fld,
|
||||||
|
const labelUList& faceLabels
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "convert face field: "
|
||||||
|
<< fld.name()
|
||||||
|
<< " size=" << faceLabels.size()
|
||||||
|
<< " nComp=" << label(pTraits<Type>::nComponents) << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fvMesh& mesh = fld.mesh();
|
||||||
|
|
||||||
|
const label nComp = pTraits<Type>::nComponents;
|
||||||
|
const label nInternalFaces = mesh.nInternalFaces();
|
||||||
|
const labelList& faceOwner = mesh.faceOwner();
|
||||||
|
const labelList& faceNeigh = mesh.faceNeighbour();
|
||||||
|
|
||||||
|
vtkFloatArray* fldData = vtkFloatArray::New();
|
||||||
|
fldData->SetNumberOfTuples(faceLabels.size());
|
||||||
|
fldData->SetNumberOfComponents(nComp);
|
||||||
|
fldData->Allocate(nComp*faceLabels.size());
|
||||||
|
fldData->SetName(fld.name().c_str());
|
||||||
|
|
||||||
|
float vec[nComp];
|
||||||
|
|
||||||
|
// for interior faces: average owner/neighbour
|
||||||
|
// for boundary faces: owner
|
||||||
|
forAll(faceLabels, facei)
|
||||||
|
{
|
||||||
|
const label faceNo = faceLabels[facei];
|
||||||
|
if (faceNo < nInternalFaces)
|
||||||
|
{
|
||||||
|
Type t = 0.5*(fld[faceOwner[faceNo]] + fld[faceNeigh[faceNo]]);
|
||||||
|
|
||||||
|
for (direction d=0; d<nComp; ++d)
|
||||||
|
{
|
||||||
|
vec[d] = component(t, d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const Type& t = fld[faceOwner[faceNo]];
|
||||||
|
for (direction d=0; d<nComp; ++d)
|
||||||
|
{
|
||||||
|
vec[d] = component(t, d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foamPvFields::remapTuple<Type>(vec);
|
||||||
|
|
||||||
|
fldData->InsertTuple(facei, vec);
|
||||||
|
}
|
||||||
|
|
||||||
|
return fldData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
vtkFloatArray* Foam::vtkPVFoam::convertVolFieldToVTK
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& fld,
|
||||||
|
const polyDecomp& decompInfo
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const label nComp = pTraits<Type>::nComponents;
|
||||||
|
const labelList& superCells = decompInfo.superCells();
|
||||||
|
|
||||||
|
vtkFloatArray* fldData = vtkFloatArray::New();
|
||||||
|
fldData->SetNumberOfTuples(superCells.size());
|
||||||
|
fldData->SetNumberOfComponents(nComp);
|
||||||
|
fldData->Allocate(nComp*superCells.size());
|
||||||
|
fldData->SetName(fld.name().c_str());
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "convert volField: "
|
||||||
|
<< fld.name()
|
||||||
|
<< " size=" << superCells.size()
|
||||||
|
<< " (" << fld.size() << " + "
|
||||||
|
<< (superCells.size() - fld.size())
|
||||||
|
<< ") nComp=" << nComp << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
float vec[nComp];
|
||||||
|
forAll(superCells, i)
|
||||||
|
{
|
||||||
|
const Type& t = fld[superCells[i]];
|
||||||
|
for (direction d=0; d<nComp; ++d)
|
||||||
|
{
|
||||||
|
vec[d] = component(t, d);
|
||||||
|
}
|
||||||
|
foamPvFields::remapTuple<Type>(vec);
|
||||||
|
|
||||||
|
fldData->InsertTuple(i, vec);
|
||||||
|
}
|
||||||
|
|
||||||
|
return fldData;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#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) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -26,6 +26,7 @@ License
|
|||||||
#include "vtkPVFoam.H"
|
#include "vtkPVFoam.H"
|
||||||
|
|
||||||
// OpenFOAM includes
|
// OpenFOAM includes
|
||||||
|
#include "Cloud.H"
|
||||||
#include "IOobjectList.H"
|
#include "IOobjectList.H"
|
||||||
#include "vtkPVFoamReader.h"
|
#include "vtkPVFoamReader.h"
|
||||||
|
|
||||||
@ -34,29 +35,26 @@ License
|
|||||||
#include "vtkPolyData.h"
|
#include "vtkPolyData.h"
|
||||||
#include "vtkUnstructuredGrid.h"
|
#include "vtkUnstructuredGrid.h"
|
||||||
|
|
||||||
|
// Templates (only needed here)
|
||||||
|
#include "vtkPVFoamFieldTemplates.C"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#include "vtkPVFoamVolFields.H"
|
|
||||||
#include "vtkPVFoamPointFields.H"
|
|
||||||
#include "vtkPVFoamLagrangianFields.H"
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPVFoam::pruneObjectList
|
void Foam::vtkPVFoam::pruneObjectList
|
||||||
(
|
(
|
||||||
IOobjectList& objects,
|
IOobjectList& objects,
|
||||||
const wordHashSet& selected
|
const hashedWordList& retain
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// hash all the selected field names
|
if (retain.empty())
|
||||||
if (selected.empty())
|
|
||||||
{
|
{
|
||||||
objects.clear();
|
objects.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// only keep selected fields
|
// only retain specified fields
|
||||||
forAllIter(IOobjectList, objects, iter)
|
forAllIter(IOobjectList, objects, iter)
|
||||||
{
|
{
|
||||||
if (!selected.found(iter()->name()))
|
if (!retain.found(iter()->name()))
|
||||||
{
|
{
|
||||||
objects.erase(iter);
|
objects.erase(iter);
|
||||||
}
|
}
|
||||||
@ -71,7 +69,8 @@ void Foam::vtkPVFoam::convertVolFields
|
|||||||
{
|
{
|
||||||
const fvMesh& mesh = *meshPtr_;
|
const fvMesh& mesh = *meshPtr_;
|
||||||
|
|
||||||
wordHashSet selectedFields = getSelected
|
const bool interpFields = reader_->GetInterpolateVolFields();
|
||||||
|
hashedWordList selectedFields = getSelected
|
||||||
(
|
(
|
||||||
reader_->GetVolFieldSelection()
|
reader_->GetVolFieldSelection()
|
||||||
);
|
);
|
||||||
@ -93,80 +92,50 @@ void Foam::vtkPVFoam::convertVolFields
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVFoam::convertVolFields" << nl
|
Info<< "<beg> convert volume fields" << endl;
|
||||||
<< "converting OpenFOAM volume fields" << endl;
|
|
||||||
forAllConstIter(IOobjectList, objects, iter)
|
forAllConstIter(IOobjectList, objects, iter)
|
||||||
{
|
{
|
||||||
Info<< " " << iter()->name()
|
Info<< " " << iter()->name()
|
||||||
<< " == " << iter()->objectPath() << nl;
|
<< " == " << iter()->objectPath() << endl;
|
||||||
}
|
}
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PtrList<PrimitivePatchInterpolation<primitivePatch>>
|
PtrList<patchInterpolator> interpLst;
|
||||||
ppInterpList(mesh.boundaryMesh().size());
|
|
||||||
|
|
||||||
forAll(ppInterpList, i)
|
if (interpFields)
|
||||||
{
|
{
|
||||||
ppInterpList.set
|
interpLst.setSize(mesh.boundaryMesh().size());
|
||||||
(
|
|
||||||
i,
|
forAll(interpLst, i)
|
||||||
new PrimitivePatchInterpolation<primitivePatch>
|
{
|
||||||
|
interpLst.set
|
||||||
(
|
(
|
||||||
mesh.boundaryMesh()[i]
|
i,
|
||||||
)
|
new PrimitivePatchInterpolation<primitivePatch>
|
||||||
);
|
(
|
||||||
|
mesh.boundaryMesh()[i]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
convertVolFields<scalar>(mesh, interpLst, objects, output);
|
||||||
|
convertVolFields<vector>(mesh, interpLst, objects, output);
|
||||||
|
convertVolFields<sphericalTensor>(mesh, interpLst, objects, output);
|
||||||
|
convertVolFields<symmTensor>(mesh, interpLst, objects, output);
|
||||||
|
convertVolFields<tensor>(mesh, interpLst, objects, output);
|
||||||
|
|
||||||
bool interpFields = reader_->GetInterpolateVolFields();
|
convertDimFields<scalar>(mesh, interpLst, objects, output);
|
||||||
|
convertDimFields<vector>(mesh, interpLst, objects, output);
|
||||||
convertVolFields<scalar>
|
convertDimFields<sphericalTensor>(mesh, interpLst, objects, output);
|
||||||
(
|
convertDimFields<symmTensor>(mesh, interpLst, objects, output);
|
||||||
mesh, ppInterpList, objects, interpFields, output
|
convertDimFields<tensor>(mesh, interpLst, objects, output);
|
||||||
);
|
|
||||||
convertVolFields<vector>
|
|
||||||
(
|
|
||||||
mesh, ppInterpList, objects, interpFields, output
|
|
||||||
);
|
|
||||||
convertVolFields<sphericalTensor>
|
|
||||||
(
|
|
||||||
mesh, ppInterpList, objects, interpFields, output
|
|
||||||
);
|
|
||||||
convertVolFields<symmTensor>
|
|
||||||
(
|
|
||||||
mesh, ppInterpList, objects, interpFields, output
|
|
||||||
);
|
|
||||||
convertVolFields<tensor>
|
|
||||||
(
|
|
||||||
mesh, ppInterpList, objects, interpFields, output
|
|
||||||
);
|
|
||||||
|
|
||||||
convertDimFields<scalar>
|
|
||||||
(
|
|
||||||
mesh, ppInterpList, objects, interpFields, output
|
|
||||||
);
|
|
||||||
convertDimFields<vector>
|
|
||||||
(
|
|
||||||
mesh, ppInterpList, objects, interpFields, output
|
|
||||||
);
|
|
||||||
convertDimFields<sphericalTensor>
|
|
||||||
(
|
|
||||||
mesh, ppInterpList, objects, interpFields, output
|
|
||||||
);
|
|
||||||
convertDimFields<symmTensor>
|
|
||||||
(
|
|
||||||
mesh, ppInterpList, objects, interpFields, output
|
|
||||||
);
|
|
||||||
convertDimFields<tensor>
|
|
||||||
(
|
|
||||||
mesh, ppInterpList, objects, interpFields, output
|
|
||||||
);
|
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPVFoam::convertVolFields" << endl;
|
Info<< "<end> convert volume fields" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,7 +148,7 @@ void Foam::vtkPVFoam::convertPointFields
|
|||||||
{
|
{
|
||||||
const fvMesh& mesh = *meshPtr_;
|
const fvMesh& mesh = *meshPtr_;
|
||||||
|
|
||||||
wordHashSet selectedFields = getSelected
|
hashedWordList selectedFields = getSelected
|
||||||
(
|
(
|
||||||
reader_->GetPointFieldSelection()
|
reader_->GetPointFieldSelection()
|
||||||
);
|
);
|
||||||
@ -205,12 +174,11 @@ void Foam::vtkPVFoam::convertPointFields
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVFoam::convertPointFields" << nl
|
Info<< "<beg> convert volume -> point fields" << endl;
|
||||||
<< "converting OpenFOAM volume fields -> point fields" << endl;
|
|
||||||
forAllConstIter(IOobjectList, objects, iter)
|
forAllConstIter(IOobjectList, objects, iter)
|
||||||
{
|
{
|
||||||
Info<< " " << iter()->name()
|
Info<< " " << iter()->name()
|
||||||
<< " == " << iter()->objectPath() << nl;
|
<< " == " << iter()->objectPath() << endl;
|
||||||
}
|
}
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
@ -218,31 +186,15 @@ void Foam::vtkPVFoam::convertPointFields
|
|||||||
// Construct interpolation on the raw mesh
|
// Construct interpolation on the raw mesh
|
||||||
const pointMesh& pMesh = pointMesh::New(mesh);
|
const pointMesh& pMesh = pointMesh::New(mesh);
|
||||||
|
|
||||||
|
convertPointFields<scalar>(pMesh, objects, output);
|
||||||
convertPointFields<scalar>
|
convertPointFields<vector>(pMesh, objects, output);
|
||||||
(
|
convertPointFields<sphericalTensor>(pMesh, objects, output);
|
||||||
mesh, pMesh, objects, output
|
convertPointFields<symmTensor>(pMesh, objects, output);
|
||||||
);
|
convertPointFields<tensor>(pMesh, objects, output);
|
||||||
convertPointFields<vector>
|
|
||||||
(
|
|
||||||
mesh, pMesh, objects, output
|
|
||||||
);
|
|
||||||
convertPointFields<sphericalTensor>
|
|
||||||
(
|
|
||||||
mesh, pMesh, objects, output
|
|
||||||
);
|
|
||||||
convertPointFields<symmTensor>
|
|
||||||
(
|
|
||||||
mesh, pMesh, objects, output
|
|
||||||
);
|
|
||||||
convertPointFields<tensor>
|
|
||||||
(
|
|
||||||
mesh, pMesh, objects, output
|
|
||||||
);
|
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPVFoam::convertPointFields" << endl;
|
Info<< "<end> convert volume -> point fields" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -256,7 +208,7 @@ void Foam::vtkPVFoam::convertLagrangianFields
|
|||||||
arrayRange& range = arrayRangeLagrangian_;
|
arrayRange& range = arrayRangeLagrangian_;
|
||||||
const fvMesh& mesh = *meshPtr_;
|
const fvMesh& mesh = *meshPtr_;
|
||||||
|
|
||||||
wordHashSet selectedFields = getSelected
|
hashedWordList selectedFields = getSelected
|
||||||
(
|
(
|
||||||
reader_->GetLagrangianFieldSelection()
|
reader_->GetLagrangianFieldSelection()
|
||||||
);
|
);
|
||||||
@ -268,7 +220,7 @@ void Foam::vtkPVFoam::convertLagrangianFields
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVFoam::convertLagrangianFields" << endl;
|
Info<< "<beg> convert Lagrangian fields" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,7 +234,6 @@ void Foam::vtkPVFoam::convertLagrangianFields
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Get the Lagrangian fields for this time and this cloud
|
// Get the Lagrangian fields for this time and this cloud
|
||||||
// but only keep selected fields
|
// but only keep selected fields
|
||||||
// the region name is already in the mesh db
|
// the region name is already in the mesh db
|
||||||
@ -301,43 +252,25 @@ void Foam::vtkPVFoam::convertLagrangianFields
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "converting OpenFOAM lagrangian fields" << nl;
|
Info<< "converting OpenFOAM lagrangian fields" << endl;
|
||||||
forAllConstIter(IOobjectList, objects, iter)
|
forAllConstIter(IOobjectList, objects, iter)
|
||||||
{
|
{
|
||||||
Info<< " " << iter()->name()
|
Info<< " " << iter()->name()
|
||||||
<< " == " << iter()->objectPath() << nl;
|
<< " == " << iter()->objectPath() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
convertLagrangianFields<label>
|
convertLagrangianFields<label>(objects, output, datasetNo);
|
||||||
(
|
convertLagrangianFields<scalar>(objects, output, datasetNo);
|
||||||
objects, output, datasetNo
|
convertLagrangianFields<vector>(objects, output, datasetNo);
|
||||||
);
|
convertLagrangianFields<sphericalTensor>(objects, output, datasetNo);
|
||||||
convertLagrangianFields<scalar>
|
convertLagrangianFields<symmTensor>(objects, output, datasetNo);
|
||||||
(
|
convertLagrangianFields<tensor>(objects, output, datasetNo);
|
||||||
objects, output, datasetNo
|
|
||||||
);
|
|
||||||
convertLagrangianFields<vector>
|
|
||||||
(
|
|
||||||
objects, output, datasetNo
|
|
||||||
);
|
|
||||||
convertLagrangianFields<sphericalTensor>
|
|
||||||
(
|
|
||||||
objects, output, datasetNo
|
|
||||||
);
|
|
||||||
convertLagrangianFields<symmTensor>
|
|
||||||
(
|
|
||||||
objects, output, datasetNo
|
|
||||||
);
|
|
||||||
convertLagrangianFields<tensor>
|
|
||||||
(
|
|
||||||
objects, output, datasetNo
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPVFoam::convertLagrangianFields" << endl;
|
Info<< "<end> convert Lagrangian fields" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,113 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
||||||
\\/ 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/>.
|
|
||||||
|
|
||||||
InClass
|
|
||||||
vtkPVFoam
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef vtkPVFoamLagrangianFields_H
|
|
||||||
#define vtkPVFoamLagrangianFields_H
|
|
||||||
|
|
||||||
#include "Cloud.H"
|
|
||||||
|
|
||||||
#include "vtkOpenFOAMTupleRemap.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::vtkPVFoam::convertLagrangianFields
|
|
||||||
(
|
|
||||||
const IOobjectList& objects,
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const label datasetNo
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const arrayRange& range = arrayRangeLagrangian_;
|
|
||||||
|
|
||||||
forAllConstIter(IOobjectList, objects, iter)
|
|
||||||
{
|
|
||||||
// restrict to this IOField<Type>
|
|
||||||
if (iter()->headerClassName() == IOField<Type>::typeName)
|
|
||||||
{
|
|
||||||
IOField<Type> tf(*iter());
|
|
||||||
convertLagrangianField(tf, output, range, datasetNo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::vtkPVFoam::convertLagrangianField
|
|
||||||
(
|
|
||||||
const IOField<Type>& tf,
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const arrayRange& range,
|
|
||||||
const label datasetNo
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const label nComp = pTraits<Type>::nComponents;
|
|
||||||
|
|
||||||
vtkFloatArray* pointData = vtkFloatArray::New();
|
|
||||||
pointData->SetNumberOfTuples(tf.size());
|
|
||||||
pointData->SetNumberOfComponents(nComp);
|
|
||||||
pointData->Allocate(nComp*tf.size());
|
|
||||||
pointData->SetName(tf.name().c_str());
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "convert LagrangianField: "
|
|
||||||
<< tf.name()
|
|
||||||
<< " size = " << tf.size()
|
|
||||||
<< " nComp=" << nComp
|
|
||||||
<< " nTuples = " << tf.size() << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
float vec[nComp];
|
|
||||||
forAll(tf, i)
|
|
||||||
{
|
|
||||||
const Type& t = tf[i];
|
|
||||||
for (direction d=0; d<nComp; ++d)
|
|
||||||
{
|
|
||||||
vec[d] = component(t, d);
|
|
||||||
}
|
|
||||||
vtkOpenFOAMTupleRemap<Type>(vec);
|
|
||||||
|
|
||||||
pointData->InsertTuple(i, vec);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
vtkPolyData::SafeDownCast
|
|
||||||
(
|
|
||||||
GetDataSetFromBlock(output, range, datasetNo)
|
|
||||||
) ->GetPointData()
|
|
||||||
->AddArray(pointData);
|
|
||||||
|
|
||||||
pointData->Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#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) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -57,7 +57,7 @@ void Foam::vtkPVFoam::convertMeshVolume
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVFoam::convertMeshVolume" << endl;
|
Info<< "<beg> convertMeshVolume" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ void Foam::vtkPVFoam::convertMeshVolume
|
|||||||
|
|
||||||
if (vtkmesh)
|
if (vtkmesh)
|
||||||
{
|
{
|
||||||
AddToBlock(output, vtkmesh, range, datasetNo, partName);
|
addToBlock(output, vtkmesh, range, datasetNo, partName);
|
||||||
vtkmesh->Delete();
|
vtkmesh->Delete();
|
||||||
|
|
||||||
partDataset_[partId] = datasetNo++;
|
partDataset_[partId] = datasetNo++;
|
||||||
@ -95,7 +95,7 @@ void Foam::vtkPVFoam::convertMeshVolume
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPVFoam::convertMeshVolume" << endl;
|
Info<< "<end> convertMeshVolume" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -114,7 +114,7 @@ void Foam::vtkPVFoam::convertMeshLagrangian
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVFoam::convertMeshLagrangian" << endl;
|
Info<< "<beg> convertMeshLagrangian" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ void Foam::vtkPVFoam::convertMeshLagrangian
|
|||||||
|
|
||||||
if (vtkmesh)
|
if (vtkmesh)
|
||||||
{
|
{
|
||||||
AddToBlock(output, vtkmesh, range, datasetNo, cloudName);
|
addToBlock(output, vtkmesh, range, datasetNo, cloudName);
|
||||||
vtkmesh->Delete();
|
vtkmesh->Delete();
|
||||||
|
|
||||||
partDataset_[partId] = datasetNo++;
|
partDataset_[partId] = datasetNo++;
|
||||||
@ -146,7 +146,7 @@ void Foam::vtkPVFoam::convertMeshLagrangian
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPVFoam::convertMeshLagrangian" << endl;
|
Info<< "<end> convertMeshLagrangian" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -166,7 +166,7 @@ void Foam::vtkPVFoam::convertMeshPatches
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVFoam::convertMeshPatches" << endl;
|
Info<< "<beg> convertMeshPatches" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,26 +201,33 @@ void Foam::vtkPVFoam::convertMeshPatches
|
|||||||
{
|
{
|
||||||
sz += patches[iter.key()].size();
|
sz += patches[iter.key()].size();
|
||||||
}
|
}
|
||||||
labelList meshFaceLabels(sz);
|
labelList faceLabels(sz);
|
||||||
sz = 0;
|
sz = 0;
|
||||||
forAllConstIter(labelHashSet, patchIds, iter)
|
forAllConstIter(labelHashSet, patchIds, iter)
|
||||||
{
|
{
|
||||||
const polyPatch& pp = patches[iter.key()];
|
const polyPatch& pp = patches[iter.key()];
|
||||||
forAll(pp, i)
|
forAll(pp, i)
|
||||||
{
|
{
|
||||||
meshFaceLabels[sz++] = pp.start()+i;
|
faceLabels[sz++] = pp.start()+i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UIndirectList<face> fcs(mesh.faces(), meshFaceLabels);
|
|
||||||
uindirectPrimitivePatch pp(fcs, mesh.points());
|
uindirectPrimitivePatch pp
|
||||||
|
(
|
||||||
|
UIndirectList<face>
|
||||||
|
(
|
||||||
|
mesh.faces(),
|
||||||
|
faceLabels
|
||||||
|
),
|
||||||
|
mesh.points()
|
||||||
|
);
|
||||||
|
|
||||||
vtkmesh = patchVTKMesh(patchName, pp);
|
vtkmesh = patchVTKMesh(patchName, pp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (vtkmesh)
|
if (vtkmesh)
|
||||||
{
|
{
|
||||||
AddToBlock(output, vtkmesh, range, datasetNo, patchName);
|
addToBlock(output, vtkmesh, range, datasetNo, patchName);
|
||||||
vtkmesh->Delete();
|
vtkmesh->Delete();
|
||||||
|
|
||||||
partDataset_[partId] = datasetNo++;
|
partDataset_[partId] = datasetNo++;
|
||||||
@ -235,7 +242,7 @@ void Foam::vtkPVFoam::convertMeshPatches
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPVFoam::convertMeshPatches" << endl;
|
Info<< "<end> convertMeshPatches" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -262,7 +269,7 @@ void Foam::vtkPVFoam::convertMeshCellZones
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVFoam::convertMeshCellZones" << endl;
|
Info<< "<beg> convertMeshCellZones" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,7 +316,7 @@ void Foam::vtkPVFoam::convertMeshCellZones
|
|||||||
// copy pointMap as well, otherwise pointFields fail
|
// copy pointMap as well, otherwise pointFields fail
|
||||||
zonePolyDecomp_[datasetNo].pointMap() = subsetter.pointMap();
|
zonePolyDecomp_[datasetNo].pointMap() = subsetter.pointMap();
|
||||||
|
|
||||||
AddToBlock(output, vtkmesh, range, datasetNo, zoneName);
|
addToBlock(output, vtkmesh, range, datasetNo, zoneName);
|
||||||
vtkmesh->Delete();
|
vtkmesh->Delete();
|
||||||
|
|
||||||
partDataset_[partId] = datasetNo++;
|
partDataset_[partId] = datasetNo++;
|
||||||
@ -324,7 +331,7 @@ void Foam::vtkPVFoam::convertMeshCellZones
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPVFoam::convertMeshCellZones" << endl;
|
Info<< "<end> convertMeshCellZones" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -346,7 +353,7 @@ void Foam::vtkPVFoam::convertMeshCellSets
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVFoam::convertMeshCellSets" << endl;
|
Info<< "<beg> convertMeshCellSets" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -391,7 +398,7 @@ void Foam::vtkPVFoam::convertMeshCellSets
|
|||||||
// copy pointMap as well, otherwise pointFields fail
|
// copy pointMap as well, otherwise pointFields fail
|
||||||
csetPolyDecomp_[datasetNo].pointMap() = subsetter.pointMap();
|
csetPolyDecomp_[datasetNo].pointMap() = subsetter.pointMap();
|
||||||
|
|
||||||
AddToBlock(output, vtkmesh, range, datasetNo, partName);
|
addToBlock(output, vtkmesh, range, datasetNo, partName);
|
||||||
vtkmesh->Delete();
|
vtkmesh->Delete();
|
||||||
|
|
||||||
partDataset_[partId] = datasetNo++;
|
partDataset_[partId] = datasetNo++;
|
||||||
@ -406,7 +413,7 @@ void Foam::vtkPVFoam::convertMeshCellSets
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPVFoam::convertMeshCellSets" << endl;
|
Info<< "<end> convertMeshCellSets" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -430,7 +437,7 @@ void Foam::vtkPVFoam::convertMeshFaceZones
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVFoam::convertMeshFaceZones" << endl;
|
Info<< "<beg> convertMeshFaceZones" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -455,7 +462,7 @@ void Foam::vtkPVFoam::convertMeshFaceZones
|
|||||||
|
|
||||||
if (vtkmesh)
|
if (vtkmesh)
|
||||||
{
|
{
|
||||||
AddToBlock(output, vtkmesh, range, datasetNo, zoneName);
|
addToBlock(output, vtkmesh, range, datasetNo, zoneName);
|
||||||
vtkmesh->Delete();
|
vtkmesh->Delete();
|
||||||
|
|
||||||
partDataset_[partId] = datasetNo++;
|
partDataset_[partId] = datasetNo++;
|
||||||
@ -470,7 +477,7 @@ void Foam::vtkPVFoam::convertMeshFaceZones
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPVFoam::convertMeshFaceZones" << endl;
|
Info<< "<end> convertMeshFaceZones" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -489,7 +496,7 @@ void Foam::vtkPVFoam::convertMeshFaceSets
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVFoam::convertMeshFaceSets" << endl;
|
Info<< "<beg> convertMeshFaceSets" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -507,12 +514,26 @@ void Foam::vtkPVFoam::convertMeshFaceSets
|
|||||||
Info<< "Creating VTK mesh for faceSet=" << partName << endl;
|
Info<< "Creating VTK mesh for faceSet=" << partName << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
const faceSet fSet(mesh, partName);
|
// faces in sorted order for more reliability
|
||||||
|
uindirectPrimitivePatch p
|
||||||
|
(
|
||||||
|
UIndirectList<face>
|
||||||
|
(
|
||||||
|
mesh.faces(),
|
||||||
|
faceSet(mesh, partName).sortedToc()
|
||||||
|
),
|
||||||
|
mesh.points()
|
||||||
|
);
|
||||||
|
|
||||||
vtkPolyData* vtkmesh = faceSetVTKMesh(mesh, fSet);
|
if (p.empty())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkPolyData* vtkmesh = patchVTKMesh("faceSet:" + partName, p);
|
||||||
if (vtkmesh)
|
if (vtkmesh)
|
||||||
{
|
{
|
||||||
AddToBlock(output, vtkmesh, range, datasetNo, partName);
|
addToBlock(output, vtkmesh, range, datasetNo, partName);
|
||||||
vtkmesh->Delete();
|
vtkmesh->Delete();
|
||||||
|
|
||||||
partDataset_[partId] = datasetNo++;
|
partDataset_[partId] = datasetNo++;
|
||||||
@ -527,7 +548,7 @@ void Foam::vtkPVFoam::convertMeshFaceSets
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPVFoam::convertMeshFaceSets" << endl;
|
Info<< "<end> convertMeshFaceSets" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -546,7 +567,7 @@ void Foam::vtkPVFoam::convertMeshPointZones
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVFoam::convertMeshPointZones" << endl;
|
Info<< "<beg> convertMeshPointZones" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -563,10 +584,24 @@ void Foam::vtkPVFoam::convertMeshPointZones
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkPolyData* vtkmesh = pointZoneVTKMesh(mesh, zMesh[zoneId]);
|
const labelUList& pointLabels = zMesh[zoneId];
|
||||||
|
|
||||||
|
vtkPoints* vtkpoints = vtkPoints::New();
|
||||||
|
vtkpoints->Allocate(pointLabels.size());
|
||||||
|
|
||||||
|
const pointField& meshPoints = mesh.points();
|
||||||
|
forAll(pointLabels, pointi)
|
||||||
|
{
|
||||||
|
vtkpoints->InsertNextPoint(meshPoints[pointLabels[pointi]].v_);
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkPolyData* vtkmesh = vtkPolyData::New();
|
||||||
|
vtkmesh->SetPoints(vtkpoints);
|
||||||
|
vtkpoints->Delete();
|
||||||
|
|
||||||
if (vtkmesh)
|
if (vtkmesh)
|
||||||
{
|
{
|
||||||
AddToBlock(output, vtkmesh, range, datasetNo, zoneName);
|
addToBlock(output, vtkmesh, range, datasetNo, zoneName);
|
||||||
vtkmesh->Delete();
|
vtkmesh->Delete();
|
||||||
|
|
||||||
partDataset_[partId] = datasetNo++;
|
partDataset_[partId] = datasetNo++;
|
||||||
@ -582,7 +617,7 @@ void Foam::vtkPVFoam::convertMeshPointZones
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPVFoam::convertMeshPointZones" << endl;
|
Info<< "<end> convertMeshPointZones" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -602,7 +637,7 @@ void Foam::vtkPVFoam::convertMeshPointSets
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVFoam::convertMeshPointSets" << endl;
|
Info<< "<beg> convertMeshPointSets" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -622,10 +657,22 @@ void Foam::vtkPVFoam::convertMeshPointSets
|
|||||||
|
|
||||||
const pointSet pSet(mesh, partName);
|
const pointSet pSet(mesh, partName);
|
||||||
|
|
||||||
vtkPolyData* vtkmesh = pointSetVTKMesh(mesh, pSet);
|
vtkPoints* vtkpoints = vtkPoints::New();
|
||||||
|
vtkpoints->Allocate(pSet.size());
|
||||||
|
|
||||||
|
const pointField& meshPoints = mesh.points();
|
||||||
|
forAllConstIter(pointSet, pSet, iter)
|
||||||
|
{
|
||||||
|
vtkpoints->InsertNextPoint(meshPoints[iter.key()].v_);
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkPolyData* vtkmesh = vtkPolyData::New();
|
||||||
|
vtkmesh->SetPoints(vtkpoints);
|
||||||
|
vtkpoints->Delete();
|
||||||
|
|
||||||
if (vtkmesh)
|
if (vtkmesh)
|
||||||
{
|
{
|
||||||
AddToBlock(output, vtkmesh, range, datasetNo, partName);
|
addToBlock(output, vtkmesh, range, datasetNo, partName);
|
||||||
vtkmesh->Delete();
|
vtkmesh->Delete();
|
||||||
|
|
||||||
partDataset_[partId] = datasetNo++;
|
partDataset_[partId] = datasetNo++;
|
||||||
@ -640,7 +687,7 @@ void Foam::vtkPVFoam::convertMeshPointSets
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPVFoam::convertMeshPointSets" << endl;
|
Info<< "<end> convertMeshPointSets" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -30,7 +30,6 @@ License
|
|||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "IOobjectList.H"
|
#include "IOobjectList.H"
|
||||||
#include "passiveParticle.H"
|
#include "passiveParticle.H"
|
||||||
#include "vtkOpenFOAMPoints.H"
|
|
||||||
|
|
||||||
// VTK includes
|
// VTK includes
|
||||||
#include "vtkCellArray.h"
|
#include "vtkCellArray.h"
|
||||||
@ -41,7 +40,7 @@ License
|
|||||||
|
|
||||||
vtkPolyData* Foam::vtkPVFoam::lagrangianVTKMesh
|
vtkPolyData* Foam::vtkPVFoam::lagrangianVTKMesh
|
||||||
(
|
(
|
||||||
const fvMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const word& cloudName
|
const word& cloudName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -49,7 +48,7 @@ vtkPolyData* Foam::vtkPVFoam::lagrangianVTKMesh
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVFoam::lagrangianVTKMesh - timePath "
|
Info<< "<beg> lagrangianVTKMesh - timePath "
|
||||||
<< mesh.time().timePath()/cloud::prefix/cloudName << endl;
|
<< mesh.time().timePath()/cloud::prefix/cloudName << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
@ -83,7 +82,7 @@ vtkPolyData* Foam::vtkPVFoam::lagrangianVTKMesh
|
|||||||
vtkIdType particleId = 0;
|
vtkIdType particleId = 0;
|
||||||
forAllConstIter(Cloud<passiveParticle>, parcels, iter)
|
forAllConstIter(Cloud<passiveParticle>, parcels, iter)
|
||||||
{
|
{
|
||||||
vtkInsertNextOpenFOAMPoint(vtkpoints, iter().position());
|
vtkpoints->InsertNextPoint(iter().position().v_);
|
||||||
|
|
||||||
vtkcells->InsertNextCell(1, &particleId);
|
vtkcells->InsertNextCell(1, &particleId);
|
||||||
particleId++;
|
particleId++;
|
||||||
@ -98,7 +97,7 @@ vtkPolyData* Foam::vtkPVFoam::lagrangianVTKMesh
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPVFoam::lagrangianVTKMesh" << endl;
|
Info<< "<end> lagrangianVTKMesh" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,148 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
||||||
\\/ 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 "vtkPVFoam.H"
|
|
||||||
|
|
||||||
// OpenFOAM includes
|
|
||||||
#include "faceSet.H"
|
|
||||||
#include "pointSet.H"
|
|
||||||
#include "vtkOpenFOAMPoints.H"
|
|
||||||
|
|
||||||
// VTK includes
|
|
||||||
#include "vtkPoints.h"
|
|
||||||
#include "vtkPolyData.h"
|
|
||||||
#include "vtkCellArray.h"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
vtkPolyData* Foam::vtkPVFoam::faceSetVTKMesh
|
|
||||||
(
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const faceSet& fSet
|
|
||||||
)
|
|
||||||
{
|
|
||||||
vtkPolyData* vtkmesh = vtkPolyData::New();
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<beg> Foam::vtkPVFoam::faceSetVTKMesh" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Construct primitivePatch of faces in fSet.
|
|
||||||
|
|
||||||
const faceList& meshFaces = mesh.faces();
|
|
||||||
faceList patchFaces(fSet.size());
|
|
||||||
label facei = 0;
|
|
||||||
forAllConstIter(faceSet, fSet, iter)
|
|
||||||
{
|
|
||||||
patchFaces[facei++] = meshFaces[iter.key()];
|
|
||||||
}
|
|
||||||
primitiveFacePatch p(patchFaces, mesh.points());
|
|
||||||
|
|
||||||
|
|
||||||
// The balance of this routine should be identical to patchVTKMesh
|
|
||||||
|
|
||||||
// Convert OpenFOAM mesh vertices to VTK
|
|
||||||
const pointField& points = p.localPoints();
|
|
||||||
|
|
||||||
vtkPoints* vtkpoints = vtkPoints::New();
|
|
||||||
vtkpoints->Allocate(points.size());
|
|
||||||
forAll(points, i)
|
|
||||||
{
|
|
||||||
vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]);
|
|
||||||
}
|
|
||||||
vtkmesh->SetPoints(vtkpoints);
|
|
||||||
vtkpoints->Delete();
|
|
||||||
|
|
||||||
// Add faces as polygons
|
|
||||||
const faceList& faces = p.localFaces();
|
|
||||||
|
|
||||||
vtkCellArray* vtkcells = vtkCellArray::New();
|
|
||||||
vtkcells->Allocate(faces.size());
|
|
||||||
|
|
||||||
forAll(faces, facei)
|
|
||||||
{
|
|
||||||
const face& f = faces[facei];
|
|
||||||
vtkIdType nodeIds[f.size()];
|
|
||||||
|
|
||||||
forAll(f, fp)
|
|
||||||
{
|
|
||||||
nodeIds[fp] = f[fp];
|
|
||||||
}
|
|
||||||
vtkcells->InsertNextCell(f.size(), nodeIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkmesh->SetPolys(vtkcells);
|
|
||||||
vtkcells->Delete();
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<end> Foam::vtkPVFoam::faceSetVTKMesh" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
|
|
||||||
return vtkmesh;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
vtkPolyData* Foam::vtkPVFoam::pointSetVTKMesh
|
|
||||||
(
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const pointSet& pSet
|
|
||||||
)
|
|
||||||
{
|
|
||||||
vtkPolyData* vtkmesh = vtkPolyData::New();
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<beg> Foam::vtkPVFoam::pointSetVTKMesh" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
|
|
||||||
const pointField& meshPoints = mesh.points();
|
|
||||||
|
|
||||||
vtkPoints* vtkpoints = vtkPoints::New();
|
|
||||||
vtkpoints->Allocate(pSet.size());
|
|
||||||
|
|
||||||
forAllConstIter(pointSet, pSet, iter)
|
|
||||||
{
|
|
||||||
vtkInsertNextOpenFOAMPoint(vtkpoints, meshPoints[iter.key()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkmesh->SetPoints(vtkpoints);
|
|
||||||
vtkpoints->Delete();
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<end> Foam::vtkPVFoam::pointSetVTKMesh" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
|
|
||||||
return vtkmesh;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -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 | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -29,8 +29,6 @@ License
|
|||||||
// OpenFOAM includes
|
// OpenFOAM includes
|
||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "cellModeller.H"
|
#include "cellModeller.H"
|
||||||
#include "vtkOpenFOAMPoints.H"
|
|
||||||
#include "Swap.H"
|
|
||||||
|
|
||||||
// VTK includes
|
// VTK includes
|
||||||
#include "vtkCellArray.h"
|
#include "vtkCellArray.h"
|
||||||
@ -56,7 +54,7 @@ vtkUnstructuredGrid* Foam::vtkPVFoam::volumeVTKMesh
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVFoam::volumeVTKMesh" << endl;
|
Info<< "<beg> volumeVTKMesh" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,11 +76,6 @@ vtkUnstructuredGrid* Foam::vtkPVFoam::volumeVTKMesh
|
|||||||
// and cells
|
// and cells
|
||||||
if (!reader_->GetUseVTKPolyhedron())
|
if (!reader_->GetUseVTKPolyhedron())
|
||||||
{
|
{
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "... scanning for polyhedra" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
forAll(cellShapes, celli)
|
forAll(cellShapes, celli)
|
||||||
{
|
{
|
||||||
const cellModel& model = cellShapes[celli].model();
|
const cellModel& model = cellShapes[celli].model();
|
||||||
@ -123,21 +116,8 @@ vtkUnstructuredGrid* Foam::vtkPVFoam::volumeVTKMesh
|
|||||||
// Set size of additional cells mapping array
|
// Set size of additional cells mapping array
|
||||||
// (from added cell to original cell)
|
// (from added cell to original cell)
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<<" mesh nCells = " << mesh.nCells() << nl
|
|
||||||
<<" nPoints = " << mesh.nPoints() << nl
|
|
||||||
<<" nAddCells = " << nAddCells << nl
|
|
||||||
<<" nAddPoints = " << nAddPoints << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
superCells.setSize(mesh.nCells() + nAddCells);
|
superCells.setSize(mesh.nCells() + nAddCells);
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "... converting points" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert OpenFOAM mesh vertices to VTK
|
// Convert OpenFOAM mesh vertices to VTK
|
||||||
vtkPoints* vtkpoints = vtkPoints::New();
|
vtkPoints* vtkpoints = vtkPoints::New();
|
||||||
vtkpoints->Allocate(mesh.nPoints() + nAddPoints);
|
vtkpoints->Allocate(mesh.nPoints() + nAddPoints);
|
||||||
@ -146,13 +126,7 @@ vtkUnstructuredGrid* Foam::vtkPVFoam::volumeVTKMesh
|
|||||||
|
|
||||||
forAll(points, i)
|
forAll(points, i)
|
||||||
{
|
{
|
||||||
vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]);
|
vtkpoints->InsertNextPoint(points[i].v_);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "... converting cells" << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkmesh->Allocate(mesh.nCells() + nAddCells);
|
vtkmesh->Allocate(mesh.nCells() + nAddCells);
|
||||||
@ -329,7 +303,7 @@ vtkUnstructuredGrid* Foam::vtkPVFoam::volumeVTKMesh
|
|||||||
|
|
||||||
// The new vertex from the cell-centre
|
// The new vertex from the cell-centre
|
||||||
const label newVertexLabel = mesh.nPoints() + addPointi;
|
const label newVertexLabel = mesh.nPoints() + addPointi;
|
||||||
vtkInsertNextOpenFOAMPoint(vtkpoints, mesh.C()[celli]);
|
vtkpoints->InsertNextPoint(mesh.C()[celli].v_);
|
||||||
|
|
||||||
// Whether to insert cell in place of original or not.
|
// Whether to insert cell in place of original or not.
|
||||||
bool substituteCell = true;
|
bool substituteCell = true;
|
||||||
@ -441,7 +415,10 @@ vtkUnstructuredGrid* Foam::vtkPVFoam::volumeVTKMesh
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPVFoam::volumeVTKMesh" << endl;
|
Info<<"nCells=" << mesh.nCells() <<" nPoints=" << mesh.nPoints()
|
||||||
|
<<" nAddCells=" << nAddCells <<" nAddPoints=" << nAddPoints
|
||||||
|
<< nl
|
||||||
|
<< "<end> volumeVTKMesh" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,75 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
||||||
\\/ 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 "vtkPVFoam.H"
|
|
||||||
|
|
||||||
// OpenFOAM includes
|
|
||||||
#include "vtkOpenFOAMPoints.H"
|
|
||||||
|
|
||||||
// VTK includes
|
|
||||||
#include "vtkPoints.h"
|
|
||||||
#include "vtkPolyData.h"
|
|
||||||
#include "vtkCellArray.h"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
vtkPolyData* Foam::vtkPVFoam::pointZoneVTKMesh
|
|
||||||
(
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const labelList& pointLabels
|
|
||||||
)
|
|
||||||
{
|
|
||||||
vtkPolyData* vtkmesh = vtkPolyData::New();
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<beg> Foam::vtkPVFoam::pointZoneVTKMesh" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
|
|
||||||
const pointField& meshPoints = mesh.points();
|
|
||||||
|
|
||||||
vtkPoints* vtkpoints = vtkPoints::New();
|
|
||||||
vtkpoints->Allocate(pointLabels.size());
|
|
||||||
|
|
||||||
forAll(pointLabels, pointi)
|
|
||||||
{
|
|
||||||
vtkInsertNextOpenFOAMPoint(vtkpoints, meshPoints[pointLabels[pointi]]);
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkmesh->SetPoints(vtkpoints);
|
|
||||||
vtkpoints->Delete();
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<beg> Foam::vtkPVFoam::pointZoneVTKMesh" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
|
|
||||||
return vtkmesh;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,129 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
||||||
\\/ 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/>.
|
|
||||||
|
|
||||||
InClass
|
|
||||||
vtkPVFoam
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef vtkPVFoamPatchField_H
|
|
||||||
#define vtkPVFoamPatchField_H
|
|
||||||
|
|
||||||
// VTK includes
|
|
||||||
#include "vtkCellData.h"
|
|
||||||
#include "vtkFloatArray.h"
|
|
||||||
#include "vtkMultiBlockDataSet.h"
|
|
||||||
#include "vtkPointData.h"
|
|
||||||
#include "vtkPolyData.h"
|
|
||||||
|
|
||||||
#include "vtkOpenFOAMTupleRemap.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::vtkPVFoam::convertPatchField
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const Field<Type>& ptf,
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const arrayRange& range,
|
|
||||||
const label datasetNo
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const label nComp = pTraits<Type>::nComponents;
|
|
||||||
|
|
||||||
vtkFloatArray* cellData = vtkFloatArray::New();
|
|
||||||
cellData->SetNumberOfTuples(ptf.size());
|
|
||||||
cellData->SetNumberOfComponents(nComp);
|
|
||||||
cellData->Allocate(nComp*ptf.size());
|
|
||||||
cellData->SetName(name.c_str());
|
|
||||||
|
|
||||||
float vec[nComp];
|
|
||||||
forAll(ptf, i)
|
|
||||||
{
|
|
||||||
const Type& t = ptf[i];
|
|
||||||
for (direction d=0; d<nComp; ++d)
|
|
||||||
{
|
|
||||||
vec[d] = component(t, d);
|
|
||||||
}
|
|
||||||
vtkOpenFOAMTupleRemap<Type>(vec);
|
|
||||||
|
|
||||||
cellData->InsertTuple(i, vec);
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkPolyData::SafeDownCast
|
|
||||||
(
|
|
||||||
GetDataSetFromBlock(output, range, datasetNo)
|
|
||||||
) ->GetCellData()
|
|
||||||
->AddArray(cellData);
|
|
||||||
|
|
||||||
cellData->Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// as above, but with PointData()
|
|
||||||
template<class Type>
|
|
||||||
void Foam::vtkPVFoam::convertPatchPointField
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const Field<Type>& pptf,
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const arrayRange& range,
|
|
||||||
const label datasetNo
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const label nComp = pTraits<Type>::nComponents;
|
|
||||||
|
|
||||||
vtkFloatArray* pointData = vtkFloatArray::New();
|
|
||||||
pointData->SetNumberOfTuples(pptf.size());
|
|
||||||
pointData->SetNumberOfComponents(nComp);
|
|
||||||
pointData->Allocate(nComp*pptf.size());
|
|
||||||
pointData->SetName(name.c_str());
|
|
||||||
|
|
||||||
float vec[nComp];
|
|
||||||
forAll(pptf, i)
|
|
||||||
{
|
|
||||||
const Type& t = pptf[i];
|
|
||||||
for (direction d=0; d<nComp; ++d)
|
|
||||||
{
|
|
||||||
vec[d] = component(t, d);
|
|
||||||
}
|
|
||||||
vtkOpenFOAMTupleRemap<Type>(vec);
|
|
||||||
|
|
||||||
pointData->InsertTuple(i, vec);
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkPolyData::SafeDownCast
|
|
||||||
(
|
|
||||||
GetDataSetFromBlock(output, range, datasetNo)
|
|
||||||
) ->GetPointData()
|
|
||||||
->AddArray(pointData);
|
|
||||||
|
|
||||||
pointData->Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,331 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
||||||
\\/ 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/>.
|
|
||||||
|
|
||||||
InClass
|
|
||||||
vtkPVFoam
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef vtkPVFoamPointFields_H
|
|
||||||
#define vtkPVFoamPointFields_H
|
|
||||||
|
|
||||||
// OpenFOAM includes
|
|
||||||
#include "interpolatePointToCell.H"
|
|
||||||
|
|
||||||
#include "vtkOpenFOAMTupleRemap.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::vtkPVFoam::convertPointFields
|
|
||||||
(
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const pointMesh& pMesh,
|
|
||||||
const IOobjectList& objects,
|
|
||||||
vtkMultiBlockDataSet* output
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
|
||||||
|
|
||||||
forAllConstIter(IOobjectList, objects, iter)
|
|
||||||
{
|
|
||||||
const word& fieldName = iter()->name();
|
|
||||||
// restrict to this GeometricField<Type, ...>
|
|
||||||
if
|
|
||||||
(
|
|
||||||
iter()->headerClassName()
|
|
||||||
!= GeometricField<Type, pointPatchField, pointMesh>::typeName
|
|
||||||
)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Foam::vtkPVFoam::convertPointFields : "
|
|
||||||
<< fieldName << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
GeometricField<Type, pointPatchField, pointMesh> ptf
|
|
||||||
(
|
|
||||||
*iter(),
|
|
||||||
pMesh
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// Convert activated internalMesh regions
|
|
||||||
convertPointFieldBlock
|
|
||||||
(
|
|
||||||
ptf,
|
|
||||||
output,
|
|
||||||
arrayRangeVolume_,
|
|
||||||
regionPolyDecomp_
|
|
||||||
);
|
|
||||||
|
|
||||||
// Convert activated cellZones
|
|
||||||
convertPointFieldBlock
|
|
||||||
(
|
|
||||||
ptf,
|
|
||||||
output,
|
|
||||||
arrayRangeCellZones_,
|
|
||||||
zonePolyDecomp_
|
|
||||||
);
|
|
||||||
|
|
||||||
// Convert activated cellSets
|
|
||||||
convertPointFieldBlock
|
|
||||||
(
|
|
||||||
ptf,
|
|
||||||
output,
|
|
||||||
arrayRangeCellSets_,
|
|
||||||
csetPolyDecomp_
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Convert patches - if activated
|
|
||||||
//
|
|
||||||
for
|
|
||||||
(
|
|
||||||
int partId = arrayRangePatches_.start();
|
|
||||||
partId < arrayRangePatches_.end();
|
|
||||||
++partId
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const word patchName = getPartName(partId);
|
|
||||||
const label datasetNo = partDataset_[partId];
|
|
||||||
const label patchId = patches.findPatchID(patchName);
|
|
||||||
|
|
||||||
if (!partStatus_[partId] || datasetNo < 0 || patchId < 0)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
convertPatchPointField
|
|
||||||
(
|
|
||||||
fieldName,
|
|
||||||
ptf.boundaryField()[patchId].patchInternalField()(),
|
|
||||||
output,
|
|
||||||
arrayRangePatches_,
|
|
||||||
datasetNo
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Convert faceZones - if activated
|
|
||||||
//
|
|
||||||
for
|
|
||||||
(
|
|
||||||
int partId = arrayRangeFaceZones_.start();
|
|
||||||
partId < arrayRangeFaceZones_.end();
|
|
||||||
++partId
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const word zoneName = getPartName(partId);
|
|
||||||
const label datasetNo = partDataset_[partId];
|
|
||||||
const label zoneId = mesh.faceZones().findZoneID(zoneName);
|
|
||||||
|
|
||||||
if (!partStatus_[partId] || datasetNo < 0 || zoneId < 0)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Extract the field on the zone
|
|
||||||
Field<Type> fld
|
|
||||||
(
|
|
||||||
ptf.primitiveField(),
|
|
||||||
mesh.faceZones()[zoneId]().meshPoints()
|
|
||||||
);
|
|
||||||
|
|
||||||
convertPatchPointField
|
|
||||||
(
|
|
||||||
fieldName,
|
|
||||||
fld,
|
|
||||||
output,
|
|
||||||
arrayRangeFaceZones_,
|
|
||||||
datasetNo
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::vtkPVFoam::convertPointFieldBlock
|
|
||||||
(
|
|
||||||
const GeometricField<Type, pointPatchField, pointMesh>& ptf,
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const arrayRange& range,
|
|
||||||
const List<polyDecomp>& decompLst
|
|
||||||
)
|
|
||||||
{
|
|
||||||
for (int partId = range.start(); partId < range.end(); ++partId)
|
|
||||||
{
|
|
||||||
const label datasetNo = partDataset_[partId];
|
|
||||||
|
|
||||||
if (datasetNo >= 0 && partStatus_[partId])
|
|
||||||
{
|
|
||||||
convertPointField
|
|
||||||
(
|
|
||||||
ptf,
|
|
||||||
GeometricField<Type, fvPatchField, volMesh>::null(),
|
|
||||||
output,
|
|
||||||
range,
|
|
||||||
datasetNo,
|
|
||||||
decompLst[datasetNo]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::vtkPVFoam::convertPointField
|
|
||||||
(
|
|
||||||
const GeometricField<Type, pointPatchField, pointMesh>& ptf,
|
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& tf,
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const arrayRange& range,
|
|
||||||
const label datasetNo,
|
|
||||||
const polyDecomp& decomp
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const label nComp = pTraits<Type>::nComponents;
|
|
||||||
const labelList& addPointCellLabels = decomp.addPointCellLabels();
|
|
||||||
const labelList& pointMap = decomp.pointMap();
|
|
||||||
|
|
||||||
// use a pointMap or address directly into mesh
|
|
||||||
label nPoints;
|
|
||||||
if (pointMap.size())
|
|
||||||
{
|
|
||||||
nPoints = pointMap.size();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nPoints = ptf.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkFloatArray* pointData = vtkFloatArray::New();
|
|
||||||
pointData->SetNumberOfTuples(nPoints + addPointCellLabels.size());
|
|
||||||
pointData->SetNumberOfComponents(nComp);
|
|
||||||
pointData->Allocate(nComp*(nPoints + addPointCellLabels.size()));
|
|
||||||
|
|
||||||
// Note: using the name of the original volField
|
|
||||||
// not the name generated by the interpolation "volPointInterpolate(<name>)"
|
|
||||||
|
|
||||||
if (&tf != &GeometricField<Type, fvPatchField, volMesh>::null())
|
|
||||||
{
|
|
||||||
pointData->SetName(tf.name().c_str());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pointData->SetName(ptf.name().c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "convert convertPointField: "
|
|
||||||
<< ptf.name()
|
|
||||||
<< " size = " << nPoints
|
|
||||||
<< " nComp=" << nComp
|
|
||||||
<< " nTuples = " << (nPoints + addPointCellLabels.size())
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
float vec[nComp];
|
|
||||||
|
|
||||||
if (pointMap.size())
|
|
||||||
{
|
|
||||||
forAll(pointMap, i)
|
|
||||||
{
|
|
||||||
const Type& t = ptf[pointMap[i]];
|
|
||||||
for (direction d=0; d<nComp; ++d)
|
|
||||||
{
|
|
||||||
vec[d] = component(t, d);
|
|
||||||
}
|
|
||||||
vtkOpenFOAMTupleRemap<Type>(vec);
|
|
||||||
|
|
||||||
pointData->InsertTuple(i, vec);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
forAll(ptf, i)
|
|
||||||
{
|
|
||||||
const Type& t = ptf[i];
|
|
||||||
for (direction d=0; d<nComp; ++d)
|
|
||||||
{
|
|
||||||
vec[d] = component(t, d);
|
|
||||||
}
|
|
||||||
vtkOpenFOAMTupleRemap<Type>(vec);
|
|
||||||
|
|
||||||
pointData->InsertTuple(i, vec);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// continue insertion from here
|
|
||||||
label i = nPoints;
|
|
||||||
|
|
||||||
if (&tf != &GeometricField<Type, fvPatchField, volMesh>::null())
|
|
||||||
{
|
|
||||||
forAll(addPointCellLabels, apI)
|
|
||||||
{
|
|
||||||
const Type& t = tf[addPointCellLabels[apI]];
|
|
||||||
for (direction d=0; d<nComp; ++d)
|
|
||||||
{
|
|
||||||
vec[d] = component(t, d);
|
|
||||||
}
|
|
||||||
vtkOpenFOAMTupleRemap<Type>(vec);
|
|
||||||
|
|
||||||
pointData->InsertTuple(i++, vec);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
forAll(addPointCellLabels, apI)
|
|
||||||
{
|
|
||||||
Type t = interpolatePointToCell(ptf, addPointCellLabels[apI]);
|
|
||||||
for (direction d=0; d<nComp; ++d)
|
|
||||||
{
|
|
||||||
vec[d] = component(t, d);
|
|
||||||
}
|
|
||||||
vtkOpenFOAMTupleRemap<Type>(vec);
|
|
||||||
|
|
||||||
pointData->InsertTuple(i++, vec);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkUnstructuredGrid::SafeDownCast
|
|
||||||
(
|
|
||||||
GetDataSetFromBlock(output, range, datasetNo)
|
|
||||||
) ->GetPointData()
|
|
||||||
->AddArray(pointData);
|
|
||||||
|
|
||||||
pointData->Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#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) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -28,7 +28,6 @@ License
|
|||||||
// OpenFOAM includes
|
// OpenFOAM includes
|
||||||
#include "polyPatch.H"
|
#include "polyPatch.H"
|
||||||
#include "primitivePatch.H"
|
#include "primitivePatch.H"
|
||||||
#include "vtkOpenFOAMPoints.H"
|
|
||||||
|
|
||||||
// VTK includes
|
// VTK includes
|
||||||
#include "vtkCellArray.h"
|
#include "vtkCellArray.h"
|
||||||
@ -48,7 +47,7 @@ vtkPolyData* Foam::vtkPVFoam::patchVTKMesh
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVFoam::patchVTKMesh - " << name << endl;
|
Info<< "<beg> patchVTKMesh - " << name << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,13 +58,12 @@ vtkPolyData* Foam::vtkPVFoam::patchVTKMesh
|
|||||||
vtkpoints->Allocate(points.size());
|
vtkpoints->Allocate(points.size());
|
||||||
forAll(points, i)
|
forAll(points, i)
|
||||||
{
|
{
|
||||||
vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]);
|
vtkpoints->InsertNextPoint(points[i].v_);
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkmesh->SetPoints(vtkpoints);
|
vtkmesh->SetPoints(vtkpoints);
|
||||||
vtkpoints->Delete();
|
vtkpoints->Delete();
|
||||||
|
|
||||||
|
|
||||||
// Add faces as polygons
|
// Add faces as polygons
|
||||||
const faceList& faces = p.localFaces();
|
const faceList& faces = p.localFaces();
|
||||||
|
|
||||||
@ -88,7 +86,7 @@ vtkPolyData* Foam::vtkPVFoam::patchVTKMesh
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPVFoam::patchVTKMesh - " << name << endl;
|
Info<< "<end> patchVTKMesh - " << name << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -36,13 +36,12 @@ License
|
|||||||
#include "Cloud.H"
|
#include "Cloud.H"
|
||||||
#include "vtkPVFoamReader.h"
|
#include "vtkPVFoamReader.h"
|
||||||
|
|
||||||
// local headers
|
|
||||||
#include "vtkPVFoamAddToSelection.H"
|
|
||||||
#include "vtkPVFoamUpdateInfoFields.H"
|
|
||||||
|
|
||||||
// VTK includes
|
// VTK includes
|
||||||
#include "vtkDataArraySelection.h"
|
#include "vtkDataArraySelection.h"
|
||||||
|
|
||||||
|
// Templates (only needed here)
|
||||||
|
#include "vtkPVFoamUpdateTemplates.C"
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Private Classes * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Private Classes * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -85,14 +84,14 @@ template<class ZoneType>
|
|||||||
Foam::wordList Foam::vtkPVFoam::getZoneNames
|
Foam::wordList Foam::vtkPVFoam::getZoneNames
|
||||||
(
|
(
|
||||||
const ZoneMesh<ZoneType, polyMesh>& zmesh
|
const ZoneMesh<ZoneType, polyMesh>& zmesh
|
||||||
) const
|
)
|
||||||
{
|
{
|
||||||
wordList names(zmesh.size());
|
wordList names(zmesh.size());
|
||||||
label nZone = 0;
|
label nZone = 0;
|
||||||
|
|
||||||
forAll(zmesh, zoneI)
|
forAll(zmesh, zoneI)
|
||||||
{
|
{
|
||||||
if (zmesh[zoneI].size())
|
if (!zmesh[zoneI].empty())
|
||||||
{
|
{
|
||||||
names[nZone++] = zmesh[zoneI].name();
|
names[nZone++] = zmesh[zoneI].name();
|
||||||
}
|
}
|
||||||
@ -124,7 +123,7 @@ Foam::wordList Foam::vtkPVFoam::getZoneNames(const word& zoneType) const
|
|||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
if (ioObj.typeHeaderOk<cellZoneMesh>(false))
|
if (ioObj.typeHeaderOk<cellZoneMesh>(false, false))
|
||||||
{
|
{
|
||||||
zonesEntries zones(ioObj);
|
zonesEntries zones(ioObj);
|
||||||
|
|
||||||
@ -146,7 +145,7 @@ void Foam::vtkPVFoam::updateInfoInternalMesh
|
|||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVFoam::updateInfoInternalMesh" << endl;
|
Info<< "<beg> updateInfoInternalMesh" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine mesh parts (internalMesh, patches...)
|
// Determine mesh parts (internalMesh, patches...)
|
||||||
@ -160,10 +159,7 @@ void Foam::vtkPVFoam::updateInfoInternalMesh
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
// just for debug info
|
Info<< "<end> updateInfoInternalMesh" << endl;
|
||||||
getSelectedArrayEntries(arraySelection);
|
|
||||||
|
|
||||||
Info<< "<end> Foam::vtkPVFoam::updateInfoInternalMesh" << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,7 +171,7 @@ void Foam::vtkPVFoam::updateInfoLagrangian
|
|||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVFoam::updateInfoLagrangian" << nl
|
Info<< "<beg> updateInfoLagrangian" << nl
|
||||||
<< " " << dbPtr_->timePath()/cloud::prefix << endl;
|
<< " " << dbPtr_->timePath()/cloud::prefix << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,10 +207,7 @@ void Foam::vtkPVFoam::updateInfoLagrangian
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
// just for debug info
|
Info<< "<end> updateInfoLagrangian" << endl;
|
||||||
getSelectedArrayEntries(arraySelection);
|
|
||||||
|
|
||||||
Info<< "<end> Foam::vtkPVFoam::updateInfoLagrangian" << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,8 +220,8 @@ void Foam::vtkPVFoam::updateInfoPatches
|
|||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVFoam::updateInfoPatches"
|
Info<< "<beg> updateInfoPatches"
|
||||||
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "]" << endl;
|
<< " [meshPtr=" << (meshPtr_ ? "set" : "null") << "]" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -333,7 +326,7 @@ void Foam::vtkPVFoam::updateInfoPatches
|
|||||||
);
|
);
|
||||||
|
|
||||||
// this should only ever fail if the mesh region doesn't exist
|
// this should only ever fail if the mesh region doesn't exist
|
||||||
if (ioObj.typeHeaderOk<polyBoundaryMesh>(true))
|
if (ioObj.typeHeaderOk<polyBoundaryMesh>(true, false))
|
||||||
{
|
{
|
||||||
polyBoundaryMeshEntries patchEntries(ioObj);
|
polyBoundaryMeshEntries patchEntries(ioObj);
|
||||||
|
|
||||||
@ -377,7 +370,7 @@ void Foam::vtkPVFoam::updateInfoPatches
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
groups.insert(groupNames[groupI], labelList(1, patchi));
|
groups.insert(groupNames[groupI], labelList{patchi});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -455,10 +448,7 @@ void Foam::vtkPVFoam::updateInfoPatches
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
// just for debug info
|
Info<< "<end> updateInfoPatches" << endl;
|
||||||
getSelectedArrayEntries(arraySelection);
|
|
||||||
|
|
||||||
Info<< "<end> Foam::vtkPVFoam::updateInfoPatches" << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -475,8 +465,8 @@ void Foam::vtkPVFoam::updateInfoZones
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVFoam::updateInfoZones"
|
Info<< "<beg> updateInfoZones"
|
||||||
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "]" << endl;
|
<< " [meshPtr=" << (meshPtr_ ? "set" : "null") << "]" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
wordList namesLst;
|
wordList namesLst;
|
||||||
@ -551,10 +541,7 @@ void Foam::vtkPVFoam::updateInfoZones
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
// just for debug info
|
Info<< "<end> updateInfoZones" << endl;
|
||||||
getSelectedArrayEntries(arraySelection);
|
|
||||||
|
|
||||||
Info<< "<end> Foam::vtkPVFoam::updateInfoZones" << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -571,7 +558,7 @@ void Foam::vtkPVFoam::updateInfoSets
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVFoam::updateInfoSets" << endl;
|
Info<< "<beg> updateInfoSets" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add names of sets. Search for last time directory with a sets
|
// Add names of sets. Search for last time directory with a sets
|
||||||
@ -596,7 +583,7 @@ void Foam::vtkPVFoam::updateInfoSets
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< " Foam::vtkPVFoam::updateInfoSets read "
|
Info<< " updateInfoSets read "
|
||||||
<< objects.names() << " from " << setsInstance << endl;
|
<< objects.names() << " from " << setsInstance << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -627,28 +614,41 @@ void Foam::vtkPVFoam::updateInfoSets
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
// just for debug info
|
Info<< "<end> updateInfoSets" << endl;
|
||||||
getSelectedArrayEntries(arraySelection);
|
|
||||||
|
|
||||||
Info<< "<end> Foam::vtkPVFoam::updateInfoSets" << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPVFoam::updateInfoLagrangianFields()
|
void Foam::vtkPVFoam::updateInfoFields()
|
||||||
|
{
|
||||||
|
updateInfoFields<fvPatchField, volMesh>
|
||||||
|
(
|
||||||
|
reader_->GetVolFieldSelection()
|
||||||
|
);
|
||||||
|
updateInfoFields<pointPatchField, pointMesh>
|
||||||
|
(
|
||||||
|
reader_->GetPointFieldSelection()
|
||||||
|
);
|
||||||
|
updateInfoLagrangianFields
|
||||||
|
(
|
||||||
|
reader_->GetLagrangianFieldSelection()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::vtkPVFoam::updateInfoLagrangianFields
|
||||||
|
(
|
||||||
|
vtkDataArraySelection* select
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVFoam::updateInfoLagrangianFields"
|
Info<< "<beg> updateInfoLagrangianFields" << endl;
|
||||||
<< endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkDataArraySelection* fieldSelection =
|
|
||||||
reader_->GetLagrangianFieldSelection();
|
|
||||||
|
|
||||||
// preserve the enabled selections
|
// preserve the enabled selections
|
||||||
stringList enabledEntries = getSelectedArrayEntries(fieldSelection);
|
stringList enabledEntries = getSelectedArrayEntries(select);
|
||||||
fieldSelection->RemoveAllArrays();
|
select->RemoveAllArrays();
|
||||||
|
|
||||||
// TODO - currently only get fields from ONE cloud
|
// TODO - currently only get fields from ONE cloud
|
||||||
// have to decide if the second set of fields get mixed in
|
// have to decide if the second set of fields get mixed in
|
||||||
@ -678,44 +678,37 @@ void Foam::vtkPVFoam::updateInfoLagrangianFields()
|
|||||||
lagrangianPrefix/cloudName
|
lagrangianPrefix/cloudName
|
||||||
);
|
);
|
||||||
|
|
||||||
addToSelection<IOField<label>>
|
addToSelection<IOField<label>>(select, objects);
|
||||||
(
|
addToSelection<IOField<scalar>>(select, objects);
|
||||||
fieldSelection,
|
addToSelection<IOField<vector>>(select, objects);
|
||||||
objects
|
addToSelection<IOField<sphericalTensor>>(select, objects);
|
||||||
);
|
addToSelection<IOField<symmTensor>>(select, objects);
|
||||||
addToSelection<IOField<scalar>>
|
addToSelection<IOField<tensor>>(select, objects);
|
||||||
(
|
|
||||||
fieldSelection,
|
|
||||||
objects
|
|
||||||
);
|
|
||||||
addToSelection<IOField<vector>>
|
|
||||||
(
|
|
||||||
fieldSelection,
|
|
||||||
objects
|
|
||||||
);
|
|
||||||
addToSelection<IOField<sphericalTensor>>
|
|
||||||
(
|
|
||||||
fieldSelection,
|
|
||||||
|
|
||||||
objects
|
|
||||||
);
|
|
||||||
addToSelection<IOField<symmTensor>>
|
|
||||||
(
|
|
||||||
fieldSelection,
|
|
||||||
objects
|
|
||||||
);
|
|
||||||
addToSelection<IOField<tensor>>
|
|
||||||
(
|
|
||||||
fieldSelection,
|
|
||||||
objects
|
|
||||||
);
|
|
||||||
|
|
||||||
// restore the enabled selections
|
// restore the enabled selections
|
||||||
setSelectedArrayEntries(fieldSelection, enabledEntries);
|
setSelectedArrayEntries(select, enabledEntries);
|
||||||
|
|
||||||
|
if (debug > 1)
|
||||||
|
{
|
||||||
|
boolList status;
|
||||||
|
const label nElem = getSelected(status, select);
|
||||||
|
|
||||||
|
forAll(status, i)
|
||||||
|
{
|
||||||
|
Info<< " lagrangian[" << i << "] = "
|
||||||
|
<< status[i]
|
||||||
|
<< " : " << select->GetArrayName(i) << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!nElem)
|
||||||
|
{
|
||||||
|
Info<< " lagrangian[none]" << nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPVFoam::updateInfoLagrangianFields - "
|
Info<< "<end> updateInfoLagrangianFields - "
|
||||||
<< "lagrangian objects.size() = " << objects.size() << endl;
|
<< "lagrangian objects.size() = " << objects.size() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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 | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -26,8 +26,8 @@ InClass
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef vtkPVFoamUpdateInfoFields_H
|
#ifndef vtkPVFoamUpdateTemplates_C
|
||||||
#define vtkPVFoamUpdateInfoFields_H
|
#define vtkPVFoamUpdateTemplates_C
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -39,19 +39,17 @@ void Foam::vtkPVFoam::updateInfoFields
|
|||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVFoam::updateInfoFields <"
|
Info<< "<beg> updateInfoFields <"
|
||||||
<< meshType::Mesh::typeName
|
<< meshType::Mesh::typeName
|
||||||
<< "> [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "]"
|
<< "> [meshPtr=" << (meshPtr_ ? "set" : "null") << "]"
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
stringList enabledEntries;
|
stringList enabledEntries;
|
||||||
// enable 'p' and 'U' on the first call
|
if (!select->GetNumberOfArrays() && !meshPtr_)
|
||||||
if (select->GetNumberOfArrays() == 0 && !meshPtr_)
|
|
||||||
{
|
{
|
||||||
enabledEntries.setSize(2);
|
// enable 'p' and 'U' only on the first call
|
||||||
enabledEntries[0] = "p";
|
enabledEntries = { "p", "U" };
|
||||||
enabledEntries[1] = "U";
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -72,7 +70,7 @@ void Foam::vtkPVFoam::updateInfoFields
|
|||||||
// Search for list of objects for this time and mesh region
|
// Search for list of objects for this time and mesh region
|
||||||
IOobjectList objects(dbPtr_(), dbPtr_().timeName(), regionPrefix);
|
IOobjectList objects(dbPtr_(), dbPtr_().timeName(), regionPrefix);
|
||||||
|
|
||||||
//- Add volume fields to GUI
|
// Add volume fields to GUI
|
||||||
addToSelection<GeometricField<scalar, patchType, meshType>>
|
addToSelection<GeometricField<scalar, patchType, meshType>>
|
||||||
(
|
(
|
||||||
select,
|
select,
|
||||||
@ -93,13 +91,14 @@ void Foam::vtkPVFoam::updateInfoFields
|
|||||||
select,
|
select,
|
||||||
objects
|
objects
|
||||||
);
|
);
|
||||||
|
|
||||||
addToSelection<GeometricField<tensor, patchType, meshType>>
|
addToSelection<GeometricField<tensor, patchType, meshType>>
|
||||||
(
|
(
|
||||||
select,
|
select,
|
||||||
objects
|
objects
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Add dimensioned fields to GUI
|
// Add dimensioned fields to GUI
|
||||||
addToSelection<DimensionedField<scalar, meshType>>
|
addToSelection<DimensionedField<scalar, meshType>>
|
||||||
(
|
(
|
||||||
select,
|
select,
|
||||||
@ -132,7 +131,7 @@ void Foam::vtkPVFoam::updateInfoFields
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPVFoam::updateInfoFields" << endl;
|
Info<< "<end> updateInfoFields" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1,340 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
||||||
\\/ 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/>.
|
|
||||||
|
|
||||||
Description
|
|
||||||
Misc helper methods and utilities
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "vtkPVFoam.H"
|
|
||||||
#include "vtkPVFoamReader.h"
|
|
||||||
|
|
||||||
// OpenFOAM includes
|
|
||||||
#include "fvMesh.H"
|
|
||||||
#include "Time.H"
|
|
||||||
#include "IFstream.H"
|
|
||||||
#include "memInfo.H"
|
|
||||||
|
|
||||||
// VTK includes
|
|
||||||
#include "vtkDataArraySelection.h"
|
|
||||||
#include "vtkDataSet.h"
|
|
||||||
#include "vtkMultiBlockDataSet.h"
|
|
||||||
#include "vtkInformation.h"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
//! \cond fileScope
|
|
||||||
// Extract up to the first non-word characters
|
|
||||||
inline word getFirstWord(const char* str)
|
|
||||||
{
|
|
||||||
if (str)
|
|
||||||
{
|
|
||||||
label n = 0;
|
|
||||||
while (str[n] && word::valid(str[n]))
|
|
||||||
{
|
|
||||||
++n;
|
|
||||||
}
|
|
||||||
return word(str, n, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return word::null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
//! \endcond
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
|
||||||
|
|
||||||
void Foam::vtkPVFoam::AddToBlock
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
vtkDataSet* dataset,
|
|
||||||
const arrayRange& range,
|
|
||||||
const label datasetNo,
|
|
||||||
const std::string& datasetName
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const int blockNo = range.block();
|
|
||||||
|
|
||||||
vtkDataObject* blockDO = output->GetBlock(blockNo);
|
|
||||||
vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
|
|
||||||
|
|
||||||
if (!block)
|
|
||||||
{
|
|
||||||
if (blockDO)
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "Block already has a vtkDataSet assigned to it"
|
|
||||||
<< endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
block = vtkMultiBlockDataSet::New();
|
|
||||||
output->SetBlock(blockNo, block);
|
|
||||||
block->Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "block[" << blockNo << "] has "
|
|
||||||
<< block->GetNumberOfBlocks()
|
|
||||||
<< " datasets prior to adding set " << datasetNo
|
|
||||||
<< " with name: " << datasetName << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
block->SetBlock(datasetNo, dataset);
|
|
||||||
|
|
||||||
// name the block when assigning dataset 0
|
|
||||||
if (datasetNo == 0)
|
|
||||||
{
|
|
||||||
output->GetMetaData(blockNo)->Set
|
|
||||||
(
|
|
||||||
vtkCompositeDataSet::NAME(),
|
|
||||||
range.name()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (datasetName.size())
|
|
||||||
{
|
|
||||||
block->GetMetaData(datasetNo)->Set
|
|
||||||
(
|
|
||||||
vtkCompositeDataSet::NAME(),
|
|
||||||
datasetName.c_str()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
vtkDataSet* Foam::vtkPVFoam::GetDataSetFromBlock
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const arrayRange& range,
|
|
||||||
const label datasetNo
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const int blockNo = range.block();
|
|
||||||
|
|
||||||
vtkDataObject* blockDO = output->GetBlock(blockNo);
|
|
||||||
vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
|
|
||||||
|
|
||||||
if (block)
|
|
||||||
{
|
|
||||||
return vtkDataSet::SafeDownCast(block->GetBlock(datasetNo));
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ununsed at the moment
|
|
||||||
Foam::label Foam::vtkPVFoam::GetNumberOfDataSets
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const arrayRange& range
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const int blockNo = range.block();
|
|
||||||
|
|
||||||
vtkDataObject* blockDO = output->GetBlock(blockNo);
|
|
||||||
vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
|
|
||||||
if (block)
|
|
||||||
{
|
|
||||||
return block->GetNumberOfBlocks();
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::word Foam::vtkPVFoam::getPartName(const int partId)
|
|
||||||
{
|
|
||||||
return getFirstWord(reader_->GetPartArrayName(partId));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::wordHashSet Foam::vtkPVFoam::getSelected
|
|
||||||
(
|
|
||||||
vtkDataArraySelection* select
|
|
||||||
)
|
|
||||||
{
|
|
||||||
int nElem = select->GetNumberOfArrays();
|
|
||||||
wordHashSet selections(2*nElem);
|
|
||||||
|
|
||||||
for (int elemI=0; elemI < nElem; ++elemI)
|
|
||||||
{
|
|
||||||
if (select->GetArraySetting(elemI))
|
|
||||||
{
|
|
||||||
selections.insert(getFirstWord(select->GetArrayName(elemI)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return selections;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::wordHashSet Foam::vtkPVFoam::getSelected
|
|
||||||
(
|
|
||||||
vtkDataArraySelection* select,
|
|
||||||
const arrayRange& range
|
|
||||||
)
|
|
||||||
{
|
|
||||||
int nElem = select->GetNumberOfArrays();
|
|
||||||
wordHashSet selections(2*nElem);
|
|
||||||
|
|
||||||
for (int elemI = range.start(); elemI < range.end(); ++elemI)
|
|
||||||
{
|
|
||||||
if (select->GetArraySetting(elemI))
|
|
||||||
{
|
|
||||||
selections.insert(getFirstWord(select->GetArrayName(elemI)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return selections;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::stringList Foam::vtkPVFoam::getSelectedArrayEntries
|
|
||||||
(
|
|
||||||
vtkDataArraySelection* select
|
|
||||||
)
|
|
||||||
{
|
|
||||||
stringList selections(select->GetNumberOfArrays());
|
|
||||||
label nElem = 0;
|
|
||||||
|
|
||||||
forAll(selections, elemI)
|
|
||||||
{
|
|
||||||
if (select->GetArraySetting(elemI))
|
|
||||||
{
|
|
||||||
selections[nElem++] = select->GetArrayName(elemI);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
selections.setSize(nElem);
|
|
||||||
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
label nElem = select->GetNumberOfArrays();
|
|
||||||
Info<< "available(";
|
|
||||||
for (int elemI = 0; elemI < nElem; ++elemI)
|
|
||||||
{
|
|
||||||
Info<< " \"" << select->GetArrayName(elemI) << "\"";
|
|
||||||
}
|
|
||||||
Info<< " )\nselected(";
|
|
||||||
|
|
||||||
forAll(selections, elemI)
|
|
||||||
{
|
|
||||||
Info<< " " << selections[elemI];
|
|
||||||
}
|
|
||||||
Info<< " )\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
return selections;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::stringList Foam::vtkPVFoam::getSelectedArrayEntries
|
|
||||||
(
|
|
||||||
vtkDataArraySelection* select,
|
|
||||||
const arrayRange& range
|
|
||||||
)
|
|
||||||
{
|
|
||||||
stringList selections(range.size());
|
|
||||||
label nElem = 0;
|
|
||||||
|
|
||||||
for (int elemI = range.start(); elemI < range.end(); ++elemI)
|
|
||||||
{
|
|
||||||
if (select->GetArraySetting(elemI))
|
|
||||||
{
|
|
||||||
selections[nElem++] = select->GetArrayName(elemI);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
selections.setSize(nElem);
|
|
||||||
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "available(";
|
|
||||||
for (int elemI = range.start(); elemI < range.end(); ++elemI)
|
|
||||||
{
|
|
||||||
Info<< " \"" << select->GetArrayName(elemI) << "\"";
|
|
||||||
}
|
|
||||||
Info<< " )\nselected(";
|
|
||||||
|
|
||||||
forAll(selections, elemI)
|
|
||||||
{
|
|
||||||
Info<< " " << selections[elemI];
|
|
||||||
}
|
|
||||||
Info<< " )\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
return selections;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPVFoam::setSelectedArrayEntries
|
|
||||||
(
|
|
||||||
vtkDataArraySelection* select,
|
|
||||||
const stringList& selections
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const int nElem = select->GetNumberOfArrays();
|
|
||||||
select->DisableAllArrays();
|
|
||||||
|
|
||||||
// Loop through entries, setting values from selectedEntries
|
|
||||||
for (int elemI=0; elemI < nElem; ++elemI)
|
|
||||||
{
|
|
||||||
string arrayName(select->GetArrayName(elemI));
|
|
||||||
|
|
||||||
forAll(selections, elemI)
|
|
||||||
{
|
|
||||||
if (selections[elemI] == arrayName)
|
|
||||||
{
|
|
||||||
select->EnableArray(arrayName.c_str());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
void Foam::vtkPVFoam::printMemory()
|
|
||||||
{
|
|
||||||
memInfo mem;
|
|
||||||
|
|
||||||
if (mem.valid())
|
|
||||||
{
|
|
||||||
Info<< "mem peak/size/rss: " << mem << "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,456 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
||||||
\\/ 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/>.
|
|
||||||
|
|
||||||
InClass
|
|
||||||
vtkPVFoam
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef vtkPVFoamVolFields_H
|
|
||||||
#define vtkPVFoamVolFields_H
|
|
||||||
|
|
||||||
// OpenFOAM includes
|
|
||||||
#include "emptyFvPatchField.H"
|
|
||||||
#include "wallPolyPatch.H"
|
|
||||||
#include "faceSet.H"
|
|
||||||
#include "volPointInterpolation.H"
|
|
||||||
#include "zeroGradientFvPatchField.H"
|
|
||||||
|
|
||||||
#include "vtkPVFoamFaceField.H"
|
|
||||||
#include "vtkPVFoamPatchField.H"
|
|
||||||
|
|
||||||
#include "vtkOpenFOAMTupleRemap.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::vtkPVFoam::convertVolField
|
|
||||||
(
|
|
||||||
const PtrList<PrimitivePatchInterpolation<primitivePatch>>& ppInterpList,
|
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& tf,
|
|
||||||
const bool interpFields,
|
|
||||||
vtkMultiBlockDataSet* output
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const fvMesh& mesh = tf.mesh();
|
|
||||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
|
||||||
|
|
||||||
// Interpolated field (demand driven)
|
|
||||||
autoPtr<GeometricField<Type, pointPatchField, pointMesh>> ptfPtr;
|
|
||||||
if (interpFields)
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "convertVolFieldBlock interpolating:" << tf.name()
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
ptfPtr.reset
|
|
||||||
(
|
|
||||||
volPointInterpolation::New(mesh).interpolate(tf).ptr()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert activated internalMesh regions
|
|
||||||
convertVolFieldBlock
|
|
||||||
(
|
|
||||||
tf,
|
|
||||||
ptfPtr,
|
|
||||||
output,
|
|
||||||
arrayRangeVolume_,
|
|
||||||
regionPolyDecomp_
|
|
||||||
);
|
|
||||||
|
|
||||||
// Convert activated cellZones
|
|
||||||
convertVolFieldBlock
|
|
||||||
(
|
|
||||||
tf,
|
|
||||||
ptfPtr,
|
|
||||||
output,
|
|
||||||
arrayRangeCellZones_,
|
|
||||||
zonePolyDecomp_
|
|
||||||
);
|
|
||||||
|
|
||||||
// Convert activated cellSets
|
|
||||||
convertVolFieldBlock
|
|
||||||
(
|
|
||||||
tf,
|
|
||||||
ptfPtr,
|
|
||||||
output,
|
|
||||||
arrayRangeCellSets_,
|
|
||||||
csetPolyDecomp_
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Convert patches - if activated
|
|
||||||
//
|
|
||||||
for
|
|
||||||
(
|
|
||||||
int partId = arrayRangePatches_.start();
|
|
||||||
partId < arrayRangePatches_.end();
|
|
||||||
++partId
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const word patchName = getPartName(partId);
|
|
||||||
const label datasetNo = partDataset_[partId];
|
|
||||||
const label patchId = patches.findPatchID(patchName);
|
|
||||||
|
|
||||||
if (!partStatus_[partId] || datasetNo < 0 || patchId < 0)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const fvPatchField<Type>& ptf = tf.boundaryField()[patchId];
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
isType<emptyFvPatchField<Type>>(ptf)
|
|
||||||
||
|
|
||||||
(
|
|
||||||
reader_->GetExtrapolatePatches()
|
|
||||||
&& !polyPatch::constraintType(patches[patchId].type())
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
fvPatch p(ptf.patch().patch(), mesh.boundary());
|
|
||||||
|
|
||||||
tmp<Field<Type>> tpptf
|
|
||||||
(
|
|
||||||
fvPatchField<Type>(p, tf).patchInternalField()
|
|
||||||
);
|
|
||||||
|
|
||||||
convertPatchField
|
|
||||||
(
|
|
||||||
tf.name(),
|
|
||||||
tpptf(),
|
|
||||||
output,
|
|
||||||
arrayRangePatches_,
|
|
||||||
datasetNo
|
|
||||||
);
|
|
||||||
|
|
||||||
if (interpFields)
|
|
||||||
{
|
|
||||||
convertPatchPointField
|
|
||||||
(
|
|
||||||
tf.name(),
|
|
||||||
ppInterpList[patchId].faceToPointInterpolate(tpptf)(),
|
|
||||||
output,
|
|
||||||
arrayRangePatches_,
|
|
||||||
datasetNo
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
convertPatchField
|
|
||||||
(
|
|
||||||
tf.name(),
|
|
||||||
ptf,
|
|
||||||
output,
|
|
||||||
arrayRangePatches_,
|
|
||||||
datasetNo
|
|
||||||
);
|
|
||||||
|
|
||||||
if (interpFields)
|
|
||||||
{
|
|
||||||
convertPatchPointField
|
|
||||||
(
|
|
||||||
tf.name(),
|
|
||||||
ppInterpList[patchId].faceToPointInterpolate(ptf)(),
|
|
||||||
output,
|
|
||||||
arrayRangePatches_,
|
|
||||||
datasetNo
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Convert face zones - if activated
|
|
||||||
//
|
|
||||||
for
|
|
||||||
(
|
|
||||||
int partId = arrayRangeFaceZones_.start();
|
|
||||||
partId < arrayRangeFaceZones_.end();
|
|
||||||
++partId
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const word zoneName = getPartName(partId);
|
|
||||||
const label datasetNo = partDataset_[partId];
|
|
||||||
|
|
||||||
if (!partStatus_[partId] || datasetNo < 0)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const faceZoneMesh& zMesh = mesh.faceZones();
|
|
||||||
const label zoneId = zMesh.findZoneID(zoneName);
|
|
||||||
|
|
||||||
if (zoneId < 0)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
convertFaceField
|
|
||||||
(
|
|
||||||
tf,
|
|
||||||
output,
|
|
||||||
arrayRangeFaceZones_,
|
|
||||||
datasetNo,
|
|
||||||
mesh,
|
|
||||||
zMesh[zoneId]
|
|
||||||
);
|
|
||||||
|
|
||||||
// TODO: points
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Convert face sets - if activated
|
|
||||||
//
|
|
||||||
for
|
|
||||||
(
|
|
||||||
int partId = arrayRangeFaceSets_.start();
|
|
||||||
partId < arrayRangeFaceSets_.end();
|
|
||||||
++partId
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const word selectName = getPartName(partId);
|
|
||||||
const label datasetNo = partDataset_[partId];
|
|
||||||
|
|
||||||
if (!partStatus_[partId] || datasetNo < 0)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const faceSet fSet(mesh, selectName);
|
|
||||||
|
|
||||||
convertFaceField
|
|
||||||
(
|
|
||||||
tf,
|
|
||||||
output,
|
|
||||||
arrayRangeFaceSets_,
|
|
||||||
datasetNo,
|
|
||||||
mesh,
|
|
||||||
fSet.toc()
|
|
||||||
);
|
|
||||||
|
|
||||||
// TODO: points
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::vtkPVFoam::convertVolFields
|
|
||||||
(
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const PtrList<PrimitivePatchInterpolation<primitivePatch>>& ppInterpList,
|
|
||||||
const IOobjectList& objects,
|
|
||||||
const bool interpFields,
|
|
||||||
vtkMultiBlockDataSet* output
|
|
||||||
)
|
|
||||||
{
|
|
||||||
forAllConstIter(IOobjectList, objects, iter)
|
|
||||||
{
|
|
||||||
// restrict to GeometricField<Type, ...>
|
|
||||||
if
|
|
||||||
(
|
|
||||||
iter()->headerClassName()
|
|
||||||
!= GeometricField<Type, fvPatchField, volMesh>::typeName
|
|
||||||
)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load field
|
|
||||||
GeometricField<Type, fvPatchField, volMesh> tf
|
|
||||||
(
|
|
||||||
*iter(),
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
// Convert
|
|
||||||
convertVolField(ppInterpList, tf, interpFields, output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::vtkPVFoam::convertDimFields
|
|
||||||
(
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const PtrList<PrimitivePatchInterpolation<primitivePatch>>& ppInterpList,
|
|
||||||
const IOobjectList& objects,
|
|
||||||
const bool interpFields,
|
|
||||||
vtkMultiBlockDataSet* output
|
|
||||||
)
|
|
||||||
{
|
|
||||||
forAllConstIter(IOobjectList, objects, iter)
|
|
||||||
{
|
|
||||||
// restrict to DimensionedField<Type, ...>
|
|
||||||
if
|
|
||||||
(
|
|
||||||
iter()->headerClassName()
|
|
||||||
!= DimensionedField<Type, volMesh>::typeName
|
|
||||||
)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load field
|
|
||||||
DimensionedField<Type, volMesh> dimFld(*iter(), mesh);
|
|
||||||
|
|
||||||
|
|
||||||
// Construct volField with zero-gradient patch fields
|
|
||||||
|
|
||||||
IOobject io(dimFld);
|
|
||||||
io.readOpt() = IOobject::NO_READ;
|
|
||||||
|
|
||||||
PtrList<fvPatchField<Type>> patchFields(mesh.boundary().size());
|
|
||||||
forAll(patchFields, patchI)
|
|
||||||
{
|
|
||||||
patchFields.set
|
|
||||||
(
|
|
||||||
patchI,
|
|
||||||
fvPatchField<Type>::New
|
|
||||||
(
|
|
||||||
zeroGradientFvPatchField<scalar>::typeName,
|
|
||||||
mesh.boundary()[patchI],
|
|
||||||
dimFld
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
GeometricField<Type, fvPatchField, volMesh> volFld
|
|
||||||
(
|
|
||||||
io,
|
|
||||||
dimFld.mesh(),
|
|
||||||
dimFld.dimensions(),
|
|
||||||
dimFld,
|
|
||||||
patchFields
|
|
||||||
);
|
|
||||||
volFld.correctBoundaryConditions();
|
|
||||||
|
|
||||||
convertVolField(ppInterpList, volFld, interpFields, output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::vtkPVFoam::convertVolFieldBlock
|
|
||||||
(
|
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& tf,
|
|
||||||
autoPtr<GeometricField<Type, pointPatchField, pointMesh>>& ptfPtr,
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const arrayRange& range,
|
|
||||||
const List<polyDecomp>& decompLst
|
|
||||||
)
|
|
||||||
{
|
|
||||||
for (int partId = range.start(); partId < range.end(); ++partId)
|
|
||||||
{
|
|
||||||
const label datasetNo = partDataset_[partId];
|
|
||||||
|
|
||||||
if (datasetNo >= 0 && partStatus_[partId])
|
|
||||||
{
|
|
||||||
convertVolField
|
|
||||||
(
|
|
||||||
tf,
|
|
||||||
output,
|
|
||||||
range,
|
|
||||||
datasetNo,
|
|
||||||
decompLst[datasetNo]
|
|
||||||
);
|
|
||||||
|
|
||||||
if (ptfPtr.valid())
|
|
||||||
{
|
|
||||||
convertPointField
|
|
||||||
(
|
|
||||||
ptfPtr(),
|
|
||||||
tf,
|
|
||||||
output,
|
|
||||||
range,
|
|
||||||
datasetNo,
|
|
||||||
decompLst[datasetNo]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::vtkPVFoam::convertVolField
|
|
||||||
(
|
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& tf,
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const arrayRange& range,
|
|
||||||
const label datasetNo,
|
|
||||||
const polyDecomp& decompInfo
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const label nComp = pTraits<Type>::nComponents;
|
|
||||||
const labelList& superCells = decompInfo.superCells();
|
|
||||||
|
|
||||||
vtkFloatArray* celldata = vtkFloatArray::New();
|
|
||||||
celldata->SetNumberOfTuples(superCells.size());
|
|
||||||
celldata->SetNumberOfComponents(nComp);
|
|
||||||
celldata->Allocate(nComp*superCells.size());
|
|
||||||
celldata->SetName(tf.name().c_str());
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "convert volField: "
|
|
||||||
<< tf.name()
|
|
||||||
<< " size = " << tf.size()
|
|
||||||
<< " nComp=" << nComp
|
|
||||||
<< " nTuples = " << superCells.size() << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
float vec[nComp];
|
|
||||||
forAll(superCells, i)
|
|
||||||
{
|
|
||||||
const Type& t = tf[superCells[i]];
|
|
||||||
for (direction d=0; d<nComp; ++d)
|
|
||||||
{
|
|
||||||
vec[d] = component(t, d);
|
|
||||||
}
|
|
||||||
vtkOpenFOAMTupleRemap<Type>(vec);
|
|
||||||
|
|
||||||
celldata->InsertTuple(i, vec);
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkUnstructuredGrid::SafeDownCast
|
|
||||||
(
|
|
||||||
GetDataSetFromBlock(output, range, datasetNo)
|
|
||||||
) ->GetCellData()
|
|
||||||
->AddArray(celldata);
|
|
||||||
|
|
||||||
celldata->Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -2,17 +2,15 @@
|
|||||||
cd ${0%/*} || exit 1 # Run from this directory
|
cd ${0%/*} || exit 1 # Run from this directory
|
||||||
|
|
||||||
# Source the wmake functions
|
# Source the wmake functions
|
||||||
. $WM_DIR/scripts/wmakeFunctions
|
. $WM_PROJECT_DIR/wmake/scripts/wmakeFunctions
|
||||||
|
|
||||||
#set -x
|
# Cleanup client-server and/or combined plugins
|
||||||
|
|
||||||
# deal with client/server vs combined plugins
|
|
||||||
rm -f $FOAM_LIBBIN/libPVblockMeshReader* 2>/dev/null
|
rm -f $FOAM_LIBBIN/libPVblockMeshReader* 2>/dev/null
|
||||||
|
|
||||||
rm -rf PVblockMeshReader/Make # safety: old build location
|
rm -rf PVblockMeshReader/Make # safety: old build location
|
||||||
wclean libso vtkPVblockMesh
|
wclean libso vtkPVblockMesh
|
||||||
|
|
||||||
# Where are the generated files stored?
|
# Cleanup generated files
|
||||||
findObjectDir $PWD # remove entire top-level
|
findObjectDir $PWD # remove entire top-level
|
||||||
rm -rf "$objectsDir" > /dev/null 2>&1
|
rm -rf "$objectsDir" > /dev/null 2>&1
|
||||||
|
|
||||||
|
|||||||
@ -4,49 +4,18 @@ cd ${0%/*} || exit 1 # Run from this directory
|
|||||||
# Parse arguments for library compilation
|
# Parse arguments for library compilation
|
||||||
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
||||||
|
|
||||||
# Source the wmake functions
|
# Source CMake functions
|
||||||
. $WM_DIR/scripts/wmakeFunctions
|
. $WM_PROJECT_DIR/wmake/scripts/cmakeFunctions
|
||||||
|
|
||||||
# Ensure CMake gets the correct C/C++ compilers
|
|
||||||
[ -n "$WM_CC" ] && export CC="$WM_CC"
|
|
||||||
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
|
|
||||||
|
|
||||||
|
|
||||||
# CMake into objectsDir,
|
|
||||||
# with an additional attempt if (possibly incorrect) CMakeCache.txt existed
|
|
||||||
doCmake()
|
|
||||||
{
|
|
||||||
local sourceDir="$1"
|
|
||||||
|
|
||||||
findObjectDir $sourceDir # Where are generated files stored?
|
|
||||||
test -f "$objectsDir/CMakeCache.txt"
|
|
||||||
retry=$? # CMakeCache.txt exists, but sources may have moved
|
|
||||||
|
|
||||||
mkdir -p $objectsDir && \
|
|
||||||
(
|
|
||||||
cd $objectsDir || exit 1
|
|
||||||
|
|
||||||
cmake $sourceDir || {
|
|
||||||
if [ $retry -eq 0 ]
|
|
||||||
then
|
|
||||||
echo "Removing CMakeCache.txt and attempt again"
|
|
||||||
rm -f CMakeCache.txt
|
|
||||||
cmake $sourceDir
|
|
||||||
else
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
} && make
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
if [ -d "$ParaView_DIR" ]
|
if [ -d "$ParaView_DIR" ]
|
||||||
then
|
then
|
||||||
wmake $targetType vtkPVblockMesh
|
wmakeLibPv vtkPVblockMesh
|
||||||
|
|
||||||
if [ "$targetType" != objects ]
|
if [ "$targetType" != objects ]
|
||||||
then
|
then
|
||||||
doCmake $PWD/PVblockMeshReader || {
|
cmakePv $PWD/PVblockMeshReader || {
|
||||||
echo
|
echo
|
||||||
echo " WARNING: incomplete build of ParaView BlockMesh plugin"
|
echo " WARNING: incomplete build of ParaView BlockMesh plugin"
|
||||||
echo
|
echo
|
||||||
|
|||||||
@ -1,85 +1,70 @@
|
|||||||
# create a plugin that adds a reader to the ParaView GUI
|
# Create a plugin to add a reader to the ParaView GUI
|
||||||
# it is added in the file dialog when doing opens/saves.
|
|
||||||
|
|
||||||
# The qrc file is processed by Qt's resource compiler (rcc)
|
cmake_minimum_required(VERSION 2.6)
|
||||||
# the qrc file must have a resource prefix of "/ParaViewResources"
|
|
||||||
# and ParaView will read anything contained under that prefix
|
|
||||||
# the pqReader.xml file contains xml defining readers with their
|
|
||||||
# file extensions and descriptions.
|
|
||||||
|
|
||||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
find_package(ParaView REQUIRED)
|
||||||
|
include(${PARAVIEW_USE_FILE})
|
||||||
|
|
||||||
FIND_PACKAGE(ParaView REQUIRED)
|
link_directories(
|
||||||
INCLUDE(${PARAVIEW_USE_FILE})
|
|
||||||
|
|
||||||
LINK_DIRECTORIES(
|
|
||||||
$ENV{FOAM_LIBBIN}
|
$ENV{FOAM_LIBBIN}
|
||||||
$ENV{FOAM_EXT_LIBBIN}
|
$ENV{FOAM_EXT_LIBBIN}
|
||||||
)
|
)
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(
|
include_directories(
|
||||||
$ENV{WM_PROJECT_DIR}/src/OpenFOAM/lnInclude
|
$ENV{WM_PROJECT_DIR}/src/OpenFOAM/lnInclude
|
||||||
$ENV{WM_PROJECT_DIR}/src/OSspecific/$ENV{WM_OSTYPE}/lnInclude
|
$ENV{WM_PROJECT_DIR}/src/OSspecific/$ENV{WM_OSTYPE}/lnInclude
|
||||||
$ENV{WM_PROJECT_DIR}/src/meshing/blockMesh/lnInclude
|
$ENV{WM_PROJECT_DIR}/src/meshing/blockMesh/lnInclude
|
||||||
${PROJECT_SOURCE_DIR}/../vtkPVblockMesh
|
${PROJECT_SOURCE_DIR}/../vtkPVblockMesh
|
||||||
|
${PROJECT_SOURCE_DIR}/../../foamPv/lnInclude
|
||||||
)
|
)
|
||||||
|
|
||||||
ADD_DEFINITIONS(
|
add_definitions(
|
||||||
-std=c++0x
|
-std=c++11
|
||||||
-DWM_$ENV{WM_PRECISION_OPTION}
|
-DWM_$ENV{WM_PRECISION_OPTION}
|
||||||
-DWM_LABEL_SIZE=$ENV{WM_LABEL_SIZE}
|
-DWM_LABEL_SIZE=$ENV{WM_LABEL_SIZE}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Set output library destination to plugin directory
|
# Set output library destination to plugin directory
|
||||||
SET(
|
set(
|
||||||
LIBRARY_OUTPUT_PATH $ENV{PV_PLUGIN_PATH}
|
LIBRARY_OUTPUT_PATH $ENV{PV_PLUGIN_PATH}
|
||||||
CACHE INTERNAL
|
CACHE INTERNAL
|
||||||
"Single output directory for building all libraries."
|
"Single output directory for building all libraries."
|
||||||
)
|
)
|
||||||
|
|
||||||
#
|
|
||||||
# Define combined plugin
|
|
||||||
#
|
|
||||||
|
|
||||||
# Extend the auto-generated panel
|
if (PARAVIEW_QT_VERSION VERSION_GREATER "4")
|
||||||
QT4_WRAP_CPP(MOC_SRCS pqPVblockMeshReaderPanel.h)
|
qt5_wrap_cpp(MOC_SRCS
|
||||||
|
pqFoamBlockMeshControls.h
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
qt4_wrap_cpp(MOC_SRCS
|
||||||
|
pqFoamBlockMeshControls.h
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
ADD_PARAVIEW_OBJECT_PANEL(IFACES IFACE_SRCS
|
add_paraview_property_group_widget(IFACES0 IFACES0_SRCS
|
||||||
CLASS_NAME pqPVblockMeshReaderPanel
|
TYPE "openfoam_blockMesh_general_controls"
|
||||||
XML_NAME PVblockMeshReader # name of SourceProxy in *SM.xml
|
CLASS_NAME pqFoamBlockMeshControls
|
||||||
XML_GROUP sources
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Separate GUI_RESOURCE_FILES deprecated with paraview 4.3
|
add_paraview_plugin(
|
||||||
# so check if version < 4.4
|
PVblockMeshReader_SM "1.0"
|
||||||
|
SERVER_MANAGER_XML PVblockMeshReader_SM.xml
|
||||||
|
SERVER_MANAGER_SOURCES vtkPVblockMeshReader.cxx
|
||||||
|
GUI_INTERFACES
|
||||||
|
${IFACES0}
|
||||||
|
SOURCES
|
||||||
|
${IFACES0_SRCS}
|
||||||
|
${MOC_SRCS}
|
||||||
|
pqFoamBlockMeshControls.cxx
|
||||||
|
)
|
||||||
|
|
||||||
IF(("${PARAVIEW_VERSION_MAJOR}" LESS 5) AND ("${PARAVIEW_VERSION_MINOR}" LESS 4))
|
|
||||||
ADD_PARAVIEW_PLUGIN(
|
|
||||||
PVblockMeshReader_SM "1.0"
|
|
||||||
SERVER_MANAGER_XML PVblockMeshReader_SM.xml
|
|
||||||
SERVER_MANAGER_SOURCES vtkPVblockMeshReader.cxx
|
|
||||||
GUI_INTERFACES ${IFACES}
|
|
||||||
GUI_SOURCES pqPVblockMeshReaderPanel.cxx
|
|
||||||
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
|
|
||||||
GUI_RESOURCE_FILES PVblockMeshReader.xml
|
|
||||||
)
|
|
||||||
ELSE()
|
|
||||||
ADD_PARAVIEW_PLUGIN(
|
|
||||||
PVblockMeshReader_SM "1.0"
|
|
||||||
SERVER_MANAGER_XML PVblockMeshReader_SM.xml
|
|
||||||
SERVER_MANAGER_SOURCES vtkPVblockMeshReader.cxx
|
|
||||||
GUI_INTERFACES ${IFACES}
|
|
||||||
GUI_SOURCES pqPVblockMeshReaderPanel.cxx
|
|
||||||
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
|
|
||||||
)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
# Build the client-side plugin
|
target_link_libraries(
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(
|
|
||||||
PVblockMeshReader_SM
|
PVblockMeshReader_SM
|
||||||
LINK_PUBLIC
|
LINK_PUBLIC
|
||||||
vtkPVblockMesh
|
vtkPVblockMesh-pv${PARAVIEW_VERSION_MAJOR}.${PARAVIEW_VERSION_MINOR}
|
||||||
|
foamPv-pv${PARAVIEW_VERSION_MAJOR}.${PARAVIEW_VERSION_MINOR}
|
||||||
blockMesh
|
blockMesh
|
||||||
OpenFOAM
|
OpenFOAM
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,5 +0,0 @@
|
|||||||
<RCC>
|
|
||||||
<qresource prefix="/ParaViewResources" >
|
|
||||||
<file>PVblockMeshReader.xml</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
<ParaViewReaders>
|
|
||||||
<!-- deprecated with paraview-4.3, use hints in *SM.xml -->
|
|
||||||
<Reader name="PVblockMeshReader"
|
|
||||||
extensions="blockMesh"
|
|
||||||
file_description="OpenFOAM blockMesh reader">
|
|
||||||
</Reader>
|
|
||||||
</ParaViewReaders>
|
|
||||||
@ -5,49 +5,58 @@
|
|||||||
class="vtkPVblockMeshReader">
|
class="vtkPVblockMeshReader">
|
||||||
|
|
||||||
<!-- File name - compulsory -->
|
<!-- File name - compulsory -->
|
||||||
<StringVectorProperty
|
<StringVectorProperty animateable="0"
|
||||||
name="FileName"
|
name="FileName"
|
||||||
command="SetFileName"
|
command="SetFileName"
|
||||||
number_of_elements="1"
|
number_of_elements="1"
|
||||||
animateable="0">
|
panel_visibility="never">
|
||||||
<FileListDomain name="files"/>
|
<FileListDomain name="files"/>
|
||||||
<Documentation>
|
<Documentation>The filename for the OpenFOAM blockMesh reader.</Documentation>
|
||||||
Specifies the filename for the OpenFOAM blockMesh Reader.
|
|
||||||
</Documentation>
|
|
||||||
</StringVectorProperty>
|
</StringVectorProperty>
|
||||||
|
|
||||||
<!-- Show Point Numbers check-box -->
|
<!-- Refresh (push button) -->
|
||||||
<IntVectorProperty
|
<Property
|
||||||
name="UiShowPointNumbers"
|
name="Refresh"
|
||||||
command="SetShowPointNumbers"
|
command="Refresh"
|
||||||
number_of_elements="1"
|
panel_visibility="default">
|
||||||
default_values="1"
|
<Documentation>Rescan for updated blockMeshDict.</Documentation>
|
||||||
is_internal="1"
|
</Property>
|
||||||
animateable="0">
|
|
||||||
<BooleanDomain name="bool"/>
|
|
||||||
<Documentation>
|
|
||||||
Show point numbers in render window.
|
|
||||||
</Documentation>
|
|
||||||
</IntVectorProperty>
|
|
||||||
|
|
||||||
<!-- Refresh button -->
|
<!-- General Controls -->
|
||||||
<IntVectorProperty
|
|
||||||
name="UiRefresh"
|
<!-- Show Patch Names (check-box) -->
|
||||||
command="SetRefresh"
|
<IntVectorProperty animateable="0"
|
||||||
number_of_elements="1"
|
name="ShowPatchNames"
|
||||||
is_internal="0"
|
label="Patch Names"
|
||||||
|
command="SetShowPatchNames"
|
||||||
default_values="0"
|
default_values="0"
|
||||||
animateable="0">
|
number_of_elements="1"
|
||||||
|
panel_visibility="default">
|
||||||
<BooleanDomain name="bool"/>
|
<BooleanDomain name="bool"/>
|
||||||
<Documentation>
|
<Documentation>Show patch names in render window.</Documentation>
|
||||||
Rescan for updated blockMeshDict.
|
|
||||||
</Documentation>
|
|
||||||
</IntVectorProperty>
|
</IntVectorProperty>
|
||||||
|
|
||||||
|
<!-- Show Point Numbers (check-box) -->
|
||||||
|
<IntVectorProperty animateable="0"
|
||||||
|
name="ShowPointNumbers"
|
||||||
|
label="Point Numbers"
|
||||||
|
command="SetShowPointNumbers"
|
||||||
|
default_values="1"
|
||||||
|
number_of_elements="1"
|
||||||
|
panel_visibility="default">
|
||||||
|
<BooleanDomain name="bool"/>
|
||||||
|
<Documentation>Show point numbers in render window.</Documentation>
|
||||||
|
</IntVectorProperty>
|
||||||
|
|
||||||
<!--
|
<PropertyGroup
|
||||||
| Selections
|
label="General Controls"
|
||||||
-->
|
panel_widget="openfoam_blockMesh_general_controls">
|
||||||
|
<Property name="Refresh"/>
|
||||||
|
<Property name="ShowPatchNames"/>
|
||||||
|
<Property name="ShowPointNumbers"/>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<!-- Selections -->
|
||||||
|
|
||||||
<!-- Available Blocks array -->
|
<!-- Available Blocks array -->
|
||||||
<StringVectorProperty
|
<StringVectorProperty
|
||||||
@ -55,7 +64,7 @@
|
|||||||
information_only="1">
|
information_only="1">
|
||||||
<ArraySelectionInformationHelper attribute_name="Block"/>
|
<ArraySelectionInformationHelper attribute_name="Block"/>
|
||||||
</StringVectorProperty>
|
</StringVectorProperty>
|
||||||
<StringVectorProperty
|
<StringVectorProperty animateable="0"
|
||||||
name="BlockStatus"
|
name="BlockStatus"
|
||||||
label="Blocks"
|
label="Blocks"
|
||||||
command="SetBlockArrayStatus"
|
command="SetBlockArrayStatus"
|
||||||
@ -63,16 +72,13 @@
|
|||||||
repeat_command="1"
|
repeat_command="1"
|
||||||
number_of_elements_per_command="2"
|
number_of_elements_per_command="2"
|
||||||
element_types="2 0"
|
element_types="2 0"
|
||||||
information_property="BlockArrayStatus"
|
information_property="BlockArrayStatus">
|
||||||
animateable="0">
|
|
||||||
<ArraySelectionDomain name="array_list">
|
<ArraySelectionDomain name="array_list">
|
||||||
<RequiredProperties>
|
<RequiredProperties>
|
||||||
<Property name="BlockArrayStatus" function="ArrayList"/>
|
<Property name="BlockArrayStatus" function="ArrayList"/>
|
||||||
</RequiredProperties>
|
</RequiredProperties>
|
||||||
</ArraySelectionDomain>
|
</ArraySelectionDomain>
|
||||||
<Documentation>
|
<Documentation>The list of blocks</Documentation>
|
||||||
This property contains a list of the blocks
|
|
||||||
</Documentation>
|
|
||||||
</StringVectorProperty>
|
</StringVectorProperty>
|
||||||
|
|
||||||
<!-- Available CurvedEdges array -->
|
<!-- Available CurvedEdges array -->
|
||||||
@ -81,7 +87,7 @@
|
|||||||
information_only="1">
|
information_only="1">
|
||||||
<ArraySelectionInformationHelper attribute_name="CurvedEdges"/>
|
<ArraySelectionInformationHelper attribute_name="CurvedEdges"/>
|
||||||
</StringVectorProperty>
|
</StringVectorProperty>
|
||||||
<StringVectorProperty
|
<StringVectorProperty animateable="0"
|
||||||
name="CurvedEdgesStatus"
|
name="CurvedEdgesStatus"
|
||||||
label="Curved Edges"
|
label="Curved Edges"
|
||||||
command="SetCurvedEdgesArrayStatus"
|
command="SetCurvedEdgesArrayStatus"
|
||||||
@ -89,24 +95,26 @@
|
|||||||
repeat_command="1"
|
repeat_command="1"
|
||||||
number_of_elements_per_command="2"
|
number_of_elements_per_command="2"
|
||||||
element_types="2 0"
|
element_types="2 0"
|
||||||
information_property="CurvedEdgesArrayStatus"
|
information_property="CurvedEdgesArrayStatus">
|
||||||
animateable="0">
|
|
||||||
<ArraySelectionDomain name="array_list">
|
<ArraySelectionDomain name="array_list">
|
||||||
<RequiredProperties>
|
<RequiredProperties>
|
||||||
<Property name="CurvedEdgesArrayStatus" function="ArrayList"/>
|
<Property name="CurvedEdgesArrayStatus" function="ArrayList"/>
|
||||||
</RequiredProperties>
|
</RequiredProperties>
|
||||||
</ArraySelectionDomain>
|
</ArraySelectionDomain>
|
||||||
<Documentation>
|
<Documentation>The list of curved edges</Documentation>
|
||||||
This property contains a list of the curved edges
|
|
||||||
</Documentation>
|
|
||||||
</StringVectorProperty>
|
</StringVectorProperty>
|
||||||
|
|
||||||
|
<PropertyGroup label="Selections">
|
||||||
|
<Property name="BlockArrayStatus"/>
|
||||||
|
<Property name="BlockStatus"/>
|
||||||
|
<Property name="CurvedEdgesArrayStatus"/>
|
||||||
|
<Property name="CurvedEdgesStatus"/>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<Hints>
|
<Hints>
|
||||||
<Property name="FileName" show="0"/>
|
<ReaderFactory
|
||||||
<Property name="UiRefresh" show="0"/>
|
extensions="blockMesh"
|
||||||
<Property name="UiShowPointNumbers" show="0"/>
|
file_description="OpenFOAM blockMesh"/>
|
||||||
<ReaderFactory extensions="blockMesh"
|
|
||||||
file_description="OpenFOAM blockMesh"/>
|
|
||||||
</Hints>
|
</Hints>
|
||||||
|
|
||||||
</SourceProxy>
|
</SourceProxy>
|
||||||
|
|||||||
@ -0,0 +1,232 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 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 "pqFoamBlockMeshControls.h"
|
||||||
|
|
||||||
|
#include <QCheckBox>
|
||||||
|
#include <QGridLayout>
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
|
#include "pqPVApplicationCore.h"
|
||||||
|
#include "pqView.h"
|
||||||
|
#include "vtkSMDocumentation.h"
|
||||||
|
#include "vtkSMIntVectorProperty.h"
|
||||||
|
#include "vtkSMPropertyGroup.h"
|
||||||
|
#include "vtkSMSourceProxy.h"
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// file-scope
|
||||||
|
static QAbstractButton* setButtonProperties
|
||||||
|
(
|
||||||
|
QAbstractButton* b,
|
||||||
|
vtkSMProperty* prop
|
||||||
|
)
|
||||||
|
{
|
||||||
|
QString tip;
|
||||||
|
|
||||||
|
vtkSMDocumentation* doc = prop->GetDocumentation();
|
||||||
|
if (doc)
|
||||||
|
{
|
||||||
|
const char* txt = doc->GetDescription();
|
||||||
|
if (txt)
|
||||||
|
{
|
||||||
|
tip = QString(txt).simplified();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
b->setText(prop->GetXMLLabel());
|
||||||
|
if (tip.size())
|
||||||
|
{
|
||||||
|
b->setToolTip(tip);
|
||||||
|
}
|
||||||
|
b->setFocusPolicy(Qt::NoFocus); // avoid dotted border
|
||||||
|
|
||||||
|
|
||||||
|
vtkSMIntVectorProperty* intProp =
|
||||||
|
vtkSMIntVectorProperty::SafeDownCast(prop);
|
||||||
|
|
||||||
|
// initial checked state for integer (bool) properties
|
||||||
|
if (intProp)
|
||||||
|
{
|
||||||
|
b->setChecked(intProp->GetElement(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static vtkSMIntVectorProperty* lookupIntProp
|
||||||
|
(
|
||||||
|
vtkSMPropertyGroup* group,
|
||||||
|
const char* name
|
||||||
|
)
|
||||||
|
{
|
||||||
|
vtkSMProperty* prop = group->GetProperty(name);
|
||||||
|
|
||||||
|
if (prop)
|
||||||
|
{
|
||||||
|
return vtkSMIntVectorProperty::SafeDownCast(prop);
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void pqFoamBlockMeshControls::fireCommand(vtkSMProperty* prop)
|
||||||
|
{
|
||||||
|
vtkSMProxy* pxy = this->proxy();
|
||||||
|
|
||||||
|
// Fire off command
|
||||||
|
prop->Modified();
|
||||||
|
pxy->UpdateProperty(pxy->GetPropertyName(prop));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void pqFoamBlockMeshControls::fireCommand
|
||||||
|
(
|
||||||
|
vtkSMIntVectorProperty* prop,
|
||||||
|
bool checked
|
||||||
|
)
|
||||||
|
{
|
||||||
|
vtkSMProxy* pxy = this->proxy();
|
||||||
|
|
||||||
|
prop->SetElement(0, checked); // Toogle bool
|
||||||
|
|
||||||
|
// Fire off command
|
||||||
|
prop->Modified();
|
||||||
|
pxy->UpdateProperty(pxy->GetPropertyName(prop));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void pqFoamBlockMeshControls::updateParts()
|
||||||
|
{
|
||||||
|
vtkSMProxy* pxy = this->proxy();
|
||||||
|
|
||||||
|
pxy->UpdatePropertyInformation(pxy->GetProperty("BlockArrayStatus"));
|
||||||
|
pxy->UpdatePropertyInformation(pxy->GetProperty("CurvedEdgesArrayStatus"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void pqFoamBlockMeshControls::refreshPressed()
|
||||||
|
{
|
||||||
|
fireCommand(refresh_);
|
||||||
|
|
||||||
|
vtkSMSourceProxy::SafeDownCast(this->proxy())->UpdatePipeline();
|
||||||
|
|
||||||
|
// Trigger a rendering (all views)
|
||||||
|
pqPVApplicationCore::instance()->render();
|
||||||
|
|
||||||
|
updateParts();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void pqFoamBlockMeshControls::showPatchNames(bool checked)
|
||||||
|
{
|
||||||
|
fireCommand(showPatchNames_, checked);
|
||||||
|
|
||||||
|
// Update the active view
|
||||||
|
if (this->view())
|
||||||
|
{
|
||||||
|
this->view()->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
// OR: update all views
|
||||||
|
// pqPVApplicationCore::instance()->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void pqFoamBlockMeshControls::showPointNumbers(bool checked)
|
||||||
|
{
|
||||||
|
fireCommand(showPointNumbers_, checked);
|
||||||
|
|
||||||
|
// Update the active view
|
||||||
|
if (this->view())
|
||||||
|
{
|
||||||
|
this->view()->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
// OR: update all views
|
||||||
|
// pqPVApplicationCore::instance()->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
pqFoamBlockMeshControls::pqFoamBlockMeshControls
|
||||||
|
(
|
||||||
|
vtkSMProxy* proxy,
|
||||||
|
vtkSMPropertyGroup* group,
|
||||||
|
QWidget* parent
|
||||||
|
)
|
||||||
|
:
|
||||||
|
Superclass(proxy, parent),
|
||||||
|
refresh_(group->GetProperty("Refresh")),
|
||||||
|
showPatchNames_(lookupIntProp(group, "ShowPatchNames")),
|
||||||
|
showPointNumbers_(lookupIntProp(group, "ShowPointNumbers"))
|
||||||
|
{
|
||||||
|
QGridLayout* form = new QGridLayout(this);
|
||||||
|
|
||||||
|
if (refresh_)
|
||||||
|
{
|
||||||
|
QPushButton* b = new QPushButton(this);
|
||||||
|
setButtonProperties(b, refresh_);
|
||||||
|
form->addWidget(b, 0, 0, Qt::AlignLeft);
|
||||||
|
|
||||||
|
connect(b, SIGNAL(clicked()), this, SLOT(refreshPressed()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showPatchNames_)
|
||||||
|
{
|
||||||
|
QCheckBox* b = new QCheckBox(this);
|
||||||
|
setButtonProperties(b, showPatchNames_);
|
||||||
|
form->addWidget(b, 0, 1, Qt::AlignLeft);
|
||||||
|
|
||||||
|
connect(b, SIGNAL(toggled(bool)), this, SLOT(showPatchNames(bool)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showPointNumbers_)
|
||||||
|
{
|
||||||
|
QCheckBox* b = new QCheckBox(this);
|
||||||
|
setButtonProperties(b, showPointNumbers_);
|
||||||
|
form->addWidget(b, 0, 2, Qt::AlignLeft);
|
||||||
|
|
||||||
|
connect(b, SIGNAL(toggled(bool)), this, SLOT(showPointNumbers(bool)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
pqFoamBlockMeshControls::~pqFoamBlockMeshControls()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,123 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 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
|
||||||
|
pqFoamBlockMeshControls
|
||||||
|
|
||||||
|
Description
|
||||||
|
Customized property controls for the ParaView blockMesh reader.
|
||||||
|
|
||||||
|
Refresh, ShowPatchNames, ShowPointNumbers.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
pqFoamBlockMeshControls.cxx
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
#ifndef pqFoamBlockMeshControls_h
|
||||||
|
#define pqFoamBlockMeshControls_h
|
||||||
|
|
||||||
|
#include "pqPropertyWidget.h"
|
||||||
|
|
||||||
|
// Forward declarations (ParaView)
|
||||||
|
class vtkSMProperty;
|
||||||
|
class vtkSMIntVectorProperty;
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class pqFoamBlockMeshControls Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class pqFoamBlockMeshControls
|
||||||
|
:
|
||||||
|
public pqPropertyWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT;
|
||||||
|
typedef pqPropertyWidget Superclass;
|
||||||
|
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Refresh (push button)
|
||||||
|
vtkSMProperty* refresh_;
|
||||||
|
|
||||||
|
//- Show Patch Names (bool property)
|
||||||
|
vtkSMIntVectorProperty* showPatchNames_;
|
||||||
|
|
||||||
|
//- Show Point Numbers (bool property)
|
||||||
|
vtkSMIntVectorProperty* showPointNumbers_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Update property
|
||||||
|
void fireCommand(vtkSMProperty* prop);
|
||||||
|
|
||||||
|
//- Toggle and update bool property
|
||||||
|
void fireCommand(vtkSMIntVectorProperty* prop, bool checked);
|
||||||
|
|
||||||
|
//- Update "BlockArrayStatus", "CurvedEdgesArrayStatus" information
|
||||||
|
void updateParts();
|
||||||
|
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
pqFoamBlockMeshControls(const pqFoamBlockMeshControls&) = delete;
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const pqFoamBlockMeshControls&) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Trigger refresh
|
||||||
|
void refreshPressed();
|
||||||
|
|
||||||
|
//- Sync property with changed checkbox state, update rendered view(s)
|
||||||
|
void showPatchNames(bool checked);
|
||||||
|
|
||||||
|
//- Sync property with changed checkbox state, update rendered view(s)
|
||||||
|
void showPointNumbers(bool checked);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
pqFoamBlockMeshControls
|
||||||
|
(
|
||||||
|
vtkSMProxy* proxy,
|
||||||
|
vtkSMPropertyGroup* group,
|
||||||
|
QWidget* parent = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~pqFoamBlockMeshControls();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -1,143 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
||||||
\\/ 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 "pqPVblockMeshReaderPanel.h"
|
|
||||||
|
|
||||||
// QT
|
|
||||||
#include <QGridLayout>
|
|
||||||
#include <QCheckBox>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QLayout>
|
|
||||||
#include <QString>
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QtDebug>
|
|
||||||
|
|
||||||
// Paraview <-> QT UI
|
|
||||||
#include "pqAnimationScene.h"
|
|
||||||
#include "pqApplicationCore.h"
|
|
||||||
#include "pqPipelineRepresentation.h"
|
|
||||||
#include "pqServerManagerModel.h"
|
|
||||||
#include "pqView.h"
|
|
||||||
|
|
||||||
// Paraview Server Manager
|
|
||||||
#include "vtkSMDoubleVectorProperty.h"
|
|
||||||
#include "vtkSMIntVectorProperty.h"
|
|
||||||
#include "vtkSMProperty.h"
|
|
||||||
#include "vtkSMSourceProxy.h"
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
pqPVblockMeshReaderPanel::pqPVblockMeshReaderPanel
|
|
||||||
(
|
|
||||||
pqProxy *proxy,
|
|
||||||
QWidget *p
|
|
||||||
)
|
|
||||||
:
|
|
||||||
pqAutoGeneratedObjectPanel(proxy, p)
|
|
||||||
{
|
|
||||||
// Create first sublayout (at top of the panel)
|
|
||||||
QGridLayout *form = new QGridLayout();
|
|
||||||
this->PanelLayout->addLayout(form, 0, 0, 1, -1);
|
|
||||||
|
|
||||||
vtkSMProperty* prop = 0;
|
|
||||||
|
|
||||||
// Refresh button for updating blocks
|
|
||||||
if ((prop = this->proxy()->GetProperty("UiRefresh")) != 0)
|
|
||||||
{
|
|
||||||
prop->SetImmediateUpdate(1);
|
|
||||||
QPushButton* refresh = new QPushButton("Refresh");
|
|
||||||
refresh->setToolTip("Rescan for updated blockMeshDict.");
|
|
||||||
|
|
||||||
form->addWidget(refresh, 0, 0, Qt::AlignLeft);
|
|
||||||
QObject::connect
|
|
||||||
(
|
|
||||||
refresh,
|
|
||||||
SIGNAL(clicked()),
|
|
||||||
this,
|
|
||||||
SLOT(RefreshPressed())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Checkbox for showing point numbers
|
|
||||||
if ((prop = this->proxy()->GetProperty("UiShowPointNumbers")) != 0)
|
|
||||||
{
|
|
||||||
prop->SetImmediateUpdate(true);
|
|
||||||
|
|
||||||
ShowPointNumbers_ = new QCheckBox("Show Point Numbers");
|
|
||||||
ShowPointNumbers_->setToolTip("Show point numbers in render window.");
|
|
||||||
ShowPointNumbers_->setChecked
|
|
||||||
(
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
|
|
||||||
);
|
|
||||||
|
|
||||||
form->addWidget(ShowPointNumbers_);
|
|
||||||
|
|
||||||
connect
|
|
||||||
(
|
|
||||||
ShowPointNumbers_,
|
|
||||||
SIGNAL(stateChanged(int)),
|
|
||||||
this,
|
|
||||||
SLOT(ShowPointNumbersToggled())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
void pqPVblockMeshReaderPanel::ShowPointNumbersToggled()
|
|
||||||
{
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast
|
|
||||||
(
|
|
||||||
this->proxy()->GetProperty("UiShowPointNumbers")
|
|
||||||
)->SetElement(0, ShowPointNumbers_->isChecked());
|
|
||||||
|
|
||||||
// Update the active view
|
|
||||||
if (this->view())
|
|
||||||
{
|
|
||||||
this->view()->render();
|
|
||||||
}
|
|
||||||
// OR: update all views
|
|
||||||
// pqApplicationCore::instance()->render();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void pqPVblockMeshReaderPanel::RefreshPressed()
|
|
||||||
{
|
|
||||||
// Update everything
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast
|
|
||||||
(
|
|
||||||
this->proxy()->GetProperty("UiRefresh")
|
|
||||||
)->Modified();
|
|
||||||
|
|
||||||
vtkSMSourceProxy::SafeDownCast(this->proxy())->UpdatePipeline();
|
|
||||||
|
|
||||||
// Render all views
|
|
||||||
pqApplicationCore::instance()->render();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,86 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
||||||
\\/ 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
|
|
||||||
pqPVblockMeshReaderPanel
|
|
||||||
|
|
||||||
Description
|
|
||||||
GUI modifications for the ParaView reader panel
|
|
||||||
|
|
||||||
A custom panel for the PVblockMeshReader.
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
pqPVblockMeshReaderPanel.cxx
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
#ifndef pqPVblockMeshReaderPanel_h
|
|
||||||
#define pqPVblockMeshReaderPanel_h
|
|
||||||
|
|
||||||
#include "pqAutoGeneratedObjectPanel.h"
|
|
||||||
|
|
||||||
// Forward declaration of QT classes
|
|
||||||
|
|
||||||
class QCheckBox;
|
|
||||||
class QLineEdit;
|
|
||||||
class QTimer;
|
|
||||||
class QToolButton;
|
|
||||||
|
|
||||||
// Forward declaration of ParaView classes
|
|
||||||
class vtkSMSourceProxy;
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
Class pqPVblockMeshReaderPanel Declaration
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
class pqPVblockMeshReaderPanel
|
|
||||||
:
|
|
||||||
public pqAutoGeneratedObjectPanel
|
|
||||||
{
|
|
||||||
// Private data
|
|
||||||
Q_OBJECT;
|
|
||||||
typedef pqAutoGeneratedObjectPanel Superclass;
|
|
||||||
|
|
||||||
//- Show Point Numbers checkbox
|
|
||||||
QCheckBox* ShowPointNumbers_;
|
|
||||||
|
|
||||||
protected slots:
|
|
||||||
|
|
||||||
void ShowPointNumbersToggled();
|
|
||||||
void RefreshPressed();
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
//- Construct from components
|
|
||||||
pqPVblockMeshReaderPanel(pqProxy*, QWidget*);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#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) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -56,10 +56,11 @@ vtkPVblockMeshReader::vtkPVblockMeshReader()
|
|||||||
|
|
||||||
SetNumberOfInputPorts(0);
|
SetNumberOfInputPorts(0);
|
||||||
|
|
||||||
FileName = nullptr;
|
FileName = nullptr;
|
||||||
foamData_ = nullptr;
|
backend_ = nullptr;
|
||||||
|
|
||||||
ShowPointNumbers = 1;
|
ShowPatchNames = false;
|
||||||
|
ShowPointNumbers = true;
|
||||||
|
|
||||||
BlockSelection = vtkDataArraySelection::New();
|
BlockSelection = vtkDataArraySelection::New();
|
||||||
CurvedEdgesSelection = vtkDataArraySelection::New();
|
CurvedEdgesSelection = vtkDataArraySelection::New();
|
||||||
@ -73,7 +74,6 @@ vtkPVblockMeshReader::vtkPVblockMeshReader()
|
|||||||
);
|
);
|
||||||
SelectionObserver->SetClientData(this);
|
SelectionObserver->SetClientData(this);
|
||||||
|
|
||||||
|
|
||||||
BlockSelection->AddObserver
|
BlockSelection->AddObserver
|
||||||
(
|
(
|
||||||
vtkCommand::ModifiedEvent,
|
vtkCommand::ModifiedEvent,
|
||||||
@ -92,13 +92,16 @@ vtkPVblockMeshReader::vtkPVblockMeshReader()
|
|||||||
|
|
||||||
vtkPVblockMeshReader::~vtkPVblockMeshReader()
|
vtkPVblockMeshReader::~vtkPVblockMeshReader()
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"Deconstructor");
|
vtkDebugMacro(<<"Destructor");
|
||||||
|
|
||||||
if (foamData_)
|
if (backend_)
|
||||||
{
|
{
|
||||||
// Remove point numbers
|
// Remove text actors
|
||||||
|
updatePatchNamesView(false);
|
||||||
updatePointNumbersView(false);
|
updatePointNumbersView(false);
|
||||||
delete foamData_;
|
|
||||||
|
delete backend_;
|
||||||
|
backend_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FileName)
|
if (FileName)
|
||||||
@ -106,11 +109,12 @@ vtkPVblockMeshReader::~vtkPVblockMeshReader()
|
|||||||
delete [] FileName;
|
delete [] FileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockSelection->RemoveObserver(this->SelectionObserver);
|
BlockSelection->RemoveAllObservers();
|
||||||
CurvedEdgesSelection->RemoveObserver(this->SelectionObserver);
|
CurvedEdgesSelection->RemoveAllObservers();
|
||||||
|
|
||||||
SelectionObserver->Delete();
|
SelectionObserver->Delete();
|
||||||
BlockSelection->Delete();
|
BlockSelection->Delete();
|
||||||
|
CurvedEdgesSelection->Delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -125,35 +129,25 @@ int vtkPVblockMeshReader::RequestInformation
|
|||||||
{
|
{
|
||||||
vtkDebugMacro(<<"RequestInformation");
|
vtkDebugMacro(<<"RequestInformation");
|
||||||
|
|
||||||
if (Foam::vtkPVblockMesh::debug)
|
|
||||||
{
|
|
||||||
cout<<"REQUEST_INFORMATION\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!FileName)
|
if (!FileName)
|
||||||
{
|
{
|
||||||
vtkErrorMacro("FileName has to be specified!");
|
vtkErrorMacro("FileName has to be specified!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nInfo = outputVector->GetNumberOfInformationObjects();
|
|
||||||
|
|
||||||
if (Foam::vtkPVblockMesh::debug)
|
if (Foam::vtkPVblockMesh::debug)
|
||||||
{
|
{
|
||||||
cout<<"RequestInformation with " << nInfo << " item(s)\n";
|
cout<<"REQUEST_INFORMATION\n";
|
||||||
for (int infoI = 0; infoI < nInfo; ++infoI)
|
outputVector->GetInformationObject(0)->Print(cout);
|
||||||
{
|
|
||||||
outputVector->GetInformationObject(infoI)->Print(cout);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!foamData_)
|
if (backend_)
|
||||||
{
|
{
|
||||||
foamData_ = new Foam::vtkPVblockMesh(FileName, this);
|
backend_->updateInfo();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foamData_->updateInfo();
|
backend_ = new Foam::vtkPVblockMesh(FileName, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -176,21 +170,16 @@ int vtkPVblockMeshReader::RequestData
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Catch previous error
|
// Catch previous error
|
||||||
if (!foamData_)
|
if (!backend_)
|
||||||
{
|
{
|
||||||
vtkErrorMacro("Reader failed - perhaps no mesh?");
|
vtkErrorMacro("Reader failed - perhaps no mesh?");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nInfo = outputVector->GetNumberOfInformationObjects();
|
|
||||||
|
|
||||||
if (Foam::vtkPVblockMesh::debug)
|
if (Foam::vtkPVblockMesh::debug)
|
||||||
{
|
{
|
||||||
cout<<"RequestData with " << nInfo << " item(s)\n";
|
cout<<"REQUEST_DATA:\n";
|
||||||
for (int infoI = 0; infoI < nInfo; ++infoI)
|
outputVector->GetInformationObject(0)->Print(cout);
|
||||||
{
|
|
||||||
outputVector->GetInformationObject(infoI)->Print(cout);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkMultiBlockDataSet* output = vtkMultiBlockDataSet::SafeDownCast
|
vtkMultiBlockDataSet* output = vtkMultiBlockDataSet::SafeDownCast
|
||||||
@ -207,32 +196,46 @@ int vtkPVblockMeshReader::RequestData
|
|||||||
<< output->GetNumberOfBlocks() << " blocks\n";
|
<< output->GetNumberOfBlocks() << " blocks\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
backend_->Update(output);
|
||||||
|
|
||||||
foamData_->Update(output);
|
updatePatchNamesView(ShowPatchNames);
|
||||||
updatePointNumbersView(ShowPointNumbers);
|
updatePointNumbersView(ShowPointNumbers);
|
||||||
|
|
||||||
// Do any cleanup on the OpenFOAM side
|
// Do any cleanup on the OpenFOAM side
|
||||||
foamData_->CleanUp();
|
backend_->CleanUp();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void vtkPVblockMeshReader::SetRefresh(int val)
|
void vtkPVblockMeshReader::Refresh()
|
||||||
{
|
{
|
||||||
// Delete the current blockMesh to force re-read and update
|
// Delete the current blockMesh to force re-read and update
|
||||||
if (foamData_)
|
if (backend_)
|
||||||
{
|
{
|
||||||
|
// Remove text actors
|
||||||
|
updatePatchNamesView(false);
|
||||||
updatePointNumbersView(false);
|
updatePointNumbersView(false);
|
||||||
delete foamData_;
|
|
||||||
foamData_ = 0;
|
delete backend_;
|
||||||
|
backend_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Modified();
|
this->Modified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void vtkPVblockMeshReader::SetShowPointNumbers(const int val)
|
void vtkPVblockMeshReader::SetShowPatchNames(bool val)
|
||||||
|
{
|
||||||
|
if (ShowPatchNames != val)
|
||||||
|
{
|
||||||
|
ShowPatchNames = val;
|
||||||
|
updatePatchNamesView(ShowPatchNames);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void vtkPVblockMeshReader::SetShowPointNumbers(bool val)
|
||||||
{
|
{
|
||||||
if (ShowPointNumbers != val)
|
if (ShowPointNumbers != val)
|
||||||
{
|
{
|
||||||
@ -242,6 +245,38 @@ void vtkPVblockMeshReader::SetShowPointNumbers(const int val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void vtkPVblockMeshReader::updatePatchNamesView(const bool show)
|
||||||
|
{
|
||||||
|
pqApplicationCore* appCore = pqApplicationCore::instance();
|
||||||
|
|
||||||
|
// Need to check this, since our destructor calls this
|
||||||
|
if (!appCore)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Server manager model for querying items in the server manager
|
||||||
|
pqServerManagerModel* smModel = appCore->getServerManagerModel();
|
||||||
|
if (!smModel || !backend_)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get all the pqRenderView instances
|
||||||
|
QList<pqRenderView*> renderViews = smModel->findItems<pqRenderView*>();
|
||||||
|
for (int viewI=0; viewI<renderViews.size(); ++viewI)
|
||||||
|
{
|
||||||
|
backend_->renderPatchNames
|
||||||
|
(
|
||||||
|
renderViews[viewI]->getRenderViewProxy()->GetRenderer(),
|
||||||
|
show
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use refresh here?
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void vtkPVblockMeshReader::updatePointNumbersView(const bool show)
|
void vtkPVblockMeshReader::updatePointNumbersView(const bool show)
|
||||||
{
|
{
|
||||||
pqApplicationCore* appCore = pqApplicationCore::instance();
|
pqApplicationCore* appCore = pqApplicationCore::instance();
|
||||||
@ -254,17 +289,16 @@ void vtkPVblockMeshReader::updatePointNumbersView(const bool show)
|
|||||||
|
|
||||||
// Server manager model for querying items in the server manager
|
// Server manager model for querying items in the server manager
|
||||||
pqServerManagerModel* smModel = appCore->getServerManagerModel();
|
pqServerManagerModel* smModel = appCore->getServerManagerModel();
|
||||||
if (!smModel || !foamData_)
|
if (!smModel || !backend_)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Get all the pqRenderView instances
|
// Get all the pqRenderView instances
|
||||||
QList<pqRenderView*> renderViews = smModel->findItems<pqRenderView*>();
|
QList<pqRenderView*> renderViews = smModel->findItems<pqRenderView*>();
|
||||||
for (int viewI=0; viewI<renderViews.size(); ++viewI)
|
for (int viewI=0; viewI<renderViews.size(); ++viewI)
|
||||||
{
|
{
|
||||||
foamData_->renderPointNumbers
|
backend_->renderPointNumbers
|
||||||
(
|
(
|
||||||
renderViews[viewI]->getRenderViewProxy()->GetRenderer(),
|
renderViews[viewI]->getRenderViewProxy()->GetRenderer(),
|
||||||
show
|
show
|
||||||
@ -283,7 +317,7 @@ void vtkPVblockMeshReader::PrintSelf(ostream& os, vtkIndent indent)
|
|||||||
os << indent << "File name: "
|
os << indent << "File name: "
|
||||||
<< (this->FileName ? this->FileName : "(none)") << "\n";
|
<< (this->FileName ? this->FileName : "(none)") << "\n";
|
||||||
|
|
||||||
foamData_->PrintSelf(os, indent);
|
backend_->PrintSelf(os, indent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -292,39 +326,30 @@ void vtkPVblockMeshReader::PrintSelf(ostream& os, vtkIndent indent)
|
|||||||
|
|
||||||
vtkDataArraySelection* vtkPVblockMeshReader::GetBlockSelection()
|
vtkDataArraySelection* vtkPVblockMeshReader::GetBlockSelection()
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetBlockSelection");
|
|
||||||
return BlockSelection;
|
return BlockSelection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int vtkPVblockMeshReader::GetNumberOfBlockArrays()
|
int vtkPVblockMeshReader::GetNumberOfBlockArrays()
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetNumberOfBlockArrays");
|
|
||||||
return BlockSelection->GetNumberOfArrays();
|
return BlockSelection->GetNumberOfArrays();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char* vtkPVblockMeshReader::GetBlockArrayName(int index)
|
const char* vtkPVblockMeshReader::GetBlockArrayName(int index)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetBlockArrayName");
|
|
||||||
return BlockSelection->GetArrayName(index);
|
return BlockSelection->GetArrayName(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int vtkPVblockMeshReader::GetBlockArrayStatus(const char* name)
|
int vtkPVblockMeshReader::GetBlockArrayStatus(const char* name)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetBlockArrayStatus");
|
|
||||||
return BlockSelection->ArrayIsEnabled(name);
|
return BlockSelection->ArrayIsEnabled(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void vtkPVblockMeshReader::SetBlockArrayStatus
|
void vtkPVblockMeshReader::SetBlockArrayStatus
|
||||||
(
|
(
|
||||||
const char* name,
|
const char* name,
|
||||||
int status
|
int status
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"SetBlockArrayStatus");
|
|
||||||
if (status)
|
if (status)
|
||||||
{
|
{
|
||||||
BlockSelection->EnableArray(name);
|
BlockSelection->EnableArray(name);
|
||||||
@ -341,39 +366,30 @@ void vtkPVblockMeshReader::SetBlockArrayStatus
|
|||||||
|
|
||||||
vtkDataArraySelection* vtkPVblockMeshReader::GetCurvedEdgesSelection()
|
vtkDataArraySelection* vtkPVblockMeshReader::GetCurvedEdgesSelection()
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetCurvedEdgesSelection");
|
|
||||||
return CurvedEdgesSelection;
|
return CurvedEdgesSelection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int vtkPVblockMeshReader::GetNumberOfCurvedEdgesArrays()
|
int vtkPVblockMeshReader::GetNumberOfCurvedEdgesArrays()
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetNumberOfCurvedEdgesArrays");
|
|
||||||
return CurvedEdgesSelection->GetNumberOfArrays();
|
return CurvedEdgesSelection->GetNumberOfArrays();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char* vtkPVblockMeshReader::GetCurvedEdgesArrayName(int index)
|
const char* vtkPVblockMeshReader::GetCurvedEdgesArrayName(int index)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetCurvedEdgesArrayName");
|
|
||||||
return CurvedEdgesSelection->GetArrayName(index);
|
return CurvedEdgesSelection->GetArrayName(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int vtkPVblockMeshReader::GetCurvedEdgesArrayStatus(const char* name)
|
int vtkPVblockMeshReader::GetCurvedEdgesArrayStatus(const char* name)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetCurvedEdgesArrayStatus");
|
|
||||||
return CurvedEdgesSelection->ArrayIsEnabled(name);
|
return CurvedEdgesSelection->ArrayIsEnabled(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void vtkPVblockMeshReader::SetCurvedEdgesArrayStatus
|
void vtkPVblockMeshReader::SetCurvedEdgesArrayStatus
|
||||||
(
|
(
|
||||||
const char* name,
|
const char* name,
|
||||||
int status
|
int status
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"SetCurvedEdgesArrayStatus");
|
|
||||||
if (status)
|
if (status)
|
||||||
{
|
{
|
||||||
CurvedEdgesSelection->EnableArray(name);
|
CurvedEdgesSelection->EnableArray(name);
|
||||||
|
|||||||
@ -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) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -71,29 +71,34 @@ public:
|
|||||||
vtkSetStringMacro(FileName);
|
vtkSetStringMacro(FileName);
|
||||||
vtkGetStringMacro(FileName);
|
vtkGetStringMacro(FileName);
|
||||||
|
|
||||||
|
// Description:
|
||||||
|
// Display patch names
|
||||||
|
virtual void SetShowPatchNames(bool);
|
||||||
|
vtkGetMacro(ShowPatchNames, bool);
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// Display corner point labels
|
// Display corner point labels
|
||||||
virtual void SetShowPointNumbers(int);
|
virtual void SetShowPointNumbers(bool);
|
||||||
vtkGetMacro(ShowPointNumbers, int);
|
vtkGetMacro(ShowPointNumbers, bool);
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// Refresh blockMesh from changes to blockMeshDict
|
// Refresh blockMesh from changes to blockMeshDict
|
||||||
virtual void SetRefresh(int);
|
virtual void Refresh();
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// Blocks selection list control
|
// Blocks selection list control
|
||||||
vtkDataArraySelection* GetBlockSelection();
|
vtkDataArraySelection* GetBlockSelection();
|
||||||
int GetNumberOfBlockArrays();
|
int GetNumberOfBlockArrays();
|
||||||
int GetBlockArrayStatus(const char*);
|
int GetBlockArrayStatus(const char* name);
|
||||||
void SetBlockArrayStatus(const char*, int status);
|
void SetBlockArrayStatus(const char* name, int status);
|
||||||
const char* GetBlockArrayName(int index);
|
const char* GetBlockArrayName(int index);
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// CurvedEdges selection list control
|
// CurvedEdges selection list control
|
||||||
vtkDataArraySelection* GetCurvedEdgesSelection();
|
vtkDataArraySelection* GetCurvedEdgesSelection();
|
||||||
int GetNumberOfCurvedEdgesArrays();
|
int GetNumberOfCurvedEdgesArrays();
|
||||||
int GetCurvedEdgesArrayStatus(const char*);
|
int GetCurvedEdgesArrayStatus(const char* name);
|
||||||
void SetCurvedEdgesArrayStatus(const char*, int status);
|
void SetCurvedEdgesArrayStatus(const char* name, int status);
|
||||||
const char* GetCurvedEdgesArrayName(int index);
|
const char* GetCurvedEdgesArrayName(int index);
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
@ -114,22 +119,22 @@ protected:
|
|||||||
vtkPVblockMeshReader();
|
vtkPVblockMeshReader();
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
~vtkPVblockMeshReader();
|
virtual ~vtkPVblockMeshReader();
|
||||||
|
|
||||||
//- Return information about mesh, times, etc without loading anything
|
//- Return information about mesh, times, etc without loading anything
|
||||||
virtual int RequestInformation
|
virtual int RequestInformation
|
||||||
(
|
(
|
||||||
vtkInformation*,
|
vtkInformation* unusedRequest,
|
||||||
vtkInformationVector**,
|
vtkInformationVector** unusedInputVector,
|
||||||
vtkInformationVector*
|
vtkInformationVector* outputVector
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Get the mesh/fields for a particular time
|
//- Get the mesh for a particular time
|
||||||
virtual int RequestData
|
virtual int RequestData
|
||||||
(
|
(
|
||||||
vtkInformation*,
|
vtkInformation* unusedRequest,
|
||||||
vtkInformationVector**,
|
vtkInformationVector** unusedInputVector,
|
||||||
vtkInformationVector*
|
vtkInformationVector* outputVector
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Fill in additional port information
|
//- Fill in additional port information
|
||||||
@ -144,25 +149,29 @@ protected:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
vtkPVblockMeshReader(const vtkPVblockMeshReader&);
|
vtkPVblockMeshReader(const vtkPVblockMeshReader&) = delete;
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const vtkPVblockMeshReader&);
|
void operator=(const vtkPVblockMeshReader&) = delete;
|
||||||
|
|
||||||
|
//- Add/remove patch names to/from the view
|
||||||
|
void updatePatchNamesView(const bool show);
|
||||||
|
|
||||||
//- Add/remove point numbers to/from the view
|
//- Add/remove point numbers to/from the view
|
||||||
void updatePointNumbersView(const bool show);
|
void updatePointNumbersView(const bool show);
|
||||||
|
|
||||||
|
|
||||||
|
//- Show Patch Names
|
||||||
|
bool ShowPatchNames;
|
||||||
|
|
||||||
//- Show Point Numbers
|
//- Show Point Numbers
|
||||||
int ShowPointNumbers;
|
bool ShowPointNumbers;
|
||||||
|
|
||||||
vtkDataArraySelection* BlockSelection;
|
vtkDataArraySelection* BlockSelection;
|
||||||
|
|
||||||
vtkDataArraySelection* CurvedEdgesSelection;
|
vtkDataArraySelection* CurvedEdgesSelection;
|
||||||
|
|
||||||
//BTX
|
//- Backend portion of the reader
|
||||||
Foam::vtkPVblockMesh* foamData_;
|
Foam::vtkPVblockMesh* backend_;
|
||||||
//ETX
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
vtkPVblockMesh.C
|
vtkPVblockMesh.C
|
||||||
vtkPVblockMeshConvert.C
|
vtkPVblockMeshConvert.C
|
||||||
vtkPVblockMeshUtils.C
|
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libvtkPVblockMesh
|
LIB = $(FOAM_LIBBIN)/libvtkPVblockMesh-pv${ParaView_MAJOR}
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
sinclude $(GENERAL_RULES)/paraview
|
||||||
|
|
||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
${c++LESSWARN} \
|
${c++LESSWARN} \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
@ -5,12 +7,12 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/mesh/blockMesh/lnInclude \
|
-I$(LIB_SRC)/mesh/blockMesh/lnInclude \
|
||||||
-I$(ParaView_INCLUDE_DIR) \
|
-I$(ParaView_INCLUDE_DIR) \
|
||||||
-I$(ParaView_INCLUDE_DIR)/vtkkwiml \
|
-I$(ParaView_INCLUDE_DIR)/vtkkwiml \
|
||||||
-I../../vtkPVReaders/lnInclude \
|
-I../../foamPv/lnInclude \
|
||||||
-I../PVblockMeshReader
|
-I../PVblockMeshReader
|
||||||
|
|
||||||
LIB_LIBS = \
|
LIB_LIBS = \
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
-lfileFormats \
|
-lfileFormats \
|
||||||
-lblockMesh \
|
-lblockMesh \
|
||||||
-L$(FOAM_LIBBIN) -lvtkPVReaders \
|
-L$(FOAM_LIBBIN) -lfoamPv-pv${ParaView_MAJOR} \
|
||||||
$(GLIBS)
|
$(GLIBS)
|
||||||
|
|||||||
@ -1,65 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
||||||
\\/ 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/>.
|
|
||||||
|
|
||||||
InClass
|
|
||||||
vtkPVblockMesh
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef vtkOpenFOAMPoints_H
|
|
||||||
#define vtkOpenFOAMPoints_H
|
|
||||||
|
|
||||||
// VTK includes
|
|
||||||
#include "vtkPoints.h"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
inline void vtkInsertNextOpenFOAMPoint
|
|
||||||
(
|
|
||||||
vtkPoints *points,
|
|
||||||
const Foam::point& p
|
|
||||||
)
|
|
||||||
{
|
|
||||||
points->InsertNextPoint(p.x(), p.y(), p.z());
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void vtkInsertNextOpenFOAMPoint
|
|
||||||
(
|
|
||||||
vtkPoints *points,
|
|
||||||
const Foam::point& p,
|
|
||||||
const Foam::scalar scaleFactor
|
|
||||||
)
|
|
||||||
{
|
|
||||||
points->InsertNextPoint
|
|
||||||
(
|
|
||||||
p.x()*scaleFactor,
|
|
||||||
p.y()*scaleFactor,
|
|
||||||
p.z()*scaleFactor
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#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) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -28,6 +28,7 @@ License
|
|||||||
|
|
||||||
// OpenFOAM includes
|
// OpenFOAM includes
|
||||||
#include "blockMesh.H"
|
#include "blockMesh.H"
|
||||||
|
#include "blockMeshTools.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "patchZones.H"
|
#include "patchZones.H"
|
||||||
#include "OStringStream.H"
|
#include "OStringStream.H"
|
||||||
@ -47,6 +48,34 @@ namespace Foam
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
vtkTextActor* Foam::vtkPVblockMesh::createTextActor
|
||||||
|
(
|
||||||
|
const string& s,
|
||||||
|
const point& pt
|
||||||
|
)
|
||||||
|
{
|
||||||
|
vtkTextActor* txt = vtkTextActor::New();
|
||||||
|
txt->SetInput(s.c_str());
|
||||||
|
|
||||||
|
// Set text properties
|
||||||
|
vtkTextProperty* tprop = txt->GetTextProperty();
|
||||||
|
tprop->SetFontFamilyToArial();
|
||||||
|
tprop->BoldOn();
|
||||||
|
tprop->ShadowOff();
|
||||||
|
tprop->SetLineSpacing(1.0);
|
||||||
|
tprop->SetFontSize(14);
|
||||||
|
tprop->SetColor(1.0, 0.0, 1.0);
|
||||||
|
tprop->SetJustificationToCentered();
|
||||||
|
|
||||||
|
txt->GetPositionCoordinate()->SetCoordinateSystemToWorld();
|
||||||
|
txt->GetPositionCoordinate()->SetValue(pt.x(), pt.y(), pt.z());
|
||||||
|
|
||||||
|
return txt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::vtkPVblockMesh::resetCounters()
|
void Foam::vtkPVblockMesh::resetCounters()
|
||||||
@ -60,16 +89,18 @@ void Foam::vtkPVblockMesh::resetCounters()
|
|||||||
|
|
||||||
void Foam::vtkPVblockMesh::updateInfoBlocks
|
void Foam::vtkPVblockMesh::updateInfoBlocks
|
||||||
(
|
(
|
||||||
vtkDataArraySelection* arraySelection
|
vtkDataArraySelection* select
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
arrayRange& range = arrayRangeBlocks_;
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVblockMesh::updateInfoBlocks"
|
Info<< "<beg> updateInfoBlocks"
|
||||||
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "]" << endl;
|
<< " [meshPtr=" << (meshPtr_ ? "set" : "null") << "]" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
arrayRangeBlocks_.reset( arraySelection->GetNumberOfArrays() );
|
range.reset(select->GetNumberOfArrays());
|
||||||
|
|
||||||
const blockMesh& blkMesh = *meshPtr_;
|
const blockMesh& blkMesh = *meshPtr_;
|
||||||
|
|
||||||
@ -80,49 +111,46 @@ void Foam::vtkPVblockMesh::updateInfoBlocks
|
|||||||
|
|
||||||
// Display either blockI as a number or with its name
|
// Display either blockI as a number or with its name
|
||||||
// (looked up from blockMeshDict)
|
// (looked up from blockMeshDict)
|
||||||
OStringStream os;
|
OStringStream ostr;
|
||||||
blockDescriptor::write(os, blockI, blkMesh.meshDict());
|
blockDescriptor::write(ostr, blockI, blkMesh.meshDict());
|
||||||
word partName(os.str());
|
|
||||||
|
|
||||||
// append the (optional) zone name
|
// append the (optional) zone name
|
||||||
if (!blockDef.zoneName().empty())
|
if (!blockDef.zoneName().empty())
|
||||||
{
|
{
|
||||||
partName += " - " + blockDef.zoneName();
|
ostr << " - " << blockDef.zoneName();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add blockId and zoneName to GUI list
|
// Add "blockId" or "blockId - zoneName" to GUI list
|
||||||
arraySelection->AddArray(partName.c_str());
|
select->AddArray(ostr.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
arrayRangeBlocks_ += nBlocks;
|
range += nBlocks;
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
// just for debug info
|
Info<< "<end> updateInfoBlocks" << endl;
|
||||||
getSelectedArrayEntries(arraySelection);
|
|
||||||
|
|
||||||
Info<< "<end> Foam::vtkPVblockMesh::updateInfoBlocks" << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPVblockMesh::updateInfoEdges
|
void Foam::vtkPVblockMesh::updateInfoEdges
|
||||||
(
|
(
|
||||||
vtkDataArraySelection* arraySelection
|
vtkDataArraySelection* select
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
arrayRange& range = arrayRangeEdges_;
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVblockMesh::updateInfoEdges"
|
Info<< "<beg> updateInfoEdges"
|
||||||
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "]" << endl;
|
<< " [meshPtr=" << (meshPtr_ ? "set" : "null") << "]" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
arrayRangeEdges_.reset( arraySelection->GetNumberOfArrays() );
|
range.reset(select->GetNumberOfArrays());
|
||||||
|
|
||||||
const blockMesh& blkMesh = *meshPtr_;
|
const blockMesh& blkMesh = *meshPtr_;
|
||||||
const blockEdgeList& edges = blkMesh.edges();
|
const blockEdgeList& edges = blkMesh.edges();
|
||||||
|
|
||||||
const int nEdges = edges.size();
|
|
||||||
forAll(edges, edgeI)
|
forAll(edges, edgeI)
|
||||||
{
|
{
|
||||||
OStringStream ostr;
|
OStringStream ostr;
|
||||||
@ -132,17 +160,14 @@ void Foam::vtkPVblockMesh::updateInfoEdges
|
|||||||
ostr << " - " << edges[edgeI].type();
|
ostr << " - " << edges[edgeI].type();
|
||||||
|
|
||||||
// Add "beg:end - type" to GUI list
|
// Add "beg:end - type" to GUI list
|
||||||
arraySelection->AddArray(ostr.str().c_str());
|
select->AddArray(ostr.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
arrayRangeEdges_ += nEdges;
|
range += edges.size();
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
// just for debug info
|
Info<< "<end> updateInfoEdges" << endl;
|
||||||
getSelectedArrayEntries(arraySelection);
|
|
||||||
|
|
||||||
Info<< "<end> Foam::vtkPVblockMesh::updateInfoEdges" << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,8 +191,7 @@ Foam::vtkPVblockMesh::vtkPVblockMesh
|
|||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "Foam::vtkPVblockMesh::vtkPVblockMesh - "
|
Info<< "vtkPVblockMesh - " << FileName << endl;
|
||||||
<< FileName << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// avoid argList and get rootPath/caseName directly from the file
|
// avoid argList and get rootPath/caseName directly from the file
|
||||||
@ -253,17 +277,9 @@ Foam::vtkPVblockMesh::~vtkPVblockMesh()
|
|||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPVblockMesh::~vtkPVblockMesh" << endl;
|
Info<< "~vtkPVblockMesh" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hmm. pointNumberTextActors are not getting removed
|
|
||||||
//
|
|
||||||
forAll(pointNumberTextActorsPtrs_, pointi)
|
|
||||||
{
|
|
||||||
pointNumberTextActorsPtrs_[pointi]->Delete();
|
|
||||||
}
|
|
||||||
pointNumberTextActorsPtrs_.clear();
|
|
||||||
|
|
||||||
delete meshPtr_;
|
delete meshPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,25 +290,20 @@ void Foam::vtkPVblockMesh::updateInfo()
|
|||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVblockMesh::updateInfo"
|
Info<< "<beg> updateInfo"
|
||||||
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "] " << endl;
|
<< " [meshPtr=" << (meshPtr_ ? "set" : "null") << "] " << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
resetCounters();
|
resetCounters();
|
||||||
|
|
||||||
vtkDataArraySelection* blockSelection = reader_->GetBlockSelection();
|
vtkDataArraySelection* blockSelection = reader_->GetBlockSelection();
|
||||||
vtkDataArraySelection* edgeSelection = reader_->GetCurvedEdgesSelection();
|
vtkDataArraySelection* edgeSelection = reader_->GetCurvedEdgesSelection();
|
||||||
|
|
||||||
// enable 'internalMesh' on the first call
|
// preserve the enabled selections if possible
|
||||||
// or preserve the enabled selections
|
|
||||||
stringList enabledParts;
|
stringList enabledParts;
|
||||||
stringList enabledEdges;
|
stringList enabledEdges;
|
||||||
bool firstTime = false;
|
const bool firstTime = (!blockSelection->GetNumberOfArrays() && !meshPtr_);
|
||||||
if (!blockSelection->GetNumberOfArrays() && !meshPtr_)
|
if (!firstTime)
|
||||||
{
|
|
||||||
firstTime = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
enabledParts = getSelectedArrayEntries(blockSelection);
|
enabledParts = getSelectedArrayEntries(blockSelection);
|
||||||
enabledEdges = getSelectedArrayEntries(edgeSelection);
|
enabledEdges = getSelectedArrayEntries(edgeSelection);
|
||||||
@ -306,21 +317,21 @@ void Foam::vtkPVblockMesh::updateInfo()
|
|||||||
updateFoamMesh();
|
updateFoamMesh();
|
||||||
|
|
||||||
// Update mesh parts list
|
// Update mesh parts list
|
||||||
updateInfoBlocks( blockSelection );
|
updateInfoBlocks(blockSelection);
|
||||||
|
|
||||||
// Update curved edges list
|
// Update curved edges list
|
||||||
updateInfoEdges( edgeSelection );
|
updateInfoEdges(edgeSelection);
|
||||||
|
|
||||||
// restore the enabled selections
|
// restore the enabled selections
|
||||||
if (!firstTime)
|
if (!firstTime)
|
||||||
{
|
{
|
||||||
setSelectedArrayEntries(blockSelection, enabledParts);
|
setSelectedArrayEntries(blockSelection, enabledParts);
|
||||||
setSelectedArrayEntries(edgeSelection, enabledEdges);
|
setSelectedArrayEntries(edgeSelection, enabledEdges);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPVblockMesh::updateInfo" << endl;
|
Info<< "<end> updateInfo" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,7 +340,7 @@ void Foam::vtkPVblockMesh::updateFoamMesh()
|
|||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVblockMesh::updateFoamMesh" << endl;
|
Info<< "<beg> updateFoamMesh" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check to see if the OpenFOAM mesh has been created
|
// Check to see if the OpenFOAM mesh has been created
|
||||||
@ -379,7 +390,7 @@ void Foam::vtkPVblockMesh::updateFoamMesh()
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPVblockMesh::updateFoamMesh" << endl;
|
Info<< "<end> updateFoamMesh" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,10 +403,10 @@ void Foam::vtkPVblockMesh::Update
|
|||||||
reader_->UpdateProgress(0.1);
|
reader_->UpdateProgress(0.1);
|
||||||
|
|
||||||
// Set up mesh parts selection(s)
|
// Set up mesh parts selection(s)
|
||||||
updateBoolListStatus(blockStatus_, reader_->GetBlockSelection());
|
getSelected(blockStatus_, reader_->GetBlockSelection());
|
||||||
|
|
||||||
// Set up curved edges selection(s)
|
// Set up curved edges selection(s)
|
||||||
updateBoolListStatus(edgeStatus_, reader_->GetCurvedEdgesSelection());
|
getSelected(edgeStatus_, reader_->GetCurvedEdgesSelection());
|
||||||
|
|
||||||
reader_->UpdateProgress(0.2);
|
reader_->UpdateProgress(0.2);
|
||||||
|
|
||||||
@ -421,6 +432,103 @@ void Foam::vtkPVblockMesh::CleanUp()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::vtkPVblockMesh::renderPatchNames
|
||||||
|
(
|
||||||
|
vtkRenderer* renderer,
|
||||||
|
const bool show
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// always remove old actors first
|
||||||
|
forAll(patchTextActorsPtrs_, actori)
|
||||||
|
{
|
||||||
|
renderer->RemoveViewProp(patchTextActorsPtrs_[actori]);
|
||||||
|
patchTextActorsPtrs_[actori]->Delete();
|
||||||
|
}
|
||||||
|
patchTextActorsPtrs_.clear();
|
||||||
|
|
||||||
|
// the number of text actors
|
||||||
|
label nActors = 0;
|
||||||
|
|
||||||
|
if (show && meshPtr_)
|
||||||
|
{
|
||||||
|
const blockMesh& blkMesh = *meshPtr_;
|
||||||
|
const dictionary& meshDescription = blkMesh.meshDict();
|
||||||
|
const pointField& cornerPts = blkMesh.vertices();
|
||||||
|
const scalar scaleFactor = blkMesh.scaleFactor();
|
||||||
|
|
||||||
|
if (!meshDescription.found("boundary"))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 8 sides per block is plenty
|
||||||
|
patchTextActorsPtrs_.setSize(8*blkMesh.size());
|
||||||
|
|
||||||
|
// Collect all variables
|
||||||
|
dictionary varDict(meshDescription.subOrEmptyDict("namedVertices"));
|
||||||
|
varDict.merge(meshDescription.subOrEmptyDict("namedBlocks"));
|
||||||
|
|
||||||
|
// Read like boundary file
|
||||||
|
const PtrList<entry> patchesInfo(meshDescription.lookup("boundary"));
|
||||||
|
|
||||||
|
forAll(patchesInfo, patchi)
|
||||||
|
{
|
||||||
|
const entry& patchInfo = patchesInfo[patchi];
|
||||||
|
|
||||||
|
if (!patchInfo.isDict())
|
||||||
|
{
|
||||||
|
IOWarningInFunction(meshDescription)
|
||||||
|
<< "Entry " << patchInfo << " in boundary section is not a"
|
||||||
|
<< " valid dictionary."
|
||||||
|
<< endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
const word& patchName = patchInfo.keyword();
|
||||||
|
|
||||||
|
// Read block faces
|
||||||
|
faceList patchFaces = blockMeshTools::read<face>
|
||||||
|
(
|
||||||
|
patchInfo.dict().lookup("faces"),
|
||||||
|
varDict
|
||||||
|
);
|
||||||
|
|
||||||
|
forAll(patchFaces, facei)
|
||||||
|
{
|
||||||
|
const face& f = patchFaces[facei];
|
||||||
|
|
||||||
|
// Into a list for later removal
|
||||||
|
patchTextActorsPtrs_[nActors++] = createTextActor
|
||||||
|
(
|
||||||
|
patchName,
|
||||||
|
f.centre(cornerPts) * scaleFactor
|
||||||
|
);
|
||||||
|
|
||||||
|
if (nActors == patchTextActorsPtrs_.size())
|
||||||
|
{
|
||||||
|
// hit max allocated space - bail out
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nActors == patchTextActorsPtrs_.size())
|
||||||
|
{
|
||||||
|
// hit max allocated space - bail out
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
patchTextActorsPtrs_.setSize(nActors);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add text to each renderer
|
||||||
|
forAll(patchTextActorsPtrs_, actori)
|
||||||
|
{
|
||||||
|
renderer->AddViewProp(patchTextActorsPtrs_[actori]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPVblockMesh::renderPointNumbers
|
void Foam::vtkPVblockMesh::renderPointNumbers
|
||||||
(
|
(
|
||||||
vtkRenderer* renderer,
|
vtkRenderer* renderer,
|
||||||
@ -429,12 +537,12 @@ void Foam::vtkPVblockMesh::renderPointNumbers
|
|||||||
{
|
{
|
||||||
// always remove old actors first
|
// always remove old actors first
|
||||||
|
|
||||||
forAll(pointNumberTextActorsPtrs_, pointi)
|
forAll(pointTextActorsPtrs_, actori)
|
||||||
{
|
{
|
||||||
renderer->RemoveViewProp(pointNumberTextActorsPtrs_[pointi]);
|
renderer->RemoveViewProp(pointTextActorsPtrs_[actori]);
|
||||||
pointNumberTextActorsPtrs_[pointi]->Delete();
|
pointTextActorsPtrs_[actori]->Delete();
|
||||||
}
|
}
|
||||||
pointNumberTextActorsPtrs_.clear();
|
pointTextActorsPtrs_.clear();
|
||||||
|
|
||||||
if (show && meshPtr_)
|
if (show && meshPtr_)
|
||||||
{
|
{
|
||||||
@ -442,49 +550,29 @@ void Foam::vtkPVblockMesh::renderPointNumbers
|
|||||||
const pointField& cornerPts = blkMesh.vertices();
|
const pointField& cornerPts = blkMesh.vertices();
|
||||||
const scalar scaleFactor = blkMesh.scaleFactor();
|
const scalar scaleFactor = blkMesh.scaleFactor();
|
||||||
|
|
||||||
pointNumberTextActorsPtrs_.setSize(cornerPts.size());
|
pointTextActorsPtrs_.setSize(cornerPts.size());
|
||||||
forAll(cornerPts, pointi)
|
forAll(cornerPts, pointi)
|
||||||
{
|
{
|
||||||
vtkTextActor* txt = vtkTextActor::New();
|
|
||||||
|
|
||||||
// Display either pointi as a number or with its name
|
// Display either pointi as a number or with its name
|
||||||
// (looked up from blockMeshDict)
|
// (looked up from blockMeshDict)
|
||||||
{
|
OStringStream os;
|
||||||
OStringStream os;
|
blockVertex::write(os, pointi, blkMesh.meshDict());
|
||||||
blockVertex::write(os, pointi, blkMesh.meshDict());
|
|
||||||
txt->SetInput(os.str().c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set text properties
|
// Into a list for later removal
|
||||||
vtkTextProperty* tprop = txt->GetTextProperty();
|
pointTextActorsPtrs_[pointi] = createTextActor
|
||||||
tprop->SetFontFamilyToArial();
|
|
||||||
tprop->BoldOn();
|
|
||||||
tprop->ShadowOff();
|
|
||||||
tprop->SetLineSpacing(1.0);
|
|
||||||
tprop->SetFontSize(14);
|
|
||||||
tprop->SetColor(1.0, 0.0, 1.0);
|
|
||||||
tprop->SetJustificationToCentered();
|
|
||||||
|
|
||||||
// Set text to use 3-D world co-ordinates
|
|
||||||
txt->GetPositionCoordinate()->SetCoordinateSystemToWorld();
|
|
||||||
|
|
||||||
txt->GetPositionCoordinate()->SetValue
|
|
||||||
(
|
(
|
||||||
cornerPts[pointi].x()*scaleFactor,
|
os.str(),
|
||||||
cornerPts[pointi].y()*scaleFactor,
|
cornerPts[pointi]*scaleFactor
|
||||||
cornerPts[pointi].z()*scaleFactor
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add text to each renderer
|
|
||||||
renderer->AddViewProp(txt);
|
|
||||||
|
|
||||||
// Maintain a list of text labels added so that they can be
|
|
||||||
// removed later
|
|
||||||
pointNumberTextActorsPtrs_[pointi] = txt;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
// Add text to each renderer
|
||||||
|
forAll(pointTextActorsPtrs_, actori)
|
||||||
|
{
|
||||||
|
renderer->AddViewProp(pointTextActorsPtrs_[actori]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPVblockMesh::PrintSelf(ostream& os, vtkIndent indent) const
|
void Foam::vtkPVblockMesh::PrintSelf(ostream& os, vtkIndent indent) const
|
||||||
|
|||||||
@ -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) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -41,17 +41,7 @@ SourceFiles
|
|||||||
#ifndef vtkPVblockMesh_H
|
#ifndef vtkPVblockMesh_H
|
||||||
#define vtkPVblockMesh_H
|
#define vtkPVblockMesh_H
|
||||||
|
|
||||||
// do not include legacy strstream headers
|
#include "foamPvCore.H"
|
||||||
#ifndef VTK_EXCLUDE_STRSTREAM_HEADERS
|
|
||||||
# define VTK_EXCLUDE_STRSTREAM_HEADERS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "className.H"
|
|
||||||
#include "fileName.H"
|
|
||||||
#include "stringList.H"
|
|
||||||
#include "wordList.H"
|
|
||||||
|
|
||||||
#include "primitivePatch.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -83,85 +73,9 @@ template<class Type> class List;
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class vtkPVblockMesh
|
class vtkPVblockMesh
|
||||||
|
:
|
||||||
|
private foamPvCore
|
||||||
{
|
{
|
||||||
// Private classes
|
|
||||||
|
|
||||||
//- Bookkeeping for GUI checklists and the multi-block organization
|
|
||||||
class arrayRange
|
|
||||||
{
|
|
||||||
const char *name_;
|
|
||||||
int block_;
|
|
||||||
int start_;
|
|
||||||
int size_;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
arrayRange(const char *name, const int blockNo=0)
|
|
||||||
:
|
|
||||||
name_(name),
|
|
||||||
block_(blockNo),
|
|
||||||
start_(0),
|
|
||||||
size_(0)
|
|
||||||
{}
|
|
||||||
|
|
||||||
//- Return the block holding these datasets
|
|
||||||
int block() const
|
|
||||||
{
|
|
||||||
return block_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Assign block number, return previous value
|
|
||||||
int block(int blockNo)
|
|
||||||
{
|
|
||||||
int prev = block_;
|
|
||||||
block_ = blockNo;
|
|
||||||
return prev;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return block name
|
|
||||||
const char* name() const
|
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return array start index
|
|
||||||
int start() const
|
|
||||||
{
|
|
||||||
return start_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return array end index
|
|
||||||
int end() const
|
|
||||||
{
|
|
||||||
return start_ + size_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return sublist size
|
|
||||||
int size() const
|
|
||||||
{
|
|
||||||
return size_;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool empty() const
|
|
||||||
{
|
|
||||||
return !size_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Reset the size to zero and optionally assign a new start
|
|
||||||
void reset(const int startAt = 0)
|
|
||||||
{
|
|
||||||
start_ = startAt;
|
|
||||||
size_ = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Increment the size
|
|
||||||
void operator+=(const int n)
|
|
||||||
{
|
|
||||||
size_ += n;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
//- Access to the controlling vtkPVblockMeshReader
|
//- Access to the controlling vtkPVblockMeshReader
|
||||||
@ -195,109 +109,45 @@ class vtkPVblockMesh
|
|||||||
//- First instance and size of block corners (only partially used)
|
//- First instance and size of block corners (only partially used)
|
||||||
arrayRange arrayRangeCorners_;
|
arrayRange arrayRangeCorners_;
|
||||||
|
|
||||||
|
//- List of patch names for rendering to window
|
||||||
|
List<vtkTextActor*> patchTextActorsPtrs_;
|
||||||
|
|
||||||
//- List of point numbers for rendering to window
|
//- List of point numbers for rendering to window
|
||||||
List<vtkTextActor*> pointNumberTextActorsPtrs_;
|
List<vtkTextActor*> pointTextActorsPtrs_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
// Convenience method use to convert the readers from VTK 5
|
//- Create a text actor
|
||||||
// multiblock API to the current composite data infrastructure
|
static vtkTextActor* createTextActor(const string& s, const point& pt);
|
||||||
static void AddToBlock
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
vtkDataSet* dataset,
|
|
||||||
const arrayRange&,
|
|
||||||
const label datasetNo,
|
|
||||||
const std::string& datasetName
|
|
||||||
);
|
|
||||||
|
|
||||||
// Convenience method use to convert the readers from VTK 5
|
|
||||||
// multiblock API to the current composite data infrastructure
|
|
||||||
static vtkDataSet* GetDataSetFromBlock
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const arrayRange&,
|
|
||||||
const label datasetNo
|
|
||||||
);
|
|
||||||
|
|
||||||
// Convenience method use to convert the readers from VTK 5
|
|
||||||
// multiblock API to the current composite data infrastructure
|
|
||||||
static label GetNumberOfDataSets
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const arrayRange&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Update boolList from GUI selection
|
|
||||||
static void updateBoolListStatus
|
|
||||||
(
|
|
||||||
boolList&,
|
|
||||||
vtkDataArraySelection*
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Reset data counters
|
//- Reset data counters
|
||||||
void resetCounters();
|
void resetCounters();
|
||||||
|
|
||||||
// Update information helper functions
|
//- OpenFOAM mesh
|
||||||
|
void updateFoamMesh();
|
||||||
|
|
||||||
//- Internal block info
|
//- Internal block info
|
||||||
void updateInfoBlocks(vtkDataArraySelection*);
|
void updateInfoBlocks(vtkDataArraySelection* select);
|
||||||
|
|
||||||
//- Block curved edges info
|
//- Block curved edges info
|
||||||
void updateInfoEdges(vtkDataArraySelection*);
|
void updateInfoEdges(vtkDataArraySelection* select);
|
||||||
|
|
||||||
// Update helper functions
|
//- Mesh blocks
|
||||||
|
void convertMeshBlocks(vtkMultiBlockDataSet*, int& blockNo);
|
||||||
|
|
||||||
//- OpenFOAM mesh
|
//- Mesh curved edges
|
||||||
void updateFoamMesh();
|
void convertMeshEdges(vtkMultiBlockDataSet*, int& blockNo);
|
||||||
|
|
||||||
// Mesh conversion functions
|
//- Mesh corners
|
||||||
|
void convertMeshCorners(vtkMultiBlockDataSet*, int& blockNo);
|
||||||
//- Mesh blocks
|
|
||||||
void convertMeshBlocks(vtkMultiBlockDataSet*, int& blockNo);
|
|
||||||
|
|
||||||
//- Mesh curved edges
|
|
||||||
void convertMeshEdges(vtkMultiBlockDataSet*, int& blockNo);
|
|
||||||
|
|
||||||
//- Mesh corners
|
|
||||||
void convertMeshCorners(vtkMultiBlockDataSet*, int& blockNo);
|
|
||||||
|
|
||||||
|
|
||||||
// GUI selection helper functions
|
|
||||||
|
|
||||||
//- Retrieve the current selections
|
|
||||||
static wordHashSet getSelected(vtkDataArraySelection*);
|
|
||||||
|
|
||||||
//- Retrieve a sub-list of the current selections
|
|
||||||
static wordHashSet getSelected
|
|
||||||
(
|
|
||||||
vtkDataArraySelection*,
|
|
||||||
const arrayRange&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Retrieve the current selections
|
|
||||||
static stringList getSelectedArrayEntries(vtkDataArraySelection*);
|
|
||||||
|
|
||||||
//- Retrieve a sub-list of the current selections
|
|
||||||
static stringList getSelectedArrayEntries
|
|
||||||
(
|
|
||||||
vtkDataArraySelection*,
|
|
||||||
const arrayRange&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Set selection(s)
|
|
||||||
static void setSelectedArrayEntries
|
|
||||||
(
|
|
||||||
vtkDataArraySelection*,
|
|
||||||
const stringList&
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
vtkPVblockMesh(const vtkPVblockMesh&);
|
vtkPVblockMesh(const vtkPVblockMesh&) = delete;
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const vtkPVblockMesh&);
|
void operator=(const vtkPVblockMesh&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -331,6 +181,9 @@ public:
|
|||||||
//- Clean any storage
|
//- Clean any storage
|
||||||
void CleanUp();
|
void CleanUp();
|
||||||
|
|
||||||
|
//- Add/remove patch names to/from the view
|
||||||
|
void renderPatchNames(vtkRenderer*, const bool show);
|
||||||
|
|
||||||
//- Add/remove point numbers to/from the view
|
//- Add/remove point numbers to/from the view
|
||||||
void renderPointNumbers(vtkRenderer*, const bool show);
|
void renderPointNumbers(vtkRenderer*, const bool show);
|
||||||
|
|
||||||
|
|||||||
@ -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) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -30,8 +30,6 @@ License
|
|||||||
#include "blockMesh.H"
|
#include "blockMesh.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
|
|
||||||
#include "vtkOpenFOAMPoints.H"
|
|
||||||
|
|
||||||
// VTK includes
|
// VTK includes
|
||||||
#include "vtkCellArray.h"
|
#include "vtkCellArray.h"
|
||||||
#include "vtkDataArraySelection.h"
|
#include "vtkDataArraySelection.h"
|
||||||
@ -41,6 +39,26 @@ License
|
|||||||
#include "vtkUnstructuredGrid.h"
|
#include "vtkUnstructuredGrid.h"
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
//! \cond fileScope
|
||||||
|
inline static void insertNextPoint
|
||||||
|
(
|
||||||
|
vtkPoints *points,
|
||||||
|
const Foam::point& p,
|
||||||
|
const Foam::scalar scaleFactor
|
||||||
|
)
|
||||||
|
{
|
||||||
|
points->InsertNextPoint
|
||||||
|
(
|
||||||
|
p.x()*scaleFactor,
|
||||||
|
p.y()*scaleFactor,
|
||||||
|
p.z()*scaleFactor
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//! \endcond
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::vtkPVblockMesh::convertMeshBlocks
|
void Foam::vtkPVblockMesh::convertMeshBlocks
|
||||||
@ -52,14 +70,14 @@ void Foam::vtkPVblockMesh::convertMeshBlocks
|
|||||||
vtkDataArraySelection* selection = reader_->GetBlockSelection();
|
vtkDataArraySelection* selection = reader_->GetBlockSelection();
|
||||||
arrayRange& range = arrayRangeBlocks_;
|
arrayRange& range = arrayRangeBlocks_;
|
||||||
range.block(blockNo); // set output block
|
range.block(blockNo); // set output block
|
||||||
label datasetNo = 0; // restart at dataset 0
|
label datasetNo = 0; // restart at dataset 0
|
||||||
|
|
||||||
const blockMesh& blkMesh = *meshPtr_;
|
const blockMesh& blkMesh = *meshPtr_;
|
||||||
const Foam::pointField& blockPoints = blkMesh.vertices();
|
const Foam::pointField& blockPoints = blkMesh.vertices();
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVblockMesh::convertMeshBlocks" << endl;
|
Info<< "<beg> convertMeshBlocks" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
int blockI = 0;
|
int blockI = 0;
|
||||||
@ -79,19 +97,16 @@ void Foam::vtkPVblockMesh::convertMeshBlocks
|
|||||||
|
|
||||||
const blockDescriptor& blockDef = blkMesh[blockI];
|
const blockDescriptor& blockDef = blkMesh[blockI];
|
||||||
|
|
||||||
vtkUnstructuredGrid* vtkmesh = vtkUnstructuredGrid::New();
|
|
||||||
|
|
||||||
// Convert OpenFOAM mesh vertices to VTK
|
// Convert OpenFOAM mesh vertices to VTK
|
||||||
vtkPoints *vtkpoints = vtkPoints::New();
|
vtkPoints *vtkpoints = vtkPoints::New();
|
||||||
vtkpoints->Allocate( blockDef.nPoints() );
|
vtkpoints->Allocate(blockDef.nPoints());
|
||||||
const labelList& blockLabels = blockDef.blockShape();
|
const labelList& blockLabels = blockDef.blockShape();
|
||||||
|
|
||||||
vtkmesh->Allocate(1);
|
|
||||||
vtkIdType nodeIds[8];
|
vtkIdType nodeIds[8];
|
||||||
|
|
||||||
forAll(blockLabels, ptI)
|
forAll(blockLabels, ptI)
|
||||||
{
|
{
|
||||||
vtkInsertNextOpenFOAMPoint
|
insertNextPoint
|
||||||
(
|
(
|
||||||
vtkpoints,
|
vtkpoints,
|
||||||
blockPoints[blockLabels[ptI]],
|
blockPoints[blockLabels[ptI]],
|
||||||
@ -101,6 +116,8 @@ void Foam::vtkPVblockMesh::convertMeshBlocks
|
|||||||
nodeIds[ptI] = ptI;
|
nodeIds[ptI] = ptI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vtkUnstructuredGrid* vtkmesh = vtkUnstructuredGrid::New();
|
||||||
|
vtkmesh->Allocate(1);
|
||||||
vtkmesh->InsertNextCell
|
vtkmesh->InsertNextCell
|
||||||
(
|
(
|
||||||
VTK_HEXAHEDRON,
|
VTK_HEXAHEDRON,
|
||||||
@ -111,7 +128,7 @@ void Foam::vtkPVblockMesh::convertMeshBlocks
|
|||||||
vtkmesh->SetPoints(vtkpoints);
|
vtkmesh->SetPoints(vtkpoints);
|
||||||
vtkpoints->Delete();
|
vtkpoints->Delete();
|
||||||
|
|
||||||
AddToBlock
|
addToBlock
|
||||||
(
|
(
|
||||||
output, vtkmesh, range, datasetNo,
|
output, vtkmesh, range, datasetNo,
|
||||||
selection->GetArrayName(partId)
|
selection->GetArrayName(partId)
|
||||||
@ -130,7 +147,7 @@ void Foam::vtkPVblockMesh::convertMeshBlocks
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPVblockMesh::convertMeshBlocks" << endl;
|
Info<< "<end> convertMeshBlocks" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,7 +218,7 @@ void Foam::vtkPVblockMesh::convertMeshEdges
|
|||||||
vtkIdType pointIds[edgePoints.size()];
|
vtkIdType pointIds[edgePoints.size()];
|
||||||
forAll(edgePoints, ptI)
|
forAll(edgePoints, ptI)
|
||||||
{
|
{
|
||||||
vtkInsertNextOpenFOAMPoint
|
insertNextPoint
|
||||||
(
|
(
|
||||||
vtkpoints,
|
vtkpoints,
|
||||||
edgePoints[ptI],
|
edgePoints[ptI],
|
||||||
@ -220,7 +237,7 @@ void Foam::vtkPVblockMesh::convertMeshEdges
|
|||||||
vtkmesh->SetPoints(vtkpoints);
|
vtkmesh->SetPoints(vtkpoints);
|
||||||
vtkpoints->Delete();
|
vtkpoints->Delete();
|
||||||
|
|
||||||
AddToBlock
|
addToBlock
|
||||||
(
|
(
|
||||||
output, vtkmesh, range, datasetNo,
|
output, vtkmesh, range, datasetNo,
|
||||||
selection->GetArrayName(partId)
|
selection->GetArrayName(partId)
|
||||||
@ -234,7 +251,6 @@ void Foam::vtkPVblockMesh::convertMeshEdges
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// anything added?
|
// anything added?
|
||||||
if (datasetNo)
|
if (datasetNo)
|
||||||
{
|
{
|
||||||
@ -243,7 +259,7 @@ void Foam::vtkPVblockMesh::convertMeshEdges
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPVblockMesh::convertMeshEdges" << endl;
|
Info<< "<end> convertMeshEdges" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -264,7 +280,7 @@ void Foam::vtkPVblockMesh::convertMeshCorners
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVblockMesh::convertMeshCorners" << endl;
|
Info<< "<beg> convertMeshCorners" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (true) // or some flag or other condition
|
if (true) // or some flag or other condition
|
||||||
@ -279,14 +295,14 @@ void Foam::vtkPVblockMesh::convertMeshCorners
|
|||||||
vtkIdType pointId = 0;
|
vtkIdType pointId = 0;
|
||||||
forAll(blockPoints, ptI)
|
forAll(blockPoints, ptI)
|
||||||
{
|
{
|
||||||
vtkInsertNextOpenFOAMPoint
|
insertNextPoint
|
||||||
(
|
(
|
||||||
vtkpoints,
|
vtkpoints,
|
||||||
blockPoints[ptI],
|
blockPoints[ptI],
|
||||||
scaleFactor
|
scaleFactor
|
||||||
);
|
);
|
||||||
|
|
||||||
vtkcells->InsertNextCell(1, &pointId);
|
vtkcells->InsertNextCell(1, &pointId); // VTK_VERTEX
|
||||||
pointId++;
|
pointId++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,11 +312,7 @@ void Foam::vtkPVblockMesh::convertMeshCorners
|
|||||||
vtkmesh->SetVerts(vtkcells);
|
vtkmesh->SetVerts(vtkcells);
|
||||||
vtkcells->Delete();
|
vtkcells->Delete();
|
||||||
|
|
||||||
AddToBlock
|
addToBlock(output, vtkmesh, range, datasetNo, range.name());
|
||||||
(
|
|
||||||
output, vtkmesh, range, datasetNo,
|
|
||||||
arrayRangeCorners_.name()
|
|
||||||
);
|
|
||||||
vtkmesh->Delete();
|
vtkmesh->Delete();
|
||||||
|
|
||||||
datasetNo++;
|
datasetNo++;
|
||||||
@ -314,7 +326,7 @@ void Foam::vtkPVblockMesh::convertMeshCorners
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPVblockMesh::convertMeshCorners" << endl;
|
Info<< "<end> convertMeshCorners" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,357 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
||||||
\\/ 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/>.
|
|
||||||
|
|
||||||
Description
|
|
||||||
Misc helper methods and utilities
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "vtkPVblockMesh.H"
|
|
||||||
#include "vtkPVblockMeshReader.h"
|
|
||||||
|
|
||||||
// VTK includes
|
|
||||||
#include "vtkDataArraySelection.h"
|
|
||||||
#include "vtkDataSet.h"
|
|
||||||
#include "vtkMultiBlockDataSet.h"
|
|
||||||
#include "vtkInformation.h"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
//! \cond fileScope
|
|
||||||
// Extract up to the first non-word characters
|
|
||||||
inline word getFirstWord(const char* str)
|
|
||||||
{
|
|
||||||
if (str)
|
|
||||||
{
|
|
||||||
label n = 0;
|
|
||||||
while (str[n] && word::valid(str[n]))
|
|
||||||
{
|
|
||||||
++n;
|
|
||||||
}
|
|
||||||
return word(str, n, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return word::null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
//! \endcond
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
|
||||||
|
|
||||||
void Foam::vtkPVblockMesh::AddToBlock
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
vtkDataSet* dataset,
|
|
||||||
const arrayRange& range,
|
|
||||||
const label datasetNo,
|
|
||||||
const std::string& datasetName
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const int blockNo = range.block();
|
|
||||||
|
|
||||||
vtkDataObject* blockDO = output->GetBlock(blockNo);
|
|
||||||
vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
|
|
||||||
|
|
||||||
if (!block)
|
|
||||||
{
|
|
||||||
if (blockDO)
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "Block already has a vtkDataSet assigned to it"
|
|
||||||
<< endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
block = vtkMultiBlockDataSet::New();
|
|
||||||
output->SetBlock(blockNo, block);
|
|
||||||
block->Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "block[" << blockNo << "] has "
|
|
||||||
<< block->GetNumberOfBlocks()
|
|
||||||
<< " datasets prior to adding set " << datasetNo
|
|
||||||
<< " with name: " << datasetName << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
block->SetBlock(datasetNo, dataset);
|
|
||||||
|
|
||||||
// name the block when assigning dataset 0
|
|
||||||
if (datasetNo == 0)
|
|
||||||
{
|
|
||||||
output->GetMetaData(blockNo)->Set
|
|
||||||
(
|
|
||||||
vtkCompositeDataSet::NAME(),
|
|
||||||
range.name()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (datasetName.size())
|
|
||||||
{
|
|
||||||
block->GetMetaData(datasetNo)->Set
|
|
||||||
(
|
|
||||||
vtkCompositeDataSet::NAME(),
|
|
||||||
datasetName.c_str()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
vtkDataSet* Foam::vtkPVblockMesh::GetDataSetFromBlock
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const arrayRange& range,
|
|
||||||
const label datasetNo
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const int blockNo = range.block();
|
|
||||||
|
|
||||||
vtkDataObject* blockDO = output->GetBlock(blockNo);
|
|
||||||
vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
|
|
||||||
|
|
||||||
if (block)
|
|
||||||
{
|
|
||||||
return vtkDataSet::SafeDownCast(block->GetBlock(datasetNo));
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ununsed at the moment
|
|
||||||
Foam::label Foam::vtkPVblockMesh::GetNumberOfDataSets
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const arrayRange& range
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const int blockNo = range.block();
|
|
||||||
|
|
||||||
vtkDataObject* blockDO = output->GetBlock(blockNo);
|
|
||||||
vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
|
|
||||||
if (block)
|
|
||||||
{
|
|
||||||
return block->GetNumberOfBlocks();
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::wordHashSet Foam::vtkPVblockMesh::getSelected
|
|
||||||
(
|
|
||||||
vtkDataArraySelection* select
|
|
||||||
)
|
|
||||||
{
|
|
||||||
int nElem = select->GetNumberOfArrays();
|
|
||||||
wordHashSet selections(2*nElem);
|
|
||||||
|
|
||||||
for (int elemI=0; elemI < nElem; ++elemI)
|
|
||||||
{
|
|
||||||
if (select->GetArraySetting(elemI))
|
|
||||||
{
|
|
||||||
selections.insert(getFirstWord(select->GetArrayName(elemI)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return selections;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::wordHashSet Foam::vtkPVblockMesh::getSelected
|
|
||||||
(
|
|
||||||
vtkDataArraySelection* select,
|
|
||||||
const arrayRange& range
|
|
||||||
)
|
|
||||||
{
|
|
||||||
int nElem = select->GetNumberOfArrays();
|
|
||||||
wordHashSet selections(2*nElem);
|
|
||||||
|
|
||||||
for (int elemI = range.start(); elemI < range.end(); ++elemI)
|
|
||||||
{
|
|
||||||
if (select->GetArraySetting(elemI))
|
|
||||||
{
|
|
||||||
selections.insert(getFirstWord(select->GetArrayName(elemI)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return selections;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::stringList Foam::vtkPVblockMesh::getSelectedArrayEntries
|
|
||||||
(
|
|
||||||
vtkDataArraySelection* select
|
|
||||||
)
|
|
||||||
{
|
|
||||||
stringList selections(select->GetNumberOfArrays());
|
|
||||||
label nElem = 0;
|
|
||||||
|
|
||||||
forAll(selections, elemI)
|
|
||||||
{
|
|
||||||
if (select->GetArraySetting(elemI))
|
|
||||||
{
|
|
||||||
selections[nElem++] = select->GetArrayName(elemI);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
selections.setSize(nElem);
|
|
||||||
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
label nElem = select->GetNumberOfArrays();
|
|
||||||
Info<< "available(";
|
|
||||||
for (int elemI = 0; elemI < nElem; ++elemI)
|
|
||||||
{
|
|
||||||
Info<< " \"" << select->GetArrayName(elemI) << "\"";
|
|
||||||
}
|
|
||||||
Info<< " )\nselected(";
|
|
||||||
|
|
||||||
forAll(selections, elemI)
|
|
||||||
{
|
|
||||||
Info<< " " << selections[elemI];
|
|
||||||
}
|
|
||||||
Info<< " )\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
return selections;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::stringList Foam::vtkPVblockMesh::getSelectedArrayEntries
|
|
||||||
(
|
|
||||||
vtkDataArraySelection* select,
|
|
||||||
const arrayRange& range
|
|
||||||
)
|
|
||||||
{
|
|
||||||
stringList selections(range.size());
|
|
||||||
label nElem = 0;
|
|
||||||
|
|
||||||
for (int elemI = range.start(); elemI < range.end(); ++elemI)
|
|
||||||
{
|
|
||||||
if (select->GetArraySetting(elemI))
|
|
||||||
{
|
|
||||||
selections[nElem++] = select->GetArrayName(elemI);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
selections.setSize(nElem);
|
|
||||||
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "available(";
|
|
||||||
for (int elemI = range.start(); elemI < range.end(); ++elemI)
|
|
||||||
{
|
|
||||||
Info<< " \"" << select->GetArrayName(elemI) << "\"";
|
|
||||||
}
|
|
||||||
Info<< " )\nselected(";
|
|
||||||
|
|
||||||
forAll(selections, elemI)
|
|
||||||
{
|
|
||||||
Info<< " " << selections[elemI];
|
|
||||||
}
|
|
||||||
Info<< " )\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
return selections;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPVblockMesh::setSelectedArrayEntries
|
|
||||||
(
|
|
||||||
vtkDataArraySelection* select,
|
|
||||||
const stringList& selections
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const int nElem = select->GetNumberOfArrays();
|
|
||||||
select->DisableAllArrays();
|
|
||||||
|
|
||||||
// Loop through entries, setting values from selectedEntries
|
|
||||||
for (int elemI=0; elemI < nElem; ++elemI)
|
|
||||||
{
|
|
||||||
string arrayName(select->GetArrayName(elemI));
|
|
||||||
|
|
||||||
forAll(selections, elemI)
|
|
||||||
{
|
|
||||||
if (selections[elemI] == arrayName)
|
|
||||||
{
|
|
||||||
select->EnableArray(arrayName.c_str());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPVblockMesh::updateBoolListStatus
|
|
||||||
(
|
|
||||||
boolList& status,
|
|
||||||
vtkDataArraySelection* selection
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<beg> Foam::vtkPVblockMesh::updateBoolListStatus" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
const label nElem = selection->GetNumberOfArrays();
|
|
||||||
if (status.size() != nElem)
|
|
||||||
{
|
|
||||||
status.setSize(nElem);
|
|
||||||
status = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
forAll(status, elemI)
|
|
||||||
{
|
|
||||||
const int setting = selection->GetArraySetting(elemI);
|
|
||||||
|
|
||||||
status[elemI] = setting;
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< " part[" << elemI << "] = "
|
|
||||||
<< status[elemI]
|
|
||||||
<< " : " << selection->GetArrayName(elemI) << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<end> Foam::vtkPVblockMesh::updateBoolListStatus" << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
foamPvCore.C
|
||||||
|
|
||||||
|
LIB = $(FOAM_LIBBIN)/libfoamPv-pv${ParaView_MAJOR}
|
||||||
@ -1,5 +1,8 @@
|
|||||||
|
sinclude $(GENERAL_RULES)/paraview
|
||||||
|
|
||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
${c++LESSWARN} \
|
${c++LESSWARN} \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(ParaView_INCLUDE_DIR) \
|
-I$(ParaView_INCLUDE_DIR) \
|
||||||
-I$(ParaView_INCLUDE_DIR)/vtkkwiml
|
-I$(ParaView_INCLUDE_DIR)/vtkkwiml
|
||||||
|
|
||||||
@ -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) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -21,17 +21,13 @@ License
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Description
|
|
||||||
Misc helper methods and utilities
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "vtkPVReaders.H"
|
#include "foamPvCore.H"
|
||||||
|
|
||||||
// OpenFOAM includes
|
#include "memInfo.H"
|
||||||
#include "IFstream.H"
|
#include "DynamicList.H"
|
||||||
|
|
||||||
// VTK includes
|
|
||||||
#include "vtkDataArraySelection.h"
|
#include "vtkDataArraySelection.h"
|
||||||
#include "vtkDataSet.h"
|
#include "vtkDataSet.h"
|
||||||
#include "vtkMultiBlockDataSet.h"
|
#include "vtkMultiBlockDataSet.h"
|
||||||
@ -41,57 +37,28 @@ Description
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(vtkPVReaders, 0);
|
defineTypeNameAndDebug(foamPvCore, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
void Foam::foamPvCore::addToBlock
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
//! \cond fileScope
|
|
||||||
// Extract up to the first non-word characters
|
|
||||||
inline word getFirstWord(const char* str)
|
|
||||||
{
|
|
||||||
if (str)
|
|
||||||
{
|
|
||||||
label n = 0;
|
|
||||||
while (str[n] && word::valid(str[n]))
|
|
||||||
{
|
|
||||||
++n;
|
|
||||||
}
|
|
||||||
return word(str, n, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return word::null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
//! \endcond
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
|
||||||
|
|
||||||
void Foam::vtkPVReaders::AddToBlock
|
|
||||||
(
|
(
|
||||||
vtkMultiBlockDataSet* output,
|
vtkMultiBlockDataSet* output,
|
||||||
vtkDataSet* dataset,
|
vtkDataSet* dataset,
|
||||||
const partInfo& selector,
|
const arrayRange& selector,
|
||||||
const label datasetNo,
|
const label datasetNo,
|
||||||
const std::string& datasetName
|
const std::string& datasetName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const int blockNo = selector.block();
|
const int blockNo = selector.block();
|
||||||
|
|
||||||
vtkDataObject* blockDO = output->GetBlock(blockNo);
|
vtkDataObject* dataObj = output->GetBlock(blockNo);
|
||||||
vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
|
vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(dataObj);
|
||||||
|
|
||||||
if (!block)
|
if (!block)
|
||||||
{
|
{
|
||||||
if (blockDO)
|
if (dataObj)
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Block already has a vtkDataSet assigned to it"
|
<< "Block already has a vtkDataSet assigned to it"
|
||||||
@ -114,7 +81,7 @@ void Foam::vtkPVReaders::AddToBlock
|
|||||||
|
|
||||||
block->SetBlock(datasetNo, dataset);
|
block->SetBlock(datasetNo, dataset);
|
||||||
|
|
||||||
// name the block when assigning dataset 0
|
// name the output block when assigning dataset 0
|
||||||
if (datasetNo == 0)
|
if (datasetNo == 0)
|
||||||
{
|
{
|
||||||
output->GetMetaData(blockNo)->Set
|
output->GetMetaData(blockNo)->Set
|
||||||
@ -135,38 +102,19 @@ void Foam::vtkPVReaders::AddToBlock
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
vtkDataSet* Foam::vtkPVReaders::GetDataSetFromBlock
|
int Foam::foamPvCore::getNumberOfDataSets
|
||||||
(
|
(
|
||||||
vtkMultiBlockDataSet* output,
|
vtkMultiBlockDataSet* output,
|
||||||
const partInfo& selector,
|
const arrayRange& selector
|
||||||
const label datasetNo
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const int blockNo = selector.block();
|
const int blockNo = selector.block();
|
||||||
|
|
||||||
vtkDataObject* blockDO = output->GetBlock(blockNo);
|
vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast
|
||||||
vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
|
(
|
||||||
|
output->GetBlock(blockNo)
|
||||||
|
);
|
||||||
|
|
||||||
if (block)
|
|
||||||
{
|
|
||||||
return vtkDataSet::SafeDownCast(block->GetBlock(datasetNo));
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ununsed at the moment
|
|
||||||
Foam::label Foam::vtkPVReaders::GetNumberOfDataSets
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const partInfo& selector
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const int blockNo = selector.block();
|
|
||||||
|
|
||||||
vtkDataObject* blockDO = output->GetBlock(blockNo);
|
|
||||||
vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
|
|
||||||
if (block)
|
if (block)
|
||||||
{
|
{
|
||||||
return block->GetNumberOfBlocks();
|
return block->GetNumberOfBlocks();
|
||||||
@ -176,54 +124,76 @@ Foam::label Foam::vtkPVReaders::GetNumberOfDataSets
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Foam::word Foam::vtkPVReaders::getPartName(int partId)
|
int Foam::foamPvCore::getSelected
|
||||||
// {
|
(
|
||||||
// return getFirstWord(reader_->GetPartArrayName(partId));
|
boolList& status,
|
||||||
// }
|
vtkDataArraySelection* selection
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const int n = selection->GetNumberOfArrays();
|
||||||
|
if (status.size() != n)
|
||||||
|
{
|
||||||
|
status.setSize(n);
|
||||||
|
status = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
forAll(status, i)
|
||||||
|
{
|
||||||
|
const bool setting = selection->GetArraySetting(i);
|
||||||
|
if (setting)
|
||||||
|
{
|
||||||
|
++count;
|
||||||
|
}
|
||||||
|
status[i] = setting;
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::wordHashSet Foam::vtkPVReaders::getSelected
|
Foam::hashedWordList Foam::foamPvCore::getSelected
|
||||||
(
|
(
|
||||||
vtkDataArraySelection* select
|
vtkDataArraySelection* select
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int nElem = select->GetNumberOfArrays();
|
const int n = select->GetNumberOfArrays();
|
||||||
wordHashSet selections(2*nElem);
|
DynamicList<word> selected(n);
|
||||||
|
|
||||||
for (int elemI=0; elemI < nElem; ++elemI)
|
for (int i=0; i < n; ++i)
|
||||||
{
|
{
|
||||||
if (select->GetArraySetting(elemI))
|
if (select->GetArraySetting(i))
|
||||||
{
|
{
|
||||||
selections.insert(getFirstWord(select->GetArrayName(elemI)));
|
selected.append(getFirstWord(select->GetArrayName(i)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return selections;
|
return hashedWordList(selected, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::wordHashSet Foam::vtkPVReaders::getSelected
|
Foam::hashedWordList Foam::foamPvCore::getSelected
|
||||||
(
|
(
|
||||||
vtkDataArraySelection* select,
|
vtkDataArraySelection* select,
|
||||||
const partInfo& selector
|
const arrayRange& selector
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int nElem = select->GetNumberOfArrays();
|
const int n = select->GetNumberOfArrays();
|
||||||
wordHashSet selections(2*nElem);
|
DynamicList<word> selected(n);
|
||||||
|
|
||||||
for (int elemI = selector.start(); elemI < selector.end(); ++elemI)
|
for (int i = selector.start(); i < selector.end(); ++i)
|
||||||
{
|
{
|
||||||
if (select->GetArraySetting(elemI))
|
if (select->GetArraySetting(i))
|
||||||
{
|
{
|
||||||
selections.insert(getFirstWord(select->GetArrayName(elemI)));
|
selected.append(getFirstWord(select->GetArrayName(i)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return selections;
|
return hashedWordList(selected, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::stringList Foam::vtkPVReaders::getSelectedArrayEntries
|
Foam::stringList Foam::foamPvCore::getSelectedArrayEntries
|
||||||
(
|
(
|
||||||
vtkDataArraySelection* select
|
vtkDataArraySelection* select
|
||||||
)
|
)
|
||||||
@ -240,14 +210,13 @@ Foam::stringList Foam::vtkPVReaders::getSelectedArrayEntries
|
|||||||
}
|
}
|
||||||
selections.setSize(nElem);
|
selections.setSize(nElem);
|
||||||
|
|
||||||
|
if (debug > 1)
|
||||||
if (debug)
|
|
||||||
{
|
{
|
||||||
label nElem = select->GetNumberOfArrays();
|
const int n = select->GetNumberOfArrays();
|
||||||
Info<< "available(";
|
Info<< "available(";
|
||||||
for (int elemI = 0; elemI < nElem; ++elemI)
|
for (int i=0; i < n; ++i)
|
||||||
{
|
{
|
||||||
Info<< " \"" << select->GetArrayName(elemI) << "\"";
|
Info<< " \"" << select->GetArrayName(i) << "\"";
|
||||||
}
|
}
|
||||||
Info<< " )\nselected(";
|
Info<< " )\nselected(";
|
||||||
|
|
||||||
@ -262,31 +231,30 @@ Foam::stringList Foam::vtkPVReaders::getSelectedArrayEntries
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::stringList Foam::vtkPVReaders::getSelectedArrayEntries
|
Foam::stringList Foam::foamPvCore::getSelectedArrayEntries
|
||||||
(
|
(
|
||||||
vtkDataArraySelection* select,
|
vtkDataArraySelection* select,
|
||||||
const partInfo& selector
|
const arrayRange& selector
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
stringList selections(selector.size());
|
stringList selections(selector.size());
|
||||||
label nElem = 0;
|
label nElem = 0;
|
||||||
|
|
||||||
for (int elemI = selector.start(); elemI < selector.end(); ++elemI)
|
for (int i = selector.start(); i < selector.end(); ++i)
|
||||||
{
|
{
|
||||||
if (select->GetArraySetting(elemI))
|
if (select->GetArraySetting(i))
|
||||||
{
|
{
|
||||||
selections[nElem++] = select->GetArrayName(elemI);
|
selections[nElem++] = select->GetArrayName(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
selections.setSize(nElem);
|
selections.setSize(nElem);
|
||||||
|
|
||||||
|
if (debug > 1)
|
||||||
if (debug)
|
|
||||||
{
|
{
|
||||||
Info<< "available(";
|
Info<< "available(";
|
||||||
for (int elemI = selector.start(); elemI < selector.end(); ++elemI)
|
for (int i = selector.start(); i < selector.end(); ++i)
|
||||||
{
|
{
|
||||||
Info<< " \"" << select->GetArrayName(elemI) << "\"";
|
Info<< " \"" << select->GetArrayName(i) << "\"";
|
||||||
}
|
}
|
||||||
Info<< " )\nselected(";
|
Info<< " )\nselected(";
|
||||||
|
|
||||||
@ -301,19 +269,19 @@ Foam::stringList Foam::vtkPVReaders::getSelectedArrayEntries
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPVReaders::setSelectedArrayEntries
|
void Foam::foamPvCore::setSelectedArrayEntries
|
||||||
(
|
(
|
||||||
vtkDataArraySelection* select,
|
vtkDataArraySelection* select,
|
||||||
const stringList& selections
|
const stringList& selections
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const int nElem = select->GetNumberOfArrays();
|
const int n = select->GetNumberOfArrays();
|
||||||
select->DisableAllArrays();
|
select->DisableAllArrays();
|
||||||
|
|
||||||
// Loop through entries, setting values from selectedEntries
|
// Loop through entries, setting values from selectedEntries
|
||||||
for (int elemI=0; elemI < nElem; ++elemI)
|
for (int i=0; i < n; ++i)
|
||||||
{
|
{
|
||||||
string arrayName(select->GetArrayName(elemI));
|
const string arrayName(select->GetArrayName(i));
|
||||||
|
|
||||||
forAll(selections, elemI)
|
forAll(selections, elemI)
|
||||||
{
|
{
|
||||||
@ -327,7 +295,33 @@ void Foam::vtkPVReaders::setSelectedArrayEntries
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
Foam::word Foam::foamPvCore::getFirstWord(const char* str)
|
||||||
|
{
|
||||||
|
if (str)
|
||||||
|
{
|
||||||
|
label n = 0;
|
||||||
|
while (str[n] && word::valid(str[n]))
|
||||||
|
{
|
||||||
|
++n;
|
||||||
|
}
|
||||||
|
// don't need to re-check for invalid chars
|
||||||
|
return word(str, n, false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return word::null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::foamPvCore::printMemory()
|
||||||
|
{
|
||||||
|
memInfo mem;
|
||||||
|
|
||||||
|
if (mem.valid())
|
||||||
|
{
|
||||||
|
Info<< "mem peak/size/rss: " << mem << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
@ -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) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -21,44 +21,33 @@ License
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Namespace
|
|
||||||
Foam::vtkPVReaders
|
|
||||||
|
|
||||||
Description
|
Description
|
||||||
A collection of helper functions when building a reader interface in
|
Helpers for OpenFOAM reader interfaces in ParaView.
|
||||||
ParaView3.
|
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
vtkPVReaders.C
|
foamPvCore.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef vtkPVReaders_H
|
#ifndef foamPvCore_H
|
||||||
#define vtkPVReaders_H
|
#define foamPvCore_H
|
||||||
|
|
||||||
// do not include legacy strstream headers
|
|
||||||
#ifndef VTK_EXCLUDE_STRSTREAM_HEADERS
|
|
||||||
# define VTK_EXCLUDE_STRSTREAM_HEADERS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "className.H"
|
#include "className.H"
|
||||||
#include "fileName.H"
|
#include "fileName.H"
|
||||||
#include "stringList.H"
|
#include "stringList.H"
|
||||||
|
#include "boolList.H"
|
||||||
|
#include "pointList.H"
|
||||||
#include "wordList.H"
|
#include "wordList.H"
|
||||||
#include "HashSet.H"
|
#include "Hash.H"
|
||||||
|
#include "hashedWordList.H"
|
||||||
|
|
||||||
|
#include "vtkPoints.h"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * //
|
||||||
|
|
||||||
class vtkDataArraySelection;
|
class vtkDataArraySelection;
|
||||||
class vtkDataSet;
|
class vtkDataSet;
|
||||||
class vtkPoints;
|
|
||||||
class vtkPVFoamReader;
|
|
||||||
class vtkRenderer;
|
|
||||||
class vtkTextActor;
|
|
||||||
class vtkMultiBlockDataSet;
|
class vtkMultiBlockDataSet;
|
||||||
class vtkPolyData;
|
|
||||||
class vtkUnstructuredGrid;
|
|
||||||
class vtkIndent;
|
class vtkIndent;
|
||||||
|
|
||||||
|
|
||||||
@ -66,13 +55,20 @@ class vtkIndent;
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
namespace vtkPVReaders
|
|
||||||
{
|
|
||||||
//- Declare name of the class and its debug switch
|
|
||||||
NamespaceName("vtkPVReaders");
|
|
||||||
|
|
||||||
//- Bookkeeping for GUI checklists and the multi-block organization
|
class IOobjectList;
|
||||||
class partInfo
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class foamPvCore Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class foamPvCore
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Bookkeeping for GUI checklists and multi-block organization
|
||||||
|
// Works like a SubList selection.
|
||||||
|
class arrayRange
|
||||||
{
|
{
|
||||||
const char *name_;
|
const char *name_;
|
||||||
int block_;
|
int block_;
|
||||||
@ -81,11 +77,12 @@ namespace vtkPVReaders
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
partInfo(const char *name, const int blockNo=0)
|
//- Construct with given name for the specified block
|
||||||
|
arrayRange(const char *name, const int blockNo=0)
|
||||||
:
|
:
|
||||||
name_(name),
|
name_(name),
|
||||||
block_(blockNo),
|
block_(blockNo),
|
||||||
start_(-1),
|
start_(0),
|
||||||
size_(0)
|
size_(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -103,42 +100,47 @@ namespace vtkPVReaders
|
|||||||
return prev;
|
return prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Return the name
|
||||||
const char* name() const
|
const char* name() const
|
||||||
{
|
{
|
||||||
return name_;
|
return name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- The array start index
|
||||||
int start() const
|
int start() const
|
||||||
{
|
{
|
||||||
return start_;
|
return start_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- The array end index
|
||||||
int end() const
|
int end() const
|
||||||
{
|
{
|
||||||
return start_ + size_;
|
return start_ + size_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- The sub-list size
|
||||||
int size() const
|
int size() const
|
||||||
{
|
{
|
||||||
return size_;
|
return size_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- True if the sub-list is empty
|
||||||
bool empty() const
|
bool empty() const
|
||||||
{
|
{
|
||||||
return !size_;
|
return !size_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset()
|
//- Reset the size to zero and optionally assign a new start
|
||||||
|
void reset(const int startAt = 0)
|
||||||
{
|
{
|
||||||
start_ = -1;
|
start_ = startAt;
|
||||||
size_ = 0;
|
size_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Assign new start and reset the size
|
//- Assign new start and reset the size
|
||||||
void operator=(const int i)
|
void operator=(const int i)
|
||||||
{
|
{
|
||||||
start_ = i;
|
reset(i);
|
||||||
size_ = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Increment the size
|
//- Increment the size
|
||||||
@ -146,81 +148,132 @@ namespace vtkPVReaders
|
|||||||
{
|
{
|
||||||
size_ += n;
|
size_ += n;
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
}; // End class arrayRange
|
||||||
|
|
||||||
|
|
||||||
//- Convenience method use to convert the readers from VTK 5
|
private:
|
||||||
// multiblock API to the current composite data infrastructure
|
|
||||||
void AddToBlock
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
foamPvCore(const foamPvCore&) = delete;
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const foamPvCore&) = delete;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Static data members
|
||||||
|
ClassName("foamPvCore");
|
||||||
|
|
||||||
|
|
||||||
|
//- Construct null
|
||||||
|
foamPvCore()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
//- Convenience method for the VTK multiblock API
|
||||||
|
static void addToBlock
|
||||||
(
|
(
|
||||||
vtkMultiBlockDataSet* output,
|
vtkMultiBlockDataSet* output,
|
||||||
vtkDataSet* dataset,
|
vtkDataSet* dataset,
|
||||||
const partInfo& selector,
|
const arrayRange& selector,
|
||||||
const label datasetNo,
|
const label datasetNo,
|
||||||
const std::string& datasetName
|
const std::string& datasetName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Convenience method for the VTK multiblock API
|
||||||
//- Convenience method use to convert the readers from VTK 5
|
// Always returns a nullptr if datasetNo is negative
|
||||||
// multiblock API to the current composite data infrastructure
|
template<class Type=vtkDataSet>
|
||||||
vtkDataSet* GetDataSetFromBlock
|
static Type* getDataFromBlock
|
||||||
(
|
(
|
||||||
vtkMultiBlockDataSet* output,
|
vtkMultiBlockDataSet* output,
|
||||||
const partInfo& selector,
|
const arrayRange& selector,
|
||||||
const label datasetNo
|
const label datasetNo
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Convenience method use to convert the readers from VTK 5
|
//- Convenience method for the VTK multiblock API
|
||||||
// multiblock API to the current composite data infrastructure
|
static int getNumberOfDataSets
|
||||||
// ununsed at the moment
|
|
||||||
label GetNumberOfDataSets
|
|
||||||
(
|
(
|
||||||
vtkMultiBlockDataSet* output,
|
vtkMultiBlockDataSet* output,
|
||||||
const partInfo& selector
|
const arrayRange& selector
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Add objects of Type to array selection
|
||||||
|
template<class Type>
|
||||||
|
static label addToSelection
|
||||||
|
(
|
||||||
|
vtkDataArraySelection* select,
|
||||||
|
const IOobjectList& objects,
|
||||||
|
const string& suffix = string::null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Retrieve the current selections into a boolList
|
||||||
|
static int getSelected
|
||||||
|
(
|
||||||
|
boolList& lst,
|
||||||
|
vtkDataArraySelection* select
|
||||||
|
);
|
||||||
|
|
||||||
//- Retrieve the current selections as a wordHashSet
|
//- Retrieve the current selections as a wordHashSet
|
||||||
wordHashSet getSelected
|
static hashedWordList getSelected
|
||||||
(
|
(
|
||||||
vtkDataArraySelection* select
|
vtkDataArraySelection* select
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Retrieve a sub-list of the current selections
|
//- Retrieve a sub-list of the current selections
|
||||||
wordHashSet getSelected
|
static hashedWordList getSelected
|
||||||
(
|
(
|
||||||
vtkDataArraySelection*,
|
vtkDataArraySelection* select,
|
||||||
const partInfo&
|
const arrayRange& selector
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Retrieve the current selections
|
//- Retrieve the current selections
|
||||||
stringList getSelectedArrayEntries(vtkDataArraySelection*);
|
static stringList getSelectedArrayEntries
|
||||||
|
(
|
||||||
|
vtkDataArraySelection* select
|
||||||
|
);
|
||||||
|
|
||||||
//- Retrieve a sub-list of the current selections
|
//- Retrieve a sub-list of the current selections
|
||||||
stringList getSelectedArrayEntries
|
static stringList getSelectedArrayEntries
|
||||||
(
|
(
|
||||||
vtkDataArraySelection* select,
|
vtkDataArraySelection* select,
|
||||||
const partInfo& selector
|
const arrayRange& selector
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Set selection(s)
|
//- Set selection(s)
|
||||||
void setSelectedArrayEntries
|
static void setSelectedArrayEntries
|
||||||
(
|
(
|
||||||
vtkDataArraySelection*,
|
vtkDataArraySelection* select,
|
||||||
const stringList&
|
const stringList& selections
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Extract up to the first non-word characters
|
||||||
|
static word getFirstWord(const char* str);
|
||||||
|
|
||||||
|
//- Simple memory used debugging information
|
||||||
|
static void printMemory();
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace vtkPV
|
}; // End class foamPvCore
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
#include "foamPvCoreTemplates.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -2,7 +2,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) 2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -23,43 +23,57 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef vtkPVFoamAddToSelection_H
|
|
||||||
#define vtkPVFoamAddToSelection_H
|
|
||||||
|
|
||||||
// OpenFOAM includes
|
|
||||||
#include "IOobjectList.H"
|
#include "IOobjectList.H"
|
||||||
#include "SortableList.H"
|
|
||||||
|
|
||||||
// VTK includes
|
|
||||||
#include "vtkDataArraySelection.h"
|
#include "vtkDataArraySelection.h"
|
||||||
|
#include "vtkMultiBlockDataSet.h"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::label Foam::vtkPVFoam::addToSelection
|
Type* Foam::foamPvCore::getDataFromBlock
|
||||||
|
(
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
const arrayRange& selector,
|
||||||
|
const label datasetNo
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const int blockNo = selector.block();
|
||||||
|
|
||||||
|
vtkMultiBlockDataSet* block =
|
||||||
|
(
|
||||||
|
datasetNo < 0
|
||||||
|
? nullptr
|
||||||
|
: vtkMultiBlockDataSet::SafeDownCast(output->GetBlock(blockNo))
|
||||||
|
);
|
||||||
|
|
||||||
|
if (block)
|
||||||
|
{
|
||||||
|
return Type::SafeDownCast(block->GetBlock(datasetNo));
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::label Foam::foamPvCore::addToSelection
|
||||||
(
|
(
|
||||||
vtkDataArraySelection *select,
|
vtkDataArraySelection *select,
|
||||||
const IOobjectList& objectLst,
|
const IOobjectList& objects,
|
||||||
const string& suffix
|
const string& suffix
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
SortableList<word> names(objectLst.names(Type::typeName));
|
const wordList names = objects.sortedNames(Type::typeName);
|
||||||
|
|
||||||
forAll(names, nameI)
|
forAll(names, i)
|
||||||
{
|
{
|
||||||
if (suffix.size())
|
if (suffix.empty())
|
||||||
{
|
{
|
||||||
select->AddArray
|
select->AddArray(names[i].c_str());
|
||||||
(
|
|
||||||
(names[nameI] + suffix).c_str()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
select->AddArray
|
select->AddArray((names[i] + suffix).c_str());
|
||||||
(
|
|
||||||
(names[nameI]).c_str()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,8 +81,4 @@ Foam::label Foam::vtkPVFoam::addToSelection
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
@ -2,7 +2,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) 2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -21,36 +21,57 @@ License
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
InClass
|
Description
|
||||||
vtkPVFoam
|
Helpers for OpenFOAM reader interfaces in ParaView.
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef vtkOpenFOAMTupleRemap_H
|
#ifndef foamPvFields_H
|
||||||
#define vtkOpenFOAMTupleRemap_H
|
#define foamPvFields_H
|
||||||
|
|
||||||
// OpenFOAM includes
|
#include "volFields.H"
|
||||||
#include "Swap.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
namespace Foam
|
||||||
inline void vtkOpenFOAMTupleRemap(float vec[]);
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class foamPvFields Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class foamPvFields
|
||||||
|
{
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
foamPvFields(const foamPvFields&) = delete;
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const foamPvFields&) = delete;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Remapping for some data types
|
||||||
|
template<class Type>
|
||||||
|
inline static void remapTuple(float vec[])
|
||||||
|
{}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
}; // End class foamPvFields
|
||||||
|
|
||||||
|
|
||||||
// Template specialization for symmTensor
|
// Template specialization for symmTensor
|
||||||
template<>
|
template<>
|
||||||
inline void vtkOpenFOAMTupleRemap<Foam::symmTensor>(float vec[])
|
inline void Foam::foamPvFields::remapTuple<Foam::symmTensor>(float vec[])
|
||||||
{
|
{
|
||||||
Foam::Swap(vec[1], vec[3]); // swap XY <-> YY
|
Foam::Swap(vec[1], vec[3]); // swap XY <-> YY
|
||||||
Foam::Swap(vec[2], vec[5]); // swap XZ <-> ZZ
|
Foam::Swap(vec[2], vec[5]); // swap XZ <-> ZZ
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
} // End namespace Foam
|
||||||
inline void vtkOpenFOAMTupleRemap(float vec[])
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
vtkPVReaders.C
|
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libvtkPVReaders
|
|
||||||
@ -148,8 +148,9 @@ runParallel()
|
|||||||
|
|
||||||
# Store any parsed additional arguments e.g. decomposeParDict
|
# Store any parsed additional arguments e.g. decomposeParDict
|
||||||
APP_PARARGS=
|
APP_PARARGS=
|
||||||
# Check the default decomposeParDict if available
|
|
||||||
nProcs=$(getNumberOfProcessors system/decomposeParDict)
|
# Initialise number of procs to unset value
|
||||||
|
nProcs=-1
|
||||||
|
|
||||||
# Parse options and executable
|
# Parse options and executable
|
||||||
while [ $# -gt 0 ] && [ -z "$APP_RUN" ]; do
|
while [ $# -gt 0 ] && [ -z "$APP_RUN" ]; do
|
||||||
@ -185,6 +186,8 @@ runParallel()
|
|||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
[ "$nProcs" -eq -1 ] && nProcs=$(getNumberOfProcessors system/decomposeParDict)
|
||||||
|
|
||||||
if [ -f log.$LOG_SUFFIX ] && [ "$LOG_IGNORE" = "false" ]
|
if [ -f log.$LOG_SUFFIX ] && [ "$LOG_IGNORE" = "false" ]
|
||||||
then
|
then
|
||||||
echo "$APP_NAME already run on $PWD:" \
|
echo "$APP_NAME already run on $PWD:" \
|
||||||
@ -213,7 +216,7 @@ cloneCase()
|
|||||||
else
|
else
|
||||||
echo "Cloning $2 case from $1"
|
echo "Cloning $2 case from $1"
|
||||||
mkdir $2
|
mkdir $2
|
||||||
cpfiles="0 system constant"
|
cpfiles="0.orig 0 system constant"
|
||||||
for f in $cpfiles
|
for f in $cpfiles
|
||||||
do
|
do
|
||||||
\cp -r $1/$f $2
|
\cp -r $1/$f $2
|
||||||
|
|||||||
@ -1,10 +1,9 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
cd ${0%/*} || exit 1 # Run from this directory
|
cd ${0%/*} || exit 1 # Run from this directory
|
||||||
|
|
||||||
[ -d "$WM_PROJECT_DIR" ] || {
|
[ -d "$WM_PROJECT_DIR" ] || {
|
||||||
echo " Error: WM_PROJECT_DIR directory does not exist"
|
echo "Error (${0##*/}) : no \$WM_PROJECT_DIR found"
|
||||||
echo " Check the OpenFOAM entries in your dot-files and source them."
|
echo " Check your OpenFOAM environment and installation"
|
||||||
echo " WM_PROJECT_DIR=$WM_PROJECT_DIR"
|
echo " WM_PROJECT_DIR=$WM_PROJECT_DIR"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -15,29 +14,29 @@ usage() {
|
|||||||
|
|
||||||
usage: ${0##*/} [OPTION]
|
usage: ${0##*/} [OPTION]
|
||||||
options:
|
options:
|
||||||
-online use the links to the Github repositories instead of the local source code
|
-online use links to the Github repositories instead of the local source code
|
||||||
-help
|
-help
|
||||||
|
|
||||||
USAGE
|
USAGE
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
defineURL() {
|
defineURL() {
|
||||||
|
WEB_PATH="https://develop.openfoam.com"
|
||||||
|
FOAM_REPO_VERSION="$WM_PROJECT-plus"
|
||||||
|
|
||||||
WEB_PATH="https://develop.openfoam.com"
|
case "$WM_PROJECT_VERSION" in
|
||||||
FOAM_REPO_VERSION="$WM_PROJECT-plus"
|
v[1-9][.0-9]*)
|
||||||
|
FOAM_REPO_TAG="$WM_PROJECT-$WM_PROJECT_VERSION"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
FOAM_REPO_TAG="master"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
case "$WM_PROJECT_VERSION" in
|
export FOAM_BASE_REPO="$WEB_PATH/Development/$FOAM_REPO_VERSION"
|
||||||
v[0-9].[0-9]+)
|
export FOAM_ONLINE_REPO="$FOAM_BASE_REPO/blob/${FOAM_REPO_TAG}"
|
||||||
FOAM_REPO_TAG="$WM_PROJECT-$WM_PROJECT_VERSION"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
FOAM_REPO_TAG="master"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
export FOAM_BASE_REPO="$WEB_PATH/Development/$FOAM_REPO_VERSION"
|
|
||||||
export FOAM_ONLINE_REPO="$FOAM_BASE_REPO/blob/${FOAM_REPO_TAG}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# parse options
|
# parse options
|
||||||
@ -49,12 +48,12 @@ do
|
|||||||
;;
|
;;
|
||||||
-online)
|
-online)
|
||||||
defineURL
|
defineURL
|
||||||
shift
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
usage "unknown option/argument: '$*'"
|
usage "unknown option/argument: '$1'"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
25
src/Allwmake
25
src/Allwmake
@ -1,21 +1,20 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
cd ${0%/*} || exit 1 # Run from this directory
|
# Run from OPENFOAM src/ directory only
|
||||||
|
cd ${0%/*} && wmakeCheckPwd "$WM_PROJECT_DIR/src" 2>/dev/null || {
|
||||||
|
echo "Error (${0##*/}) : not located in \$WM_PROJECT_DIR/src"
|
||||||
|
echo " Check your OpenFOAM environment and installation"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
[ -n "$FOAM_EXT_LIBBIN" ] || {
|
||||||
|
echo "Error (${0##*/}) : FOAM_EXT_LIBBIN not set"
|
||||||
|
echo " Check your OpenFOAM environment and installation"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
# Parse arguments for library compilation
|
# Parse arguments for library compilation
|
||||||
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
||||||
|
|
||||||
wmakeCheckPwd "$WM_PROJECT_DIR/src" || {
|
#------------------------------------------------------------------------------
|
||||||
echo "Allwmake error: Current directory is not \$WM_PROJECT_DIR/src"
|
|
||||||
echo " The environment variables are inconsistent with the installation."
|
|
||||||
echo " Check the OpenFOAM entries in your dot-files and source them."
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
[ -n "$FOAM_EXT_LIBBIN" ] || {
|
|
||||||
echo "Allwmake error: FOAM_EXT_LIBBIN not set"
|
|
||||||
echo " Check the OpenFOAM entries in your dot-files and source them."
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Update OpenFOAM version strings if required
|
# Update OpenFOAM version strings if required
|
||||||
wmakePrintBuild -check || wrmo OpenFOAM/global/global.o 2>/dev/null
|
wmakePrintBuild -check || wrmo OpenFOAM/global/global.o 2>/dev/null
|
||||||
|
|||||||
@ -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) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -45,7 +45,15 @@ Foam::HashPtrTable<T, Key, Hash>::HashPtrTable
|
|||||||
{
|
{
|
||||||
for (const_iterator iter = ht.begin(); iter != ht.end(); ++iter)
|
for (const_iterator iter = ht.begin(); iter != ht.end(); ++iter)
|
||||||
{
|
{
|
||||||
this->insert(iter.key(), new T(**iter));
|
const T* ptr = *iter;
|
||||||
|
if (ptr)
|
||||||
|
{
|
||||||
|
this->insert(iter.key(), new T(*ptr));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->insert(iter.key(), nullptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,24 +70,24 @@ Foam::HashPtrTable<T, Key, Hash>::~HashPtrTable()
|
|||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class T, class Key, class Hash>
|
template<class T, class Key, class Hash>
|
||||||
T* Foam::HashPtrTable<T, Key, Hash>::remove(iterator& it)
|
T* Foam::HashPtrTable<T, Key, Hash>::remove(iterator& iter)
|
||||||
{
|
{
|
||||||
T* elemPtr = *it;
|
T* ptr = *iter;
|
||||||
HashTable<T*, Key, Hash>::erase(it);
|
HashTable<T*, Key, Hash>::erase(iter);
|
||||||
return elemPtr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T, class Key, class Hash>
|
template<class T, class Key, class Hash>
|
||||||
bool Foam::HashPtrTable<T, Key, Hash>::erase(iterator& it)
|
bool Foam::HashPtrTable<T, Key, Hash>::erase(iterator& iter)
|
||||||
{
|
{
|
||||||
T* elemPtr = *it;
|
T* ptr = *iter;
|
||||||
|
|
||||||
if (HashTable<T*, Key, Hash>::erase(it))
|
if (HashTable<T*, Key, Hash>::erase(iter))
|
||||||
{
|
{
|
||||||
if (elemPtr)
|
if (ptr)
|
||||||
{
|
{
|
||||||
delete elemPtr;
|
delete ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -128,7 +136,15 @@ void Foam::HashPtrTable<T, Key, Hash>::operator=
|
|||||||
|
|
||||||
for (const_iterator iter = rhs.begin(); iter != rhs.end(); ++iter)
|
for (const_iterator iter = rhs.begin(); iter != rhs.end(); ++iter)
|
||||||
{
|
{
|
||||||
this->insert(iter.key(), new T(**iter));
|
const T* ptr = *iter;
|
||||||
|
if (ptr)
|
||||||
|
{
|
||||||
|
this->insert(iter.key(), new T(*ptr));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->insert(iter.key(), nullptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -70,7 +70,7 @@ class HashPtrTable
|
|||||||
|
|
||||||
//- Read from Istream using given Istream constructor class
|
//- Read from Istream using given Istream constructor class
|
||||||
template<class INew>
|
template<class INew>
|
||||||
void read(Istream&, const INew& inewt);
|
void read(Istream& is, const INew& inewt);
|
||||||
|
|
||||||
//- Read from dictionary using given dictionary constructor class
|
//- Read from dictionary using given dictionary constructor class
|
||||||
template<class INew>
|
template<class INew>
|
||||||
@ -91,17 +91,17 @@ public:
|
|||||||
|
|
||||||
//- Construct from Istream using given Istream constructor class
|
//- Construct from Istream using given Istream constructor class
|
||||||
template<class INew>
|
template<class INew>
|
||||||
HashPtrTable(Istream&, const INew&);
|
HashPtrTable(Istream& is, const INew& inewt);
|
||||||
|
|
||||||
//- Construct from Istream using default Istream constructor class
|
//- Construct from Istream using default Istream constructor class
|
||||||
HashPtrTable(Istream&);
|
HashPtrTable(Istream& is);
|
||||||
|
|
||||||
//- Construct from dictionary using default dictionary constructor
|
//- Construct from dictionary using default dictionary constructor
|
||||||
// class
|
// class
|
||||||
HashPtrTable(const dictionary&);
|
HashPtrTable(const dictionary& dict);
|
||||||
|
|
||||||
//- Construct as copy
|
//- Construct as copy
|
||||||
HashPtrTable(const HashPtrTable<T, Key, Hash>&);
|
HashPtrTable(const HashPtrTable<T, Key, Hash>& ht);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
@ -113,10 +113,10 @@ public:
|
|||||||
// Edit
|
// Edit
|
||||||
|
|
||||||
//- Remove and return the pointer specified by given iterator
|
//- Remove and return the pointer specified by given iterator
|
||||||
T* remove(iterator&);
|
T* remove(iterator& iter);
|
||||||
|
|
||||||
//- Erase an hashedEntry specified by given iterator
|
//- Erase an hashedEntry specified by given iterator
|
||||||
bool erase(iterator&);
|
bool erase(iterator& iter);
|
||||||
|
|
||||||
//- Clear all entries from table
|
//- Clear all entries from table
|
||||||
void clear();
|
void clear();
|
||||||
@ -127,7 +127,8 @@ public:
|
|||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
|
|
||||||
void operator=(const HashPtrTable<T, Key, Hash>&);
|
//- Copy assignment
|
||||||
|
void operator=(const HashPtrTable<T, Key, Hash>& rhs);
|
||||||
|
|
||||||
|
|
||||||
// IOstream Operators
|
// IOstream Operators
|
||||||
|
|||||||
@ -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-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -61,7 +61,7 @@ void Foam::HashPtrTable<T, Key, Hash>::read(Istream& is, const INew& inewt)
|
|||||||
|
|
||||||
if (delimiter == token::BEGIN_LIST)
|
if (delimiter == token::BEGIN_LIST)
|
||||||
{
|
{
|
||||||
for (label i=0; i<s; i++)
|
for (label i=0; i<s; ++i)
|
||||||
{
|
{
|
||||||
Key key;
|
Key key;
|
||||||
is >> key;
|
is >> key;
|
||||||
@ -166,8 +166,11 @@ void Foam::HashPtrTable<T, Key, Hash>::write(Ostream& os) const
|
|||||||
++iter
|
++iter
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const T* ptr = iter();
|
const T* ptr = *iter;
|
||||||
ptr->write(os);
|
if (ptr)
|
||||||
|
{
|
||||||
|
ptr->write(os);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,7 +229,14 @@ Foam::Ostream& Foam::operator<<
|
|||||||
++iter
|
++iter
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
os << iter.key() << token::SPACE << *iter() << nl;
|
const T* ptr = *iter;
|
||||||
|
|
||||||
|
os << iter.key();
|
||||||
|
if (ptr)
|
||||||
|
{
|
||||||
|
os << token::SPACE << *ptr;
|
||||||
|
}
|
||||||
|
os << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write end delimiter
|
// Write end delimiter
|
||||||
|
|||||||
@ -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) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -144,10 +144,10 @@ class HashTable
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
hashedEntry(const hashedEntry&);
|
hashedEntry(const hashedEntry&) = delete;
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const hashedEntry&);
|
void operator=(const hashedEntry&) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -400,10 +400,6 @@ public:
|
|||||||
//- Return non-const access to referenced object
|
//- Return non-const access to referenced object
|
||||||
inline T& object();
|
inline T& object();
|
||||||
|
|
||||||
//- Return const access to referenced object
|
|
||||||
inline const T& cobject() const;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Member operators
|
// Member operators
|
||||||
@ -413,6 +409,9 @@ public:
|
|||||||
//- Return the Key corresponding to the iterator
|
//- Return the Key corresponding to the iterator
|
||||||
inline const Key& key() const;
|
inline const Key& key() const;
|
||||||
|
|
||||||
|
//- Return const access to referenced object
|
||||||
|
inline const T& cobject() const;
|
||||||
|
|
||||||
//- Compare hashedEntry element pointers
|
//- Compare hashedEntry element pointers
|
||||||
inline bool operator==(const iteratorBase&) const;
|
inline bool operator==(const iteratorBase&) const;
|
||||||
inline bool operator!=(const iteratorBase&) const;
|
inline bool operator!=(const iteratorBase&) const;
|
||||||
@ -460,11 +459,14 @@ public:
|
|||||||
|
|
||||||
// Member operators
|
// Member operators
|
||||||
|
|
||||||
//- Return referenced hash value
|
//- Return non-const access to referenced object
|
||||||
|
using iteratorBase::object;
|
||||||
|
|
||||||
|
//- Return non-const access to referenced object
|
||||||
inline T& operator*();
|
inline T& operator*();
|
||||||
inline T& operator()();
|
inline T& operator()();
|
||||||
|
|
||||||
//- Return referenced hash value
|
//- Return const access to referenced object
|
||||||
inline const T& operator*() const;
|
inline const T& operator*() const;
|
||||||
inline const T& operator()() const;
|
inline const T& operator()() const;
|
||||||
|
|
||||||
@ -518,13 +520,12 @@ public:
|
|||||||
|
|
||||||
// Member operators
|
// Member operators
|
||||||
|
|
||||||
//- Return referenced hash value
|
//- Return const access to referenced object
|
||||||
inline const T& operator*() const;
|
inline const T& operator*() const;
|
||||||
inline const T& operator()() const;
|
inline const T& operator()() const;
|
||||||
|
|
||||||
inline const_iterator& operator++();
|
inline const_iterator& operator++();
|
||||||
inline const_iterator operator++(int);
|
inline const_iterator operator++(int);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -64,7 +64,7 @@ Foam::Istream& Foam::operator>>(Istream& is, List<T>& L)
|
|||||||
}
|
}
|
||||||
else if (firstToken.isLabel())
|
else if (firstToken.isLabel())
|
||||||
{
|
{
|
||||||
label s = firstToken.labelToken();
|
const label s = firstToken.labelToken();
|
||||||
|
|
||||||
// Set list length to that read
|
// Set list length to that read
|
||||||
L.setSize(s);
|
L.setSize(s);
|
||||||
|
|||||||
@ -183,7 +183,7 @@ bool Foam::UList<T>::operator<(const UList<T>& a) const
|
|||||||
(
|
(
|
||||||
const_iterator vi = begin(), ai = a.begin();
|
const_iterator vi = begin(), ai = a.begin();
|
||||||
vi < end() && ai < a.end();
|
vi < end() && ai < a.end();
|
||||||
vi++, ai++
|
++vi, ++ai
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (*vi < *ai)
|
if (*vi < *ai)
|
||||||
|
|||||||
@ -427,7 +427,7 @@ inline void reverse(UList<T>&);
|
|||||||
// \endcode
|
// \endcode
|
||||||
// \sa forAllReverse
|
// \sa forAllReverse
|
||||||
#define forAll(list, i) \
|
#define forAll(list, i) \
|
||||||
for (Foam::label i=0; i<(list).size(); i++)
|
for (Foam::label i=0; i<(list).size(); ++i)
|
||||||
|
|
||||||
//- Reverse loop across all elements in \a list
|
//- Reverse loop across all elements in \a list
|
||||||
// \par Usage
|
// \par Usage
|
||||||
@ -439,7 +439,7 @@ inline void reverse(UList<T>&);
|
|||||||
// \endcode
|
// \endcode
|
||||||
// \sa forAll
|
// \sa forAll
|
||||||
#define forAllReverse(list, i) \
|
#define forAllReverse(list, i) \
|
||||||
for (Foam::label i=(list).size()-1; i>=0; i--)
|
for (Foam::label i=(list).size()-1; i>=0; --i)
|
||||||
|
|
||||||
//- Iterate across all elements in the \a container object of type
|
//- Iterate across all elements in the \a container object of type
|
||||||
// \a Container.
|
// \a Container.
|
||||||
@ -472,8 +472,8 @@ inline void reverse(UList<T>&);
|
|||||||
#define forAllConstIter(Container,container,iter) \
|
#define forAllConstIter(Container,container,iter) \
|
||||||
for \
|
for \
|
||||||
( \
|
( \
|
||||||
Container::const_iterator iter = (container).begin(); \
|
Container::const_iterator iter = (container).cbegin(); \
|
||||||
iter != (container).end(); \
|
iter != (container).cend(); \
|
||||||
++iter \
|
++iter \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -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 | Copyright (C) 2015 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -33,7 +33,7 @@ template<class T>
|
|||||||
inline Foam::UList<T>::UList()
|
inline Foam::UList<T>::UList()
|
||||||
:
|
:
|
||||||
size_(0),
|
size_(0),
|
||||||
v_(0)
|
v_(nullptr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -321,7 +321,7 @@ inline bool Foam::UList<T>::empty() const
|
|||||||
template<class T>
|
template<class T>
|
||||||
inline void Foam::reverse(UList<T>& ul, const label n)
|
inline void Foam::reverse(UList<T>& ul, const label n)
|
||||||
{
|
{
|
||||||
for (int i=0; i<n/2; i++)
|
for (int i=0; i<n/2; ++i)
|
||||||
{
|
{
|
||||||
Swap(ul[i], ul[n-1-i]);
|
Swap(ul[i], ul[n-1-i]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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 | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -165,7 +165,7 @@ Foam::Istream& Foam::operator>>(Istream& is, UList<T>& L)
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
// Check list length
|
// Check list length
|
||||||
label s = elems.size();
|
const label s = elems.size();
|
||||||
|
|
||||||
if (s != L.size())
|
if (s != L.size())
|
||||||
{
|
{
|
||||||
@ -174,14 +174,14 @@ Foam::Istream& Foam::operator>>(Istream& is, UList<T>& L)
|
|||||||
<< " expected " << L.size()
|
<< " expected " << L.size()
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
for (label i=0; i<s; i++)
|
for (label i=0; i<s; ++i)
|
||||||
{
|
{
|
||||||
L[i] = elems[i];
|
L[i] = elems[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (firstToken.isLabel())
|
else if (firstToken.isLabel())
|
||||||
{
|
{
|
||||||
label s = firstToken.labelToken();
|
const label s = firstToken.labelToken();
|
||||||
|
|
||||||
// Set list length to that read
|
// Set list length to that read
|
||||||
if (s != L.size())
|
if (s != L.size())
|
||||||
@ -203,7 +203,7 @@ Foam::Istream& Foam::operator>>(Istream& is, UList<T>& L)
|
|||||||
{
|
{
|
||||||
if (delimiter == token::BEGIN_LIST)
|
if (delimiter == token::BEGIN_LIST)
|
||||||
{
|
{
|
||||||
for (label i=0; i<s; i++)
|
for (label i=0; i<s; ++i)
|
||||||
{
|
{
|
||||||
is >> L[i];
|
is >> L[i];
|
||||||
|
|
||||||
@ -226,7 +226,7 @@ Foam::Istream& Foam::operator>>(Istream& is, UList<T>& L)
|
|||||||
"reading the single entry"
|
"reading the single entry"
|
||||||
);
|
);
|
||||||
|
|
||||||
for (label i=0; i<s; i++)
|
for (label i=0; i<s; ++i)
|
||||||
{
|
{
|
||||||
L[i] = element;
|
L[i] = element;
|
||||||
}
|
}
|
||||||
@ -281,7 +281,7 @@ Foam::Istream& Foam::operator>>(Istream& is, UList<T>& L)
|
|||||||
(
|
(
|
||||||
typename SLList<T>::const_iterator iter = sll.begin();
|
typename SLList<T>::const_iterator iter = sll.begin();
|
||||||
iter != sll.end();
|
iter != sll.end();
|
||||||
++iter
|
++iter, ++i
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
L[i] = iter();
|
L[i] = iter();
|
||||||
|
|||||||
@ -2,7 +2,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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -43,27 +43,35 @@ static const unsigned char base64Chars[64] =
|
|||||||
//! \endcond
|
//! \endcond
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
std::size_t Foam::base64Layer::encodedLength(std::size_t n)
|
||||||
|
{
|
||||||
|
return 4 * ((n / 3) + (n % 3 ? 1 : 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline unsigned char Foam::base64Layer::encode0()
|
inline unsigned char Foam::base64Layer::encode0() const
|
||||||
{
|
{
|
||||||
// Top 6 bits of char0
|
// Top 6 bits of char0
|
||||||
return base64Chars[((group_[0] & 0xFC) >> 2)];
|
return base64Chars[((group_[0] & 0xFC) >> 2)];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline unsigned char Foam::base64Layer::encode1()
|
inline unsigned char Foam::base64Layer::encode1() const
|
||||||
{
|
{
|
||||||
// Bottom 2 bits of char0, Top 4 bits of char1
|
// Bottom 2 bits of char0, Top 4 bits of char1
|
||||||
return base64Chars[((group_[0] & 0x03) << 4) | ((group_[1] & 0xF0) >> 4)];
|
return base64Chars[((group_[0] & 0x03) << 4) | ((group_[1] & 0xF0) >> 4)];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline unsigned char Foam::base64Layer::encode2()
|
inline unsigned char Foam::base64Layer::encode2() const
|
||||||
{
|
{
|
||||||
// Bottom 4 bits of char1, Top 2 bits of char2
|
// Bottom 4 bits of char1, Top 2 bits of char2
|
||||||
return base64Chars[((group_[1] & 0x0F) << 2) | ((group_[2] & 0xC0) >> 6)];
|
return base64Chars[((group_[1] & 0x0F) << 2) | ((group_[2] & 0xC0) >> 6)];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline unsigned char Foam::base64Layer::encode3()
|
inline unsigned char Foam::base64Layer::encode3() const
|
||||||
{
|
{
|
||||||
// Bottom 6 bits of char2
|
// Bottom 6 bits of char2
|
||||||
return base64Chars[(group_[2] & 0x3F)];
|
return base64Chars[(group_[2] & 0x3F)];
|
||||||
|
|||||||
@ -2,7 +2,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) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -30,7 +30,7 @@ Description
|
|||||||
Base64 encoding accoding to RFC 4648 specification
|
Base64 encoding accoding to RFC 4648 specification
|
||||||
(https://tools.ietf.org/html/rfc4648#page-5).
|
(https://tools.ietf.org/html/rfc4648#page-5).
|
||||||
It is the obligation of the caller to avoid using normal output
|
It is the obligation of the caller to avoid using normal output
|
||||||
while the base-64 encoding layer is actively being used.
|
while the base-64 encoding layer is actively used.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
base64Layer.C
|
base64Layer.C
|
||||||
@ -70,10 +70,10 @@ class base64Layer
|
|||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
inline unsigned char encode0();
|
inline unsigned char encode0() const;
|
||||||
inline unsigned char encode1();
|
inline unsigned char encode1() const;
|
||||||
inline unsigned char encode2();
|
inline unsigned char encode2() const;
|
||||||
inline unsigned char encode3();
|
inline unsigned char encode3() const;
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
base64Layer(const base64Layer&) = delete;
|
base64Layer(const base64Layer&) = delete;
|
||||||
@ -95,7 +95,7 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct and attach to an output stream
|
//- Construct and attach to an output stream
|
||||||
base64Layer(std::ostream&);
|
base64Layer(std::ostream& os);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
@ -104,6 +104,10 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- The encoded length has 4 bytes out for every 3 bytes in.
|
||||||
|
static std::size_t encodedLength(std::size_t n);
|
||||||
|
|
||||||
|
|
||||||
//- Encode the character sequence, writing when possible.
|
//- Encode the character sequence, writing when possible.
|
||||||
void write(const char* s, std::streamsize n);
|
void write(const char* s, std::streamsize n);
|
||||||
|
|
||||||
@ -111,7 +115,7 @@ public:
|
|||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
//- End the encoding sequence, padding the final characters with '='.
|
//- End the encoding sequence, padding the final characters with '='.
|
||||||
// Return false if no encoding layer was actually used.
|
// Return false if no encoding was actually performed.
|
||||||
bool close();
|
bool close();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -129,7 +129,7 @@ Foam::PtrList<Foam::OFstream>& Foam::functionObjects::logFiles::files()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::OFstream& Foam::functionObjects::logFiles::file(const label i)
|
Foam::OFstream& Foam::functionObjects::logFiles::files(const label i)
|
||||||
{
|
{
|
||||||
if (!Pstream::master())
|
if (!Pstream::master())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -128,7 +128,7 @@ public:
|
|||||||
PtrList<OFstream>& files();
|
PtrList<OFstream>& files();
|
||||||
|
|
||||||
//- Return file 'i'
|
//- Return file 'i'
|
||||||
OFstream& file(const label i);
|
OFstream& files(const label i);
|
||||||
|
|
||||||
//- Write function
|
//- Write function
|
||||||
virtual bool write();
|
virtual bool write();
|
||||||
|
|||||||
@ -32,7 +32,7 @@ Description
|
|||||||
Note: cannot access the state dictionary until after construction of the
|
Note: cannot access the state dictionary until after construction of the
|
||||||
function objects, since the owner container functionObjectList is owned
|
function objects, since the owner container functionObjectList is owned
|
||||||
by time, and time owns the state dictionary. I.e. need to wait for time
|
by time, and time owns the state dictionary. I.e. need to wait for time
|
||||||
to be fully consttucted.
|
to be fully constructed.
|
||||||
|
|
||||||
See also
|
See also
|
||||||
Foam::functionObject
|
Foam::functionObject
|
||||||
|
|||||||
@ -51,7 +51,7 @@ namespace functionObjects
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class functionObjectFile Declaration
|
Class writeFile Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class writeFile
|
class writeFile
|
||||||
|
|||||||
@ -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 | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -24,105 +24,62 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "boundBox.H"
|
#include "boundBox.H"
|
||||||
#include "ListOps.H"
|
|
||||||
#include "PstreamReduceOps.H"
|
#include "PstreamReduceOps.H"
|
||||||
#include "tmp.H"
|
#include "tmp.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
const Foam::scalar Foam::boundBox::great(VGREAT);
|
|
||||||
|
|
||||||
const Foam::boundBox Foam::boundBox::greatBox
|
const Foam::boundBox Foam::boundBox::greatBox
|
||||||
(
|
(
|
||||||
point(-VGREAT, -VGREAT, -VGREAT),
|
point::uniform(-ROOTVGREAT),
|
||||||
point(VGREAT, VGREAT, VGREAT)
|
point::uniform(ROOTVGREAT)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
const Foam::boundBox Foam::boundBox::invertedBox
|
const Foam::boundBox Foam::boundBox::invertedBox
|
||||||
(
|
(
|
||||||
point(VGREAT, VGREAT, VGREAT),
|
point::uniform(ROOTVGREAT),
|
||||||
point(-VGREAT, -VGREAT, -VGREAT)
|
point::uniform(-ROOTVGREAT)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//! \cond ignoreDocumentation
|
|
||||||
//- Skip documentation : local scope only
|
|
||||||
const Foam::label facesArray[6][4] =
|
|
||||||
{
|
|
||||||
// point and face order as per hex cellmodel
|
|
||||||
{0, 4, 7, 3}, // x-min
|
|
||||||
{1, 2, 6, 5}, // x-max
|
|
||||||
{0, 1, 5, 4}, // y-min
|
|
||||||
{3, 7, 6, 2}, // y-max
|
|
||||||
{0, 3, 2, 1}, // z-min
|
|
||||||
{4, 5, 6, 7} // z-max
|
|
||||||
};
|
|
||||||
//! \endcond
|
|
||||||
|
|
||||||
|
|
||||||
const Foam::faceList Foam::boundBox::faces
|
const Foam::faceList Foam::boundBox::faces
|
||||||
(
|
({
|
||||||
initListList<face, label, 6, 4>(facesArray)
|
// Point and face order as per hex cellmodel
|
||||||
);
|
face{0, 4, 7, 3}, // x-min
|
||||||
|
face{1, 2, 6, 5}, // x-max
|
||||||
|
face{0, 1, 5, 4}, // y-min
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
face{3, 7, 6, 2}, // y-max
|
||||||
|
face{0, 3, 2, 1}, // z-min
|
||||||
void Foam::boundBox::calculate(const UList<point>& points, const bool doReduce)
|
face{4, 5, 6, 7} // z-max
|
||||||
{
|
});
|
||||||
if (points.empty())
|
|
||||||
{
|
|
||||||
min_ = Zero;
|
|
||||||
max_ = Zero;
|
|
||||||
|
|
||||||
if (doReduce && Pstream::parRun())
|
|
||||||
{
|
|
||||||
// Use values that get overwritten by reduce minOp, maxOp below
|
|
||||||
min_ = point(VGREAT, VGREAT, VGREAT);
|
|
||||||
max_ = point(-VGREAT, -VGREAT, -VGREAT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
min_ = points[0];
|
|
||||||
max_ = points[0];
|
|
||||||
|
|
||||||
|
|
||||||
for (label i = 1; i < points.size(); i++)
|
|
||||||
{
|
|
||||||
min_ = ::Foam::min(min_, points[i]);
|
|
||||||
max_ = ::Foam::max(max_, points[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reduce parallel information
|
|
||||||
if (doReduce)
|
|
||||||
{
|
|
||||||
reduce(min_, minOp<point>());
|
|
||||||
reduce(max_, maxOp<point>());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::boundBox::boundBox(const UList<point>& points, const bool doReduce)
|
Foam::boundBox::boundBox(const UList<point>& points, bool doReduce)
|
||||||
:
|
:
|
||||||
min_(Zero),
|
min_(invertedBox.min()),
|
||||||
max_(Zero)
|
max_(invertedBox.max())
|
||||||
{
|
{
|
||||||
calculate(points, doReduce);
|
add(points);
|
||||||
|
|
||||||
|
if (doReduce)
|
||||||
|
{
|
||||||
|
reduce();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::boundBox::boundBox(const tmp<pointField>& points, const bool doReduce)
|
Foam::boundBox::boundBox(const tmp<pointField>& tpoints, bool doReduce)
|
||||||
:
|
:
|
||||||
min_(Zero),
|
min_(invertedBox.min()),
|
||||||
max_(Zero)
|
max_(invertedBox.max())
|
||||||
{
|
{
|
||||||
calculate(points(), doReduce);
|
add(tpoints);
|
||||||
points.clear();
|
|
||||||
|
if (doReduce)
|
||||||
|
{
|
||||||
|
reduce();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -130,38 +87,17 @@ Foam::boundBox::boundBox
|
|||||||
(
|
(
|
||||||
const UList<point>& points,
|
const UList<point>& points,
|
||||||
const labelUList& indices,
|
const labelUList& indices,
|
||||||
const bool doReduce
|
bool doReduce
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
min_(Zero),
|
min_(invertedBox.min()),
|
||||||
max_(Zero)
|
max_(invertedBox.max())
|
||||||
{
|
{
|
||||||
if (points.empty() || indices.empty())
|
add(points, indices);
|
||||||
{
|
|
||||||
if (doReduce && Pstream::parRun())
|
|
||||||
{
|
|
||||||
// Use values that get overwritten by reduce minOp, maxOp below
|
|
||||||
min_ = point(VGREAT, VGREAT, VGREAT);
|
|
||||||
max_ = point(-VGREAT, -VGREAT, -VGREAT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
min_ = points[indices[0]];
|
|
||||||
max_ = points[indices[0]];
|
|
||||||
|
|
||||||
for (label i=1; i < indices.size(); ++i)
|
|
||||||
{
|
|
||||||
min_ = ::Foam::min(min_, points[indices[i]]);
|
|
||||||
max_ = ::Foam::max(max_, points[indices[i]]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reduce parallel information
|
|
||||||
if (doReduce)
|
if (doReduce)
|
||||||
{
|
{
|
||||||
reduce(min_, minOp<point>());
|
reduce();
|
||||||
reduce(max_, maxOp<point>());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,8 +106,8 @@ Foam::boundBox::boundBox
|
|||||||
|
|
||||||
Foam::tmp<Foam::pointField> Foam::boundBox::points() const
|
Foam::tmp<Foam::pointField> Foam::boundBox::points() const
|
||||||
{
|
{
|
||||||
tmp<pointField> tPts = tmp<pointField>(new pointField(8));
|
tmp<pointField> tpoints = tmp<pointField>(new pointField(8));
|
||||||
pointField& pt = tPts.ref();
|
pointField& pt = tpoints.ref();
|
||||||
|
|
||||||
pt[0] = min_; // min-x, min-y, min-z
|
pt[0] = min_; // min-x, min-y, min-z
|
||||||
pt[1] = point(max_.x(), min_.y(), min_.z()); // max-x, min-y, min-z
|
pt[1] = point(max_.x(), min_.y(), min_.z()); // max-x, min-y, min-z
|
||||||
@ -182,19 +118,35 @@ Foam::tmp<Foam::pointField> Foam::boundBox::points() const
|
|||||||
pt[6] = max_; // max-x, max-y, max-z
|
pt[6] = max_; // max-x, max-y, max-z
|
||||||
pt[7] = point(min_.x(), max_.y(), max_.z()); // min-x, max-y, max-z
|
pt[7] = point(min_.x(), max_.y(), max_.z()); // min-x, max-y, max-z
|
||||||
|
|
||||||
return tPts;
|
return tpoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::boundBox::inflate(const scalar s)
|
void Foam::boundBox::inflate(const scalar s)
|
||||||
{
|
{
|
||||||
vector ext = vector::one*s*mag();
|
const vector ext = vector::one*s*mag();
|
||||||
|
|
||||||
min_ -= ext;
|
min_ -= ext;
|
||||||
max_ += ext;
|
max_ += ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::boundBox::reduce()
|
||||||
|
{
|
||||||
|
Foam::reduce(min_, minOp<point>());
|
||||||
|
Foam::reduce(max_, maxOp<point>());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::boundBox::intersect(const boundBox& bb)
|
||||||
|
{
|
||||||
|
min_ = ::Foam::max(min_, bb.min_);
|
||||||
|
max_ = ::Foam::min(max_, bb.max_);
|
||||||
|
|
||||||
|
return !empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::boundBox::contains(const UList<point>& points) const
|
bool Foam::boundBox::contains(const UList<point>& points) const
|
||||||
{
|
{
|
||||||
if (points.empty())
|
if (points.empty())
|
||||||
|
|||||||
@ -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 | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -27,6 +27,11 @@ Class
|
|||||||
Description
|
Description
|
||||||
A bounding box defined in terms of the points at its extremities.
|
A bounding box defined in terms of the points at its extremities.
|
||||||
|
|
||||||
|
Note
|
||||||
|
When a bounding box is created without any points, it creates an inverted
|
||||||
|
bounding box. Points can be added later and the bounding box will grow to
|
||||||
|
include them.
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef boundBox_H
|
#ifndef boundBox_H
|
||||||
@ -60,26 +65,17 @@ class boundBox
|
|||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Minimum and maximum describing the bounding box
|
//- Minimum and maximum points describing the bounding box
|
||||||
point min_, max_;
|
point min_, max_;
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- Calculate the bounding box from the given points.
|
|
||||||
// Does parallel communication (doReduce = true)
|
|
||||||
void calculate(const UList<point>&, const bool doReduce = true);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Static data members
|
// Static data members
|
||||||
|
|
||||||
//- The great value used for greatBox and invertedBox
|
//- A large boundBox: min/max == -/+ ROOTVGREAT
|
||||||
static const scalar great;
|
|
||||||
|
|
||||||
//- A very large boundBox: min/max == -/+ VGREAT
|
|
||||||
static const boundBox greatBox;
|
static const boundBox greatBox;
|
||||||
|
|
||||||
//- A very large inverted boundBox: min/max == +/- VGREAT
|
//- A large inverted boundBox: min/max == +/- ROOTVGREAT
|
||||||
static const boundBox invertedBox;
|
static const boundBox invertedBox;
|
||||||
|
|
||||||
//- Faces to point addressing, as per a 'hex' cell
|
//- Faces to point addressing, as per a 'hex' cell
|
||||||
@ -88,49 +84,58 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null, setting points to zero
|
//- Construct without any points - an inverted bounding box
|
||||||
inline boundBox();
|
inline boundBox();
|
||||||
|
|
||||||
|
//- Construct a bounding box containing a single initial point
|
||||||
|
explicit inline boundBox(const point& pt);
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
inline boundBox(const point& min, const point& max);
|
inline boundBox(const point& min, const point& max);
|
||||||
|
|
||||||
//- Construct as the bounding box of the given points
|
//- Construct as the bounding box of the given points
|
||||||
// Does parallel communication (doReduce = true)
|
// Does parallel communication (doReduce = true)
|
||||||
boundBox(const UList<point>&, const bool doReduce = true);
|
explicit boundBox(const UList<point>& points, bool doReduce = true);
|
||||||
|
|
||||||
//- Construct as the bounding box of the given temporary pointField.
|
//- Construct as the bounding box of the given temporary pointField.
|
||||||
// Does parallel communication (doReduce = true)
|
// Does parallel communication (doReduce = true)
|
||||||
boundBox(const tmp<pointField>&, const bool doReduce = true);
|
explicit boundBox(const tmp<pointField>& tpoints, bool doReduce = true);
|
||||||
|
|
||||||
//- Construct bounding box as subset of the pointField.
|
//- Construct bounding box as an indirect subset of the points.
|
||||||
// The indices could be from cell/face etc.
|
// The indices could be from cell/face etc.
|
||||||
// Does parallel communication (doReduce = true)
|
// Does parallel communication (doReduce = true)
|
||||||
boundBox
|
boundBox
|
||||||
(
|
(
|
||||||
const UList<point>&,
|
const UList<point>& points,
|
||||||
const labelUList& indices,
|
const labelUList& indices,
|
||||||
const bool doReduce = true
|
bool doReduce = true
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct bounding box as subset of the pointField.
|
//- Construct bounding box as an indirect subset of the points.
|
||||||
// The indices could be from edge/triFace etc.
|
// The indices could be from edge/triFace etc.
|
||||||
// Does parallel communication (doReduce = true)
|
// Does parallel communication (doReduce = true)
|
||||||
template<unsigned Size>
|
template<unsigned Size>
|
||||||
boundBox
|
boundBox
|
||||||
(
|
(
|
||||||
const UList<point>&,
|
const UList<point>& points,
|
||||||
const FixedList<label, Size>& indices,
|
const FixedList<label, Size>& indices,
|
||||||
const bool doReduce = true
|
bool doReduce = true
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from Istream
|
//- Construct from Istream
|
||||||
inline boundBox(Istream&);
|
inline boundBox(Istream& is);
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
|
//- Bounding box is inverted, contains no points.
|
||||||
|
inline bool empty() const;
|
||||||
|
|
||||||
|
//- Clear bounding box of all points - make it an inverted box
|
||||||
|
inline void clear();
|
||||||
|
|
||||||
//- Minimum describing the bounding box
|
//- Minimum describing the bounding box
|
||||||
inline const point& min() const;
|
inline const point& min() const;
|
||||||
|
|
||||||
@ -170,80 +175,130 @@ public:
|
|||||||
|
|
||||||
// Manipulate
|
// Manipulate
|
||||||
|
|
||||||
|
//- Extend to include the second box.
|
||||||
|
inline void add(const boundBox& bb);
|
||||||
|
|
||||||
|
//- Extend to include the point.
|
||||||
|
inline void add(const point& pt);
|
||||||
|
|
||||||
|
//- Extend to include the points.
|
||||||
|
inline void add(const UList<point>& points);
|
||||||
|
|
||||||
|
//- Extend to include the points from the temporary point field.
|
||||||
|
inline void add(const tmp<pointField>& tpoints);
|
||||||
|
|
||||||
|
//- Extend to include the subset of the point field.
|
||||||
|
// The indices could be from cell/face etc.
|
||||||
|
inline void add
|
||||||
|
(
|
||||||
|
const UList<point>& points,
|
||||||
|
const labelUList& indices
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Extend to include the points.
|
||||||
|
template<unsigned Size>
|
||||||
|
void add(const FixedList<point, Size>& points);
|
||||||
|
|
||||||
|
//- Extend to include the subset of the point field.
|
||||||
|
// The indices could be from edge/triFace etc.
|
||||||
|
template<unsigned Size>
|
||||||
|
void add
|
||||||
|
(
|
||||||
|
const UList<point>& points,
|
||||||
|
const FixedList<label, Size>& indices
|
||||||
|
);
|
||||||
|
|
||||||
//- Inflate box by factor*mag(span) in all dimensions
|
//- Inflate box by factor*mag(span) in all dimensions
|
||||||
void inflate(const scalar s);
|
void inflate(const scalar s);
|
||||||
|
|
||||||
|
//- Parallel reduction of min/max values
|
||||||
|
void reduce();
|
||||||
|
|
||||||
|
//- Intersection (union) with the second box.
|
||||||
|
// The return value is true if the intersection is non-empty.
|
||||||
|
bool intersect(const boundBox& bb);
|
||||||
|
|
||||||
|
|
||||||
// Query
|
// Query
|
||||||
|
|
||||||
//- Overlaps/touches boundingBox?
|
//- Overlaps/touches boundingBox?
|
||||||
inline bool overlaps(const boundBox&) const;
|
inline bool overlaps(const boundBox& bb) const;
|
||||||
|
|
||||||
//- Overlaps boundingSphere (centre + sqr(radius))?
|
//- Overlaps boundingSphere (centre + sqr(radius))?
|
||||||
inline bool overlaps(const point&, const scalar radiusSqr) const;
|
inline bool overlaps
|
||||||
|
(
|
||||||
|
const point& centre,
|
||||||
|
const scalar radiusSqr
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Contains point? (inside or on edge)
|
//- Contains point? (inside or on edge)
|
||||||
inline bool contains(const point&) const;
|
inline bool contains(const point& pt) const;
|
||||||
|
|
||||||
//- Fully contains other boundingBox?
|
//- Fully contains other boundingBox?
|
||||||
inline bool contains(const boundBox&) const;
|
inline bool contains(const boundBox& bb) const;
|
||||||
|
|
||||||
//- Contains point? (inside only)
|
//- Contains point? (inside only)
|
||||||
inline bool containsInside(const point&) const;
|
inline bool containsInside(const point& pt) const;
|
||||||
|
|
||||||
//- Contains all of the points? (inside or on edge)
|
//- Contains all of the points? (inside or on edge)
|
||||||
bool contains(const UList<point>&) const;
|
bool contains(const UList<point>& points) const;
|
||||||
|
|
||||||
//- Contains all of the points? (inside or on edge)
|
//- Contains all of the subset of points? (inside or on edge)
|
||||||
bool contains
|
bool contains
|
||||||
(
|
(
|
||||||
const UList<point>&,
|
const UList<point>& points,
|
||||||
const labelUList& indices
|
const labelUList& indices
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Contains all of the points? (inside or on edge)
|
//- Contains all of the subset of points? (inside or on edge)
|
||||||
template<unsigned Size>
|
template<unsigned Size>
|
||||||
bool contains
|
bool contains
|
||||||
(
|
(
|
||||||
const UList<point>&,
|
const UList<point>& points,
|
||||||
const FixedList<label, Size>& indices
|
const FixedList<label, Size>& indices
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
//- Contains any of the points? (inside or on edge)
|
//- Contains any of the points? (inside or on edge)
|
||||||
bool containsAny(const UList<point>&) const;
|
bool containsAny(const UList<point>& points) const;
|
||||||
|
|
||||||
//- Contains any of the points? (inside or on edge)
|
//- Contains any of the subset of points? (inside or on edge)
|
||||||
bool containsAny
|
bool containsAny
|
||||||
(
|
(
|
||||||
const UList<point>&,
|
const UList<point>& points,
|
||||||
const labelUList& indices
|
const labelUList& indices
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Contains any of the points? (inside or on edge)
|
//- Contains any of the subset of points? (inside or on edge)
|
||||||
template<unsigned Size>
|
template<unsigned Size>
|
||||||
bool containsAny
|
bool containsAny
|
||||||
(
|
(
|
||||||
const UList<point>&,
|
const UList<point>& points,
|
||||||
const FixedList<label, Size>& indices
|
const FixedList<label, Size>& indices
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Return the nearest point on the boundBox to the supplied point.
|
//- Return the nearest point on the boundBox to the supplied point.
|
||||||
// If point is inside the boundBox then the point is returned
|
// If point is inside the boundBox then the point is returned
|
||||||
// unchanged.
|
// unchanged.
|
||||||
point nearest(const point&) const;
|
point nearest(const point& pt) const;
|
||||||
|
|
||||||
|
|
||||||
|
// Member Operators
|
||||||
|
|
||||||
|
//- Extend box to include the second box, as per the add() method.
|
||||||
|
inline void operator+=(const boundBox& bb);
|
||||||
|
|
||||||
|
|
||||||
// Friend Operators
|
// Friend Operators
|
||||||
|
|
||||||
inline friend bool operator==(const boundBox&, const boundBox&);
|
inline friend bool operator==(const boundBox& a, const boundBox& b);
|
||||||
inline friend bool operator!=(const boundBox&, const boundBox&);
|
inline friend bool operator!=(const boundBox& a, const boundBox& b);
|
||||||
|
|
||||||
|
|
||||||
// IOstream operator
|
// IOstream operator
|
||||||
|
|
||||||
friend Istream& operator>>(Istream&, boundBox&);
|
friend Istream& operator>>(Istream& is, boundBox& bb);
|
||||||
friend Ostream& operator<<(Ostream&, const boundBox&);
|
friend Ostream& operator<<(Ostream& os, const boundBox& bb);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -24,15 +24,21 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "boundBox.H"
|
#include "boundBox.H"
|
||||||
#include "pointField.H"
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline Foam::boundBox::boundBox()
|
inline Foam::boundBox::boundBox()
|
||||||
:
|
:
|
||||||
min_(Zero),
|
min_(invertedBox.min()),
|
||||||
max_(Zero)
|
max_(invertedBox.max())
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::boundBox::boundBox(const point& pt)
|
||||||
|
:
|
||||||
|
min_(pt),
|
||||||
|
max_(pt)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -51,6 +57,19 @@ inline Foam::boundBox::boundBox(Istream& is)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline bool Foam::boundBox::empty() const
|
||||||
|
{
|
||||||
|
return (min_ > max_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void Foam::boundBox::clear()
|
||||||
|
{
|
||||||
|
min_ = invertedBox.min();
|
||||||
|
max_ = invertedBox.max();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const Foam::point& Foam::boundBox::min() const
|
inline const Foam::point& Foam::boundBox::min() const
|
||||||
{
|
{
|
||||||
return min_;
|
return min_;
|
||||||
@ -117,6 +136,52 @@ inline Foam::scalar Foam::boundBox::avgDim() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void Foam::boundBox::add(const boundBox& bb)
|
||||||
|
{
|
||||||
|
min_ = ::Foam::min(min_, bb.min_);
|
||||||
|
max_ = ::Foam::max(max_, bb.max_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void Foam::boundBox::add(const point& pt)
|
||||||
|
{
|
||||||
|
min_ = ::Foam::min(min_, pt);
|
||||||
|
max_ = ::Foam::max(max_, pt);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void Foam::boundBox::add(const UList<point>& points)
|
||||||
|
{
|
||||||
|
forAll(points, i)
|
||||||
|
{
|
||||||
|
add(points[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void Foam::boundBox::add(const tmp<pointField>& tpoints)
|
||||||
|
{
|
||||||
|
add(tpoints());
|
||||||
|
tpoints.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void Foam::boundBox::add
|
||||||
|
(
|
||||||
|
const UList<point>& points,
|
||||||
|
const labelUList& indices
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (!points.empty())
|
||||||
|
{
|
||||||
|
forAll(indices, i)
|
||||||
|
{
|
||||||
|
add(points[indices[i]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool Foam::boundBox::overlaps(const boundBox& bb) const
|
inline bool Foam::boundBox::overlaps(const boundBox& bb) const
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
@ -138,7 +203,7 @@ inline bool Foam::boundBox::overlaps
|
|||||||
// Find nearest point on bb.
|
// Find nearest point on bb.
|
||||||
scalar distSqr = 0;
|
scalar distSqr = 0;
|
||||||
|
|
||||||
for (direction dir = 0; dir < vector::nComponents; dir++)
|
for (direction dir = 0; dir < vector::nComponents; ++dir)
|
||||||
{
|
{
|
||||||
scalar d0 = min_[dir] - centre[dir];
|
scalar d0 = min_[dir] - centre[dir];
|
||||||
scalar d1 = max_[dir] - centre[dir];
|
scalar d1 = max_[dir] - centre[dir];
|
||||||
@ -178,7 +243,6 @@ inline bool Foam::boundBox::contains(const point& pt) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// this.bb fully contains bb
|
|
||||||
inline bool Foam::boundBox::contains(const boundBox& bb) const
|
inline bool Foam::boundBox::contains(const boundBox& bb) const
|
||||||
{
|
{
|
||||||
return contains(bb.min()) && contains(bb.max());
|
return contains(bb.min()) && contains(bb.max());
|
||||||
@ -196,6 +260,14 @@ inline bool Foam::boundBox::containsInside(const point& pt) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline void Foam::boundBox::operator+=(const boundBox& bb)
|
||||||
|
{
|
||||||
|
add(bb);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline bool Foam::operator==(const boundBox& a, const boundBox& b)
|
inline bool Foam::operator==(const boundBox& a, const boundBox& b)
|
||||||
|
|||||||
@ -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) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -25,8 +25,6 @@ License
|
|||||||
|
|
||||||
#include "boundBox.H"
|
#include "boundBox.H"
|
||||||
#include "FixedList.H"
|
#include "FixedList.H"
|
||||||
#include "PstreamReduceOps.H"
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -35,45 +33,55 @@ Foam::boundBox::boundBox
|
|||||||
(
|
(
|
||||||
const UList<point>& points,
|
const UList<point>& points,
|
||||||
const FixedList<label, Size>& indices,
|
const FixedList<label, Size>& indices,
|
||||||
const bool doReduce
|
bool doReduce
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
min_(Zero),
|
min_(invertedBox.min()),
|
||||||
max_(Zero)
|
max_(invertedBox.max())
|
||||||
{
|
{
|
||||||
// a FixedList is never empty
|
add(points, indices);
|
||||||
if (points.empty())
|
|
||||||
{
|
|
||||||
if (doReduce && Pstream::parRun())
|
|
||||||
{
|
|
||||||
// Use values that get overwritten by reduce minOp, maxOp below
|
|
||||||
min_ = point(VGREAT, VGREAT, VGREAT);
|
|
||||||
max_ = point(-VGREAT, -VGREAT, -VGREAT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
min_ = points[indices[0]];
|
|
||||||
max_ = points[indices[0]];
|
|
||||||
|
|
||||||
for (unsigned i=1; i < Size; ++i)
|
|
||||||
{
|
|
||||||
min_ = ::Foam::min(min_, points[indices[i]]);
|
|
||||||
max_ = ::Foam::max(max_, points[indices[i]]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reduce parallel information
|
|
||||||
if (doReduce)
|
if (doReduce)
|
||||||
{
|
{
|
||||||
reduce(min_, minOp<point>());
|
reduce();
|
||||||
reduce(max_, maxOp<point>());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<unsigned Size>
|
||||||
|
void Foam::boundBox::add
|
||||||
|
(
|
||||||
|
const FixedList<point, Size>& points
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// a FixedList is never empty
|
||||||
|
for (unsigned i=0; i < Size; ++i)
|
||||||
|
{
|
||||||
|
add(points[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<unsigned Size>
|
||||||
|
void Foam::boundBox::add
|
||||||
|
(
|
||||||
|
const UList<point>& points,
|
||||||
|
const FixedList<label, Size>& indices
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// points may be empty, but a FixedList is never empty
|
||||||
|
if (!points.empty())
|
||||||
|
{
|
||||||
|
for (unsigned i=0; i < Size; ++i)
|
||||||
|
{
|
||||||
|
add(points[indices[i]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<unsigned Size>
|
template<unsigned Size>
|
||||||
bool Foam::boundBox::contains
|
bool Foam::boundBox::contains
|
||||||
(
|
(
|
||||||
@ -81,7 +89,7 @@ bool Foam::boundBox::contains
|
|||||||
const FixedList<label, Size>& indices
|
const FixedList<label, Size>& indices
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// a FixedList is never empty
|
// points may be empty, but a FixedList is never empty
|
||||||
if (points.empty())
|
if (points.empty())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -106,7 +114,7 @@ bool Foam::boundBox::containsAny
|
|||||||
const FixedList<label, Size>& indices
|
const FixedList<label, Size>& indices
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// a FixedList is never empty
|
// points may be empty, but a FixedList is never empty
|
||||||
if (points.empty())
|
if (points.empty())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -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) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -236,9 +236,8 @@ void Foam::PatchTools::calcBounds
|
|||||||
label pointi = f[fp];
|
label pointi = f[fp];
|
||||||
if (pointIsUsed.set(pointi, 1u))
|
if (pointIsUsed.set(pointi, 1u))
|
||||||
{
|
{
|
||||||
bb.min() = ::Foam::min(bb.min(), points[pointi]);
|
bb.add(points[pointi]);
|
||||||
bb.max() = ::Foam::max(bb.max(), points[pointi]);
|
++nPoints;
|
||||||
nPoints++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -48,8 +48,7 @@ bool Foam::primitiveMesh::pointInCellBB
|
|||||||
|
|
||||||
if (inflationFraction > SMALL)
|
if (inflationFraction > SMALL)
|
||||||
{
|
{
|
||||||
vector inflation = inflationFraction*vector::one*mag(bb.span());
|
bb.inflate(inflationFraction);
|
||||||
bb = boundBox(bb.min() - inflation, bb.max() + inflation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return bb.contains(p);
|
return bb.contains(p);
|
||||||
|
|||||||
@ -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-2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -92,11 +92,10 @@ public:
|
|||||||
//- Calculate the bounding box
|
//- Calculate the bounding box
|
||||||
inline treeBoundBox bounds() const
|
inline treeBoundBox bounds() const
|
||||||
{
|
{
|
||||||
treeBoundBox bb(operator[](0), operator[](0));
|
treeBoundBox bb(operator[](0));
|
||||||
for (label i = 1; i < size(); i++)
|
for (label i = 1; i < size(); ++i)
|
||||||
{
|
{
|
||||||
bb.min() = min(bb.min(), operator[](i));
|
bb.add(operator[](i));
|
||||||
bb.max() = max(bb.max(), operator[](i));
|
|
||||||
}
|
}
|
||||||
return bb;
|
return bb;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -78,11 +78,10 @@ public:
|
|||||||
//- Calculate the bounding box
|
//- Calculate the bounding box
|
||||||
inline treeBoundBox bounds() const
|
inline treeBoundBox bounds() const
|
||||||
{
|
{
|
||||||
treeBoundBox bb(operator[](0), operator[](0));
|
treeBoundBox bb(operator[](0));
|
||||||
for (label i = 1; i < size(); i++)
|
for (label i = 1; i < size(); ++i)
|
||||||
{
|
{
|
||||||
bb.min() = min(bb.min(), operator[](i));
|
bb.add(operator[](i));
|
||||||
bb.max() = max(bb.max(), operator[](i));
|
|
||||||
}
|
}
|
||||||
return bb;
|
return bb;
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user