mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -46,7 +46,7 @@ int main(int argc, char *argv[])
|
||||
List<vector> list(IStringStream("1 ((0 1 2))")());
|
||||
Info<< list << endl;
|
||||
|
||||
List<vector> list2(IStringStream("((0 1 2) (3 4 5) (3 4 5))")());
|
||||
List<vector> list2(IStringStream("((0 1 2) (3 4 5) (6 7 8))")());
|
||||
Info<< list2 << endl;
|
||||
|
||||
Info<< findIndex(list2, vector(3, 4, 5)) << endl;
|
||||
@ -59,6 +59,13 @@ int main(int argc, char *argv[])
|
||||
Info<< list2 << nl
|
||||
<< list3 << endl;
|
||||
|
||||
|
||||
// Subset
|
||||
const labelList map(IStringStream("2 (0 2)")());
|
||||
List<vector> subList3(list3, map);
|
||||
Info<< "Elements " << map << " out of " << list3
|
||||
<< " : " << subList3 << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
3
applications/test/UIndirectListTest/Make/files
Normal file
3
applications/test/UIndirectListTest/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
UIndirectListTest.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/UIndirectListTest
|
||||
0
applications/test/UIndirectListTest/Make/options
Normal file
0
applications/test/UIndirectListTest/Make/options
Normal file
@ -26,51 +26,68 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
#include "UIndirectList.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
//- Construct given size
|
||||
template<class T>
|
||||
inline Foam::IndirectList<T>::IndirectList
|
||||
(
|
||||
const Foam::UList<T>& completeList,
|
||||
const Foam::List<label>& addresses
|
||||
)
|
||||
:
|
||||
completeList_(completeList),
|
||||
addresses_(addresses)
|
||||
{}
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
inline Foam::label Foam::IndirectList<T>::size() const
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
return addresses_.size();
|
||||
}
|
||||
List<double> completeList(10);
|
||||
|
||||
forAll(completeList, i)
|
||||
{
|
||||
completeList[i] = 0.1*i;
|
||||
}
|
||||
|
||||
List<label> addresses(5);
|
||||
addresses[0] = 1;
|
||||
addresses[1] = 0;
|
||||
addresses[2] = 7;
|
||||
addresses[3] = 8;
|
||||
addresses[4] = 5;
|
||||
|
||||
UIndirectList<double> idl(completeList, addresses);
|
||||
|
||||
forAll(idl, i)
|
||||
{
|
||||
Info<< idl[i] << token::SPACE;
|
||||
}
|
||||
|
||||
Info<< endl;
|
||||
|
||||
idl[1] = -666;
|
||||
|
||||
Info<< "idl[1] changed:" << idl() << endl;
|
||||
|
||||
idl = -999;
|
||||
|
||||
Info<< "idl changed:" << idl() << endl;
|
||||
|
||||
UIndirectList<double> idl2(idl);
|
||||
|
||||
Info<< "idl2:" << idl2() << endl;
|
||||
|
||||
idl = idl2();
|
||||
|
||||
Info<< "idl assigned from UList:" << idl() << endl;
|
||||
|
||||
|
||||
template<class T>
|
||||
inline const Foam::UList<T>& Foam::IndirectList<T>::
|
||||
completeList() const
|
||||
{
|
||||
return completeList_;
|
||||
}
|
||||
List<double> realList = UIndirectList<double>(completeList, addresses);
|
||||
|
||||
Info<< "realList:" << realList << endl;
|
||||
|
||||
List<double> realList2(UIndirectList<double>(completeList, addresses));
|
||||
|
||||
Info<< "realList2:" << realList2 << endl;
|
||||
|
||||
|
||||
template<class T>
|
||||
inline const Foam::List<Foam::label>& Foam::IndirectList<T>::addresses() const
|
||||
{
|
||||
return addresses_;
|
||||
}
|
||||
Info << "\nEnd\n" << endl;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
inline const T& Foam::IndirectList<T>::operator[](const Foam::label i) const
|
||||
{
|
||||
return completeList_[addresses_[i]];
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -177,7 +177,7 @@ label mergePatchFaces
|
||||
List<faceList> allFaceSetsFaces(allFaceSets.size());
|
||||
forAll(allFaceSets, setI)
|
||||
{
|
||||
allFaceSetsFaces[setI] = IndirectList<face>
|
||||
allFaceSetsFaces[setI] = UIndirectList<face>
|
||||
(
|
||||
mesh.faces(),
|
||||
allFaceSets[setI]
|
||||
|
||||
@ -76,7 +76,7 @@ void Foam::meshDualiser::checkPolyTopoChange(const polyTopoChange& meshMod)
|
||||
"meshDualiser::checkPolyTopoChange(const polyTopoChange&)"
|
||||
) << "duplicate verts:" << newToOld[newI]
|
||||
<< " coords:"
|
||||
<< IndirectList<point>(points, newToOld[newI])()
|
||||
<< UIndirectList<point>(points, newToOld[newI])()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
@ -226,10 +226,7 @@ Foam::label Foam::meshDualiser::addInternalFace
|
||||
|
||||
if (debug)
|
||||
{
|
||||
pointField facePoints
|
||||
(
|
||||
IndirectList<point>(meshMod.points(), newFace)()
|
||||
);
|
||||
pointField facePoints(meshMod.points(), newFace);
|
||||
|
||||
labelList oldToNew;
|
||||
pointField newPoints;
|
||||
@ -289,7 +286,7 @@ Foam::label Foam::meshDualiser::addInternalFace
|
||||
//n /= mag(n);
|
||||
//Pout<< "Generated internal dualFace:" << dualFaceI
|
||||
// << " verts:" << newFace
|
||||
// << " points:" << IndirectList<point>(meshMod.points(), newFace)()
|
||||
// << " points:" << UIndirectList<point>(meshMod.points(), newFace)()
|
||||
// << " n:" << n
|
||||
// << " between dualowner:" << dualCell0
|
||||
// << " dualneigbour:" << dualCell1
|
||||
@ -316,7 +313,7 @@ Foam::label Foam::meshDualiser::addInternalFace
|
||||
//n /= mag(n);
|
||||
//Pout<< "Generated internal dualFace:" << dualFaceI
|
||||
// << " verts:" << newFace
|
||||
// << " points:" << IndirectList<point>(meshMod.points(), newFace)()
|
||||
// << " points:" << UIndirectList<point>(meshMod.points(), newFace)()
|
||||
// << " n:" << n
|
||||
// << " between dualowner:" << dualCell1
|
||||
// << " dualneigbour:" << dualCell0
|
||||
@ -373,7 +370,7 @@ Foam::label Foam::meshDualiser::addBoundaryFace
|
||||
//n /= mag(n);
|
||||
//Pout<< "Generated boundary dualFace:" << dualFaceI
|
||||
// << " verts:" << newFace
|
||||
// << " points:" << IndirectList<point>(meshMod.points(), newFace)()
|
||||
// << " points:" << UIndirectList<point>(meshMod.points(), newFace)()
|
||||
// << " n:" << n
|
||||
// << " on dualowner:" << dualCellI
|
||||
// << endl;
|
||||
@ -568,7 +565,7 @@ void Foam::meshDualiser::createFaceFromInternalFace
|
||||
|
||||
//Pout<< "createFaceFromInternalFace : At face:" << faceI
|
||||
// << " verts:" << f
|
||||
// << " points:" << IndirectList<point>(mesh_.points(), f)()
|
||||
// << " points:" << UIndirectList<point>(mesh_.points(), f)()
|
||||
// << " started walking at edge:" << fEdges[fp]
|
||||
// << " verts:" << mesh_.edges()[fEdges[fp]]
|
||||
// << endl;
|
||||
@ -617,7 +614,7 @@ void Foam::meshDualiser::createFaceFromInternalFace
|
||||
{
|
||||
FatalErrorIn("createFacesFromInternalFace(..)")
|
||||
<< "face:" << faceI << " verts:" << f
|
||||
<< " points:" << IndirectList<point>(mesh_.points(), f)()
|
||||
<< " points:" << UIndirectList<point>(mesh_.points(), f)()
|
||||
<< " no feature edge between " << f[fp]
|
||||
<< " and " << f[nextFp] << " although have different"
|
||||
<< " dual cells." << endl
|
||||
|
||||
@ -70,7 +70,7 @@ void writePointSet
|
||||
|
||||
labelList pointLabels(set.toc());
|
||||
|
||||
pointField setPoints(IndirectList<point>(mesh.points(), pointLabels)());
|
||||
pointField setPoints(mesh.points(), pointLabels);
|
||||
|
||||
// Write points
|
||||
|
||||
|
||||
@ -22,14 +22,11 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "regionSide.H"
|
||||
#include "meshTools.H"
|
||||
#include "primitiveMesh.H"
|
||||
#include "IndirectList.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -113,7 +110,7 @@ Foam::label Foam::regionSide::otherEdge
|
||||
) << "Cannot find other edge on face " << faceI << " that uses point "
|
||||
<< pointI << " but not point " << freePointI << endl
|
||||
<< "Edges on face:" << fEdges
|
||||
<< " verts:" << IndirectList<edge>(mesh.edges(), fEdges)()
|
||||
<< " verts:" << UIndirectList<edge>(mesh.edges(), fEdges)()
|
||||
<< " Vertices on face:"
|
||||
<< mesh.faces()[faceI]
|
||||
<< " Vertices on original edge:" << e << abort(FatalError);
|
||||
|
||||
@ -50,15 +50,12 @@ Description
|
||||
#include "attachDetach.H"
|
||||
#include "attachPolyTopoChanger.H"
|
||||
#include "regionSide.H"
|
||||
#include "primitiveFacePatch.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Calculation engine for set of faces in a mesh
|
||||
typedef PrimitivePatch<face, List, const pointField&> facePatch;
|
||||
|
||||
|
||||
// Find edge between points v0 and v1.
|
||||
label findEdge(const primitiveMesh& mesh, const label v0, const label v1)
|
||||
{
|
||||
@ -163,10 +160,16 @@ int main(int argc, char *argv[])
|
||||
// set of edges on side of this region. Use PrimitivePatch to find these.
|
||||
//
|
||||
|
||||
IndirectList<face> zoneFaces(mesh.faces(), faces);
|
||||
|
||||
// Addressing on faces only in mesh vertices.
|
||||
facePatch fPatch(zoneFaces(), mesh.points());
|
||||
primitiveFacePatch fPatch
|
||||
(
|
||||
UIndirectList<face>
|
||||
(
|
||||
mesh.faces(),
|
||||
faces
|
||||
),
|
||||
mesh.points()
|
||||
);
|
||||
|
||||
const labelList& meshPoints = fPatch.meshPoints();
|
||||
|
||||
|
||||
@ -60,7 +60,6 @@ Description
|
||||
#include "polyTopoChanger.H"
|
||||
#include "mapPolyMesh.H"
|
||||
#include "ListOps.H"
|
||||
#include "IndirectList.H"
|
||||
#include "slidingInterface.H"
|
||||
#include "perfectInterface.H"
|
||||
#include "IOobjectList.H"
|
||||
|
||||
@ -35,14 +35,22 @@ Description
|
||||
-rotate (vector vector)
|
||||
Rotates the points from the first vector to the second,
|
||||
|
||||
or -yawPitchRoll (yawdegrees pitchdegrees rolldegrees)
|
||||
or -rollPitchYaw (rolldegrees pitchdegrees yawdegrees)
|
||||
|
||||
-scale vector
|
||||
Scales the points by the given vector.
|
||||
|
||||
The any or all of the three options may be specified and are processed
|
||||
in the above order.
|
||||
|
||||
With -rotateFields (in combination with -rotate) it will also
|
||||
read & transform vector & tensor fields.
|
||||
With -rotateFields (in combination with -rotate/yawPitchRoll/rollPitchYaw)
|
||||
it will also read & transform vector & tensor fields.
|
||||
|
||||
Note:
|
||||
yaw (rotation about z)
|
||||
pitch (rotation about y)
|
||||
roll (rotation about x)
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -58,6 +66,7 @@ Description
|
||||
#include "IStringStream.H"
|
||||
|
||||
using namespace Foam;
|
||||
using namespace Foam::mathematicalConstant;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -131,6 +140,8 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
argList::validOptions.insert("translate", "vector");
|
||||
argList::validOptions.insert("rotate", "(vector vector)");
|
||||
argList::validOptions.insert("rollPitchYaw", "(roll pitch yaw)");
|
||||
argList::validOptions.insert("yawPitchRoll", "(yaw pitch roll)");
|
||||
argList::validOptions.insert("rotateFields", "");
|
||||
argList::validOptions.insert("scale", "vector");
|
||||
|
||||
@ -185,6 +196,58 @@ int main(int argc, char *argv[])
|
||||
rotateFields(runTime, T);
|
||||
}
|
||||
}
|
||||
else if (args.options().found("rollPitchYaw"))
|
||||
{
|
||||
vector v(IStringStream(args.options()["rollPitchYaw"])());
|
||||
|
||||
Info<< "Rotating points by" << nl
|
||||
<< " roll " << v.x() << nl
|
||||
<< " pitch " << v.y() << nl
|
||||
<< " yaw " << v.z() << endl;
|
||||
|
||||
|
||||
// Convert to radians
|
||||
v *= pi/180.0;
|
||||
|
||||
quaternion R(v.x(), v.y(), v.z());
|
||||
|
||||
Info<< "Rotating points by quaternion " << R << endl;
|
||||
points = transform(R, points);
|
||||
|
||||
if (args.options().found("rotateFields"))
|
||||
{
|
||||
rotateFields(runTime, R.R());
|
||||
}
|
||||
}
|
||||
else if (args.options().found("yawPitchRoll"))
|
||||
{
|
||||
vector v(IStringStream(args.options()["yawPitchRoll"])());
|
||||
|
||||
Info<< "Rotating points by" << nl
|
||||
<< " yaw " << v.x() << nl
|
||||
<< " pitch " << v.y() << nl
|
||||
<< " roll " << v.z() << endl;
|
||||
|
||||
|
||||
// Convert to radians
|
||||
v *= pi/180.0;
|
||||
|
||||
scalar yaw = v.x();
|
||||
scalar pitch = v.y();
|
||||
scalar roll = v.z();
|
||||
|
||||
quaternion R = quaternion(vector(0, 0, 1), yaw);
|
||||
R *= quaternion(vector(0, 1, 0), pitch);
|
||||
R *= quaternion(vector(1, 0, 0), roll);
|
||||
|
||||
Info<< "Rotating points by quaternion " << R << endl;
|
||||
points = transform(R, points);
|
||||
|
||||
if (args.options().found("rotateFields"))
|
||||
{
|
||||
rotateFields(runTime, R.R());
|
||||
}
|
||||
}
|
||||
|
||||
if (args.options().found("scale"))
|
||||
{
|
||||
|
||||
@ -22,8 +22,6 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "writePointSet.H"
|
||||
@ -76,7 +74,7 @@ void writePointSet
|
||||
|
||||
writeFuns::insert
|
||||
(
|
||||
IndirectList<point>(vMesh.mesh().points(), set.toc())(),
|
||||
UIndirectList<point>(vMesh.mesh().points(), set.toc())(),
|
||||
ptField
|
||||
);
|
||||
|
||||
|
||||
@ -306,7 +306,7 @@ label findEdge
|
||||
|
||||
FatalErrorIn("findEdge") << "Cannot find edge with labels " << v0
|
||||
<< ' ' << v1 << " in candidates " << edgeLabels
|
||||
<< " with vertices:" << IndirectList<edge>(surf.edges(), edgeLabels)()
|
||||
<< " with vertices:" << UIndirectList<edge>(surf.edges(), edgeLabels)()
|
||||
<< abort(FatalError);
|
||||
|
||||
return -1;
|
||||
@ -346,7 +346,7 @@ label otherEdge
|
||||
FatalErrorIn("otherEdge") << "Cannot find other edge on face " << faceI
|
||||
<< " verts:" << surf.localPoints()[faceI]
|
||||
<< " connected to point " << pointI
|
||||
<< " faceEdges:" << IndirectList<edge>(surf.edges(), fEdges)()
|
||||
<< " faceEdges:" << UIndirectList<edge>(surf.edges(), fEdges)()
|
||||
<< abort(FatalError);
|
||||
|
||||
return -1;
|
||||
|
||||
@ -23,9 +23,16 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
Transform (scale/rotate) a surface. Like transforPoints but then for
|
||||
Transform (scale/rotate) a surface. Like transformPoints but then for
|
||||
surfaces.
|
||||
|
||||
The rollPitchYaw option takes three angles (degrees):
|
||||
- roll (rotation about x) followed by
|
||||
- pitch (rotation about y) followed by
|
||||
- yaw (rotation about z)
|
||||
|
||||
The yawPitchRoll does yaw followed by pitch followed by roll.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "triSurface.H"
|
||||
@ -35,8 +42,10 @@ Description
|
||||
#include "boundBox.H"
|
||||
#include "transformField.H"
|
||||
#include "Pair.H"
|
||||
#include "quaternion.H"
|
||||
|
||||
using namespace Foam;
|
||||
using namespace Foam::mathematicalConstant;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -52,6 +61,8 @@ int main(int argc, char *argv[])
|
||||
argList::validOptions.insert("translate", "vector");
|
||||
argList::validOptions.insert("rotate", "(vector vector)");
|
||||
argList::validOptions.insert("scale", "vector");
|
||||
argList::validOptions.insert("rollPitchYaw", "(roll pitch yaw)");
|
||||
argList::validOptions.insert("yawPitchRoll", "(yaw pitch roll)");
|
||||
argList args(argc, argv);
|
||||
|
||||
fileName surfFileName(args.additionalArgs()[0]);
|
||||
@ -96,6 +107,48 @@ int main(int argc, char *argv[])
|
||||
|
||||
points = transform(T, points);
|
||||
}
|
||||
else if (args.options().found("rollPitchYaw"))
|
||||
{
|
||||
vector v(IStringStream(args.options()["rollPitchYaw"])());
|
||||
|
||||
Info<< "Rotating points by" << nl
|
||||
<< " roll " << v.x() << nl
|
||||
<< " pitch " << v.y() << nl
|
||||
<< " yaw " << v.z() << endl;
|
||||
|
||||
|
||||
// Convert to radians
|
||||
v *= pi/180.0;
|
||||
|
||||
quaternion R(v.x(), v.y(), v.z());
|
||||
|
||||
Info<< "Rotating points by quaternion " << R << endl;
|
||||
points = transform(R, points);
|
||||
}
|
||||
else if (args.options().found("yawPitchRoll"))
|
||||
{
|
||||
vector v(IStringStream(args.options()["yawPitchRoll"])());
|
||||
|
||||
Info<< "Rotating points by" << nl
|
||||
<< " yaw " << v.x() << nl
|
||||
<< " pitch " << v.y() << nl
|
||||
<< " roll " << v.z() << endl;
|
||||
|
||||
|
||||
// Convert to radians
|
||||
v *= pi/180.0;
|
||||
|
||||
scalar yaw = v.x();
|
||||
scalar pitch = v.y();
|
||||
scalar roll = v.z();
|
||||
|
||||
quaternion R = quaternion(vector(0, 0, 1), yaw);
|
||||
R *= quaternion(vector(0, 1, 0), pitch);
|
||||
R *= quaternion(vector(1, 0, 0), roll);
|
||||
|
||||
Info<< "Rotating points by quaternion " << R << endl;
|
||||
points = transform(R, points);
|
||||
}
|
||||
|
||||
if (args.options().found("scale"))
|
||||
{
|
||||
|
||||
@ -31,6 +31,7 @@ License
|
||||
#include "PtrList.H"
|
||||
#include "SLList.H"
|
||||
#include "IndirectList.H"
|
||||
#include "UIndirectList.H"
|
||||
#include "BiIndirectList.H"
|
||||
#include "contiguous.H"
|
||||
|
||||
@ -171,6 +172,29 @@ Foam::List<T>::List(List<T>& a, bool reUse)
|
||||
}
|
||||
|
||||
|
||||
// Construct as subset
|
||||
template<class T>
|
||||
Foam::List<T>::List(const UList<T>& a, const unallocLabelList& map)
|
||||
:
|
||||
UList<T>(NULL, map.size())
|
||||
{
|
||||
if (this->size_)
|
||||
{
|
||||
this->v_ = new T[this->size_];
|
||||
|
||||
List_ACCESS(T, (*this), vp);
|
||||
List_CONST_ACCESS(T, a, ap);
|
||||
List_FOR_ALL(map, i)
|
||||
List_ELEM((*this), vp, i) = List_ELEM(a, ap, (map[i]));
|
||||
List_END_FOR_ALL
|
||||
}
|
||||
else
|
||||
{
|
||||
this->v_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Construct given start and end iterators.
|
||||
template<class T>
|
||||
template<class InputIterator>
|
||||
@ -298,6 +322,28 @@ Foam::List<T>::List(const IndirectList<T>& lst)
|
||||
}
|
||||
|
||||
|
||||
// Construct as copy of UIndirectList<T>
|
||||
template<class T>
|
||||
Foam::List<T>::List(const UIndirectList<T>& lst)
|
||||
:
|
||||
UList<T>(NULL, lst.size())
|
||||
{
|
||||
if (this->size_)
|
||||
{
|
||||
this->v_ = new T[this->size_];
|
||||
|
||||
forAll(*this, i)
|
||||
{
|
||||
this->operator[](i) = lst[i];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this->v_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Construct as copy of BiIndirectList<T>
|
||||
template<class T>
|
||||
Foam::List<T>::List(const BiIndirectList<T>& lst)
|
||||
@ -567,6 +613,28 @@ void Foam::List<T>::operator=(const IndirectList<T>& lst)
|
||||
}
|
||||
|
||||
|
||||
// Assignment operator. Takes linear time.
|
||||
template<class T>
|
||||
void Foam::List<T>::operator=(const UIndirectList<T>& lst)
|
||||
{
|
||||
if (lst.size() != this->size_)
|
||||
{
|
||||
if (this->v_) delete[] this->v_;
|
||||
this->v_ = 0;
|
||||
this->size_ = lst.size();
|
||||
if (this->size_) this->v_ = new T[this->size_];
|
||||
}
|
||||
|
||||
if (this->size_)
|
||||
{
|
||||
forAll(*this, i)
|
||||
{
|
||||
this->operator[](i) = lst[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Assignment operator. Takes linear time.
|
||||
template<class T>
|
||||
void Foam::List<T>::operator=(const BiIndirectList<T>& lst)
|
||||
|
||||
@ -66,8 +66,10 @@ template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
|
||||
class DynamicList;
|
||||
template<class T> class SortableList;
|
||||
template<class T> class IndirectList;
|
||||
template<class T> class UIndirectList;
|
||||
template<class T> class BiIndirectList;
|
||||
|
||||
typedef UList<label> unallocLabelList;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class List Declaration
|
||||
@ -112,6 +114,9 @@ public:
|
||||
//- Construct as copy or re-use as specified.
|
||||
List(List<T>&, bool reUse);
|
||||
|
||||
//- Construct as subset.
|
||||
List(const UList<T>&, const unallocLabelList& mapAddressing);
|
||||
|
||||
//- Construct given start and end iterators.
|
||||
template<class InputIterator>
|
||||
List(InputIterator first, InputIterator last);
|
||||
@ -129,6 +134,9 @@ public:
|
||||
//- Construct as copy of IndirectList<T>
|
||||
List(const IndirectList<T>&);
|
||||
|
||||
//- Construct as copy of UIndirectList<T>
|
||||
List(const UIndirectList<T>&);
|
||||
|
||||
//- Construct as copy of BiIndirectList<T>
|
||||
List(const BiIndirectList<T>&);
|
||||
|
||||
@ -206,6 +214,9 @@ public:
|
||||
//- Assignment from IndirectList operator. Takes linear time.
|
||||
void operator=(const IndirectList<T>&);
|
||||
|
||||
//- Assignment from UIndirectList operator. Takes linear time.
|
||||
void operator=(const UIndirectList<T>&);
|
||||
|
||||
//- Assignment from BiIndirectList operator. Takes linear time.
|
||||
void operator=(const BiIndirectList<T>&);
|
||||
|
||||
|
||||
@ -786,7 +786,7 @@ inline bool Foam::PackedList<nBits>::set
|
||||
<< "negative index " << i << " max=" << size_-1
|
||||
<< abort(FatalError);
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
// lazy evaluation - increase size on assigment
|
||||
if (i >= size_)
|
||||
|
||||
@ -23,17 +23,19 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::IndirectList
|
||||
Foam::UIndirectList
|
||||
|
||||
Description
|
||||
A List with indirect addressing. Like IndirectList but does not store
|
||||
addressing.
|
||||
|
||||
SourceFiles
|
||||
IndirectListI.H
|
||||
UIndirectListI.H
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef IndirectList_H
|
||||
#define IndirectList_H
|
||||
#ifndef UIndirectList_H
|
||||
#define UIndirectList_H
|
||||
|
||||
#include "List.H"
|
||||
|
||||
@ -43,22 +45,16 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class IndirectList Declaration
|
||||
Class UIndirectList Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class T>
|
||||
class IndirectList
|
||||
class UIndirectList
|
||||
{
|
||||
// Private data
|
||||
|
||||
const UList<T>& completeList_;
|
||||
List<label> addresses_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const IndirectList<T>&);
|
||||
UList<T>& completeList_;
|
||||
const UList<label>& addressing_;
|
||||
|
||||
|
||||
public:
|
||||
@ -66,7 +62,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct given the complete list and the addressing array
|
||||
inline IndirectList(const UList<T>&, const List<label>&);
|
||||
inline UIndirectList(const UList<T>&, const UList<label>&);
|
||||
|
||||
|
||||
// Member Functions
|
||||
@ -74,14 +70,28 @@ public:
|
||||
// Access
|
||||
|
||||
inline label size() const;
|
||||
inline bool empty() const;
|
||||
|
||||
inline const UList<T>& completeList() const;
|
||||
inline const List<label>& addresses() const;
|
||||
inline const List<label>& addressing() const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Return the addressed elements as a List
|
||||
inline List<T> operator()() const;
|
||||
|
||||
//- Return non-const access to an element
|
||||
inline T& operator[](const label);
|
||||
|
||||
//- Return const access to an element
|
||||
inline const T& operator[](const label) const;
|
||||
|
||||
//- Assignment from UList of addressed elements
|
||||
inline void operator=(const UList<T>&);
|
||||
|
||||
//- Assignment of all entries to the given value
|
||||
inline void operator=(const T&);
|
||||
};
|
||||
|
||||
|
||||
@ -91,7 +101,7 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "IndirectListI.H"
|
||||
#include "UIndirectListI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
130
src/OpenFOAM/containers/Lists/UIndirectList/UIndirectListI.H
Normal file
130
src/OpenFOAM/containers/Lists/UIndirectList/UIndirectListI.H
Normal file
@ -0,0 +1,130 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
inline Foam::UIndirectList<T>::UIndirectList
|
||||
(
|
||||
const UList<T>& completeList,
|
||||
const UList<label>& addr
|
||||
)
|
||||
:
|
||||
completeList_(const_cast<UList<T>&>(completeList)),
|
||||
addressing_(addr)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
inline Foam::label Foam::UIndirectList<T>::size() const
|
||||
{
|
||||
return addressing_.size();
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::UIndirectList<T>::empty() const
|
||||
{
|
||||
return addressing_.empty();
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline const Foam::UList<T>& Foam::UIndirectList<T>::completeList() const
|
||||
{
|
||||
return completeList_;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline const Foam::List<Foam::label>& Foam::UIndirectList<T>::addressing() const
|
||||
{
|
||||
return addressing_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
inline Foam::List<T> Foam::UIndirectList<T>::operator()() const
|
||||
{
|
||||
List<T> result(size());
|
||||
|
||||
forAll(*this, i)
|
||||
{
|
||||
result[i] = operator[](i);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline T& Foam::UIndirectList<T>::operator[](const label i)
|
||||
{
|
||||
return completeList_[addressing_[i]];
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline const T& Foam::UIndirectList<T>::operator[](const label i) const
|
||||
{
|
||||
return completeList_[addressing_[i]];
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline void Foam::UIndirectList<T>::operator=(const UList<T>& ae)
|
||||
{
|
||||
if (addressing_.size() != ae.size())
|
||||
{
|
||||
FatalErrorIn("UIndirectList<T>::operator=(const UList<T>&)")
|
||||
<< "Addressing and list of addressed elements "
|
||||
"have different sizes: "
|
||||
<< addressing_.size() << " " << ae.size()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
forAll(addressing_, i)
|
||||
{
|
||||
completeList_[addressing_[i]] = ae[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline void Foam::UIndirectList<T>::operator=(const T& t)
|
||||
{
|
||||
forAll(addressing_, i)
|
||||
{
|
||||
completeList_[addressing_[i]] = t;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -629,7 +629,7 @@ Foam::pointField Foam::globalMeshData::sharedPoints() const
|
||||
|
||||
toMaster
|
||||
<< sharedPointAddr_
|
||||
<< IndirectList<point>(mesh_.points(), sharedPointLabels_)();
|
||||
<< UIndirectList<point>(mesh_.points(), sharedPointLabels_)();
|
||||
}
|
||||
|
||||
// Receive sharedPoints
|
||||
|
||||
@ -653,8 +653,8 @@ void Foam::globalPoints::sendSharedPoints(const labelList& changedIndices) const
|
||||
}
|
||||
|
||||
toNeighbour
|
||||
<< IndirectList<label>(sharedPointAddr_, changedIndices)()
|
||||
<< IndirectList<label>(sharedPointLabels_, changedIndices)();
|
||||
<< UIndirectList<label>(sharedPointAddr_, changedIndices)()
|
||||
<< UIndirectList<label>(sharedPointLabels_, changedIndices)();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ Foam::List<Foam::labelPair> Foam::mapDistribute::schedule
|
||||
);
|
||||
|
||||
// Processors involved in my schedule
|
||||
return IndirectList<labelPair>(allComms, mySchedule);
|
||||
return UIndirectList<labelPair>(allComms, mySchedule);
|
||||
|
||||
|
||||
//if (debug)
|
||||
|
||||
@ -188,11 +188,11 @@ void Foam::cyclicPolyPatch::calcTransforms()
|
||||
<< endl
|
||||
<< "Mesh face:" << start()+facei
|
||||
<< " vertices:"
|
||||
<< IndirectList<point>(points, operator[](facei))()
|
||||
<< UIndirectList<point>(points, operator[](facei))()
|
||||
<< endl
|
||||
<< "Neighbour face:" << start()+nbrFacei
|
||||
<< " vertices:"
|
||||
<< IndirectList<point>(points, operator[](nbrFacei))()
|
||||
<< UIndirectList<point>(points, operator[](nbrFacei))()
|
||||
<< endl
|
||||
<< "Rerun with cyclic debug flag set"
|
||||
<< " for more information." << exit(FatalError);
|
||||
@ -403,12 +403,12 @@ bool Foam::cyclicPolyPatch::getGeometricHalves
|
||||
fileName nm0(casePath/name()+"_half0_faces.obj");
|
||||
Pout<< "cyclicPolyPatch::getGeometricHalves : Writing half0"
|
||||
<< " faces to OBJ file " << nm0 << endl;
|
||||
writeOBJ(nm0, IndirectList<face>(pp, half0ToPatch)(), pp.points());
|
||||
writeOBJ(nm0, UIndirectList<face>(pp, half0ToPatch)(), pp.points());
|
||||
|
||||
fileName nm1(casePath/name()+"_half1_faces.obj");
|
||||
Pout<< "cyclicPolyPatch::getGeometricHalves : Writing half1"
|
||||
<< " faces to OBJ file " << nm1 << endl;
|
||||
writeOBJ(nm1, IndirectList<face>(pp, half1ToPatch)(), pp.points());
|
||||
writeOBJ(nm1, UIndirectList<face>(pp, half1ToPatch)(), pp.points());
|
||||
}
|
||||
|
||||
// Dump face centres
|
||||
@ -672,7 +672,7 @@ bool Foam::cyclicPolyPatch::matchAnchors
|
||||
) << "Patch:" << name() << " : "
|
||||
<< "Cannot find point on face " << f
|
||||
<< " with vertices:"
|
||||
<< IndirectList<point>(pp.points(), f)()
|
||||
<< UIndirectList<point>(pp.points(), f)()
|
||||
<< " that matches point " << wantedAnchor
|
||||
<< " when matching the halves of cyclic patch " << name()
|
||||
<< endl
|
||||
@ -1133,8 +1133,8 @@ bool Foam::cyclicPolyPatch::order
|
||||
half1ToPatch = half0ToPatch + halfSize;
|
||||
|
||||
// Get faces
|
||||
faceList half0Faces(IndirectList<face>(pp, half0ToPatch));
|
||||
faceList half1Faces(IndirectList<face>(pp, half1ToPatch));
|
||||
faceList half0Faces(UIndirectList<face>(pp, half0ToPatch));
|
||||
faceList half1Faces(UIndirectList<face>(pp, half1ToPatch));
|
||||
|
||||
// Get geometric quantities
|
||||
pointField half0Ctrs, half1Ctrs, anchors0, ppPoints;
|
||||
@ -1221,8 +1221,8 @@ bool Foam::cyclicPolyPatch::order
|
||||
}
|
||||
|
||||
// And redo all matching
|
||||
half0Faces = IndirectList<face>(pp, half0ToPatch);
|
||||
half1Faces = IndirectList<face>(pp, half1ToPatch);
|
||||
half0Faces = UIndirectList<face>(pp, half0ToPatch);
|
||||
half1Faces = UIndirectList<face>(pp, half1ToPatch);
|
||||
|
||||
getCentresAndAnchors
|
||||
(
|
||||
@ -1334,8 +1334,8 @@ bool Foam::cyclicPolyPatch::order
|
||||
if (baffleI == halfSize)
|
||||
{
|
||||
// And redo all matching
|
||||
half0Faces = IndirectList<face>(pp, half0ToPatch);
|
||||
half1Faces = IndirectList<face>(pp, half1ToPatch);
|
||||
half0Faces = UIndirectList<face>(pp, half0ToPatch);
|
||||
half1Faces = UIndirectList<face>(pp, half1ToPatch);
|
||||
|
||||
getCentresAndAnchors
|
||||
(
|
||||
@ -1420,8 +1420,8 @@ bool Foam::cyclicPolyPatch::order
|
||||
}
|
||||
|
||||
// And redo all matching
|
||||
half0Faces = IndirectList<face>(pp, half0ToPatch);
|
||||
half1Faces = IndirectList<face>(pp, half1ToPatch);
|
||||
half0Faces = UIndirectList<face>(pp, half0ToPatch);
|
||||
half1Faces = UIndirectList<face>(pp, half1ToPatch);
|
||||
|
||||
getCentresAndAnchors
|
||||
(
|
||||
|
||||
@ -207,7 +207,7 @@ void Foam::processorPolyPatch::calcGeometry()
|
||||
<< endl
|
||||
<< "Mesh face:" << start()+facei
|
||||
<< " vertices:"
|
||||
<< IndirectList<point>(points(), operator[](facei))()
|
||||
<< UIndirectList<point>(points(), operator[](facei))()
|
||||
<< endl
|
||||
<< "Rerun with processor debug flag set for"
|
||||
<< " more information." << exit(FatalError);
|
||||
@ -731,7 +731,7 @@ bool Foam::processorPolyPatch::order
|
||||
<< " : "
|
||||
<< "Cannot find point on face " << pp[oldFaceI]
|
||||
<< " with vertices "
|
||||
<< IndirectList<point>(pp.points(), pp[oldFaceI])()
|
||||
<< UIndirectList<point>(pp.points(), pp[oldFaceI])()
|
||||
<< " that matches point " << wantedAnchor
|
||||
<< " when matching the halves of processor patch " << name()
|
||||
<< "Continuing with incorrect face ordering from now on!"
|
||||
|
||||
@ -87,8 +87,7 @@ Foam::PackedBoolList Foam::syncTools::getMasterPoints(const polyMesh& mesh)
|
||||
|
||||
labelList minProc(mesh.globalData().nGlobalPoints(), labelMax);
|
||||
|
||||
IndirectList<label>(minProc, sharedPointAddr) =
|
||||
Pstream::myProcNo();
|
||||
UIndirectList<label>(minProc, sharedPointAddr) = Pstream::myProcNo();
|
||||
|
||||
Pstream::listCombineGather(minProc, minEqOp<label>());
|
||||
Pstream::listCombineScatter(minProc);
|
||||
@ -207,8 +206,7 @@ Foam::PackedBoolList Foam::syncTools::getMasterEdges(const polyMesh& mesh)
|
||||
|
||||
labelList minProc(mesh.globalData().nGlobalEdges(), labelMax);
|
||||
|
||||
IndirectList<label>(minProc, sharedEdgeAddr) =
|
||||
Pstream::myProcNo();
|
||||
UIndirectList<label>(minProc, sharedEdgeAddr) = Pstream::myProcNo();
|
||||
|
||||
Pstream::listCombineGather(minProc, minEqOp<label>());
|
||||
Pstream::listCombineScatter(minProc);
|
||||
|
||||
@ -37,7 +37,6 @@ SourceFiles
|
||||
#define ZoneMesh_H
|
||||
|
||||
#include "List.H"
|
||||
#include "IndirectList.H"
|
||||
#include "regIOobject.H"
|
||||
#include "HashSet.H"
|
||||
#include "pointFieldsFwd.H"
|
||||
|
||||
@ -81,7 +81,7 @@ Foam::PatchTools::edgeOwner
|
||||
<< "Edge " << edgeI << " vertices:" << edges[edgeI]
|
||||
<< " is used by faces " << nbrFaces
|
||||
<< " vertices:"
|
||||
<< IndirectList<Face>(localFaces, nbrFaces)()
|
||||
<< UIndirectList<Face>(localFaces, nbrFaces)()
|
||||
<< " none of which use the edge vertices in the same order"
|
||||
<< nl << "I give up" << abort(FatalError);
|
||||
}
|
||||
|
||||
@ -108,7 +108,7 @@ Foam::PatchTools::sortedEdgeFaces
|
||||
|
||||
faceAngles.sort();
|
||||
|
||||
sortedEdgeFaces[edgeI] = IndirectList<label>
|
||||
sortedEdgeFaces[edgeI] = UIndirectList<label>
|
||||
(
|
||||
faceNbs,
|
||||
faceAngles.indices()
|
||||
|
||||
@ -1238,10 +1238,7 @@ void Foam::autoSnapDriver::smoothDisplacement
|
||||
magDisp().write();
|
||||
|
||||
Pout<< "Writing actual patch displacement ..." << endl;
|
||||
vectorField actualPatchDisp
|
||||
(
|
||||
IndirectList<point>(disp, pp.meshPoints())()
|
||||
);
|
||||
vectorField actualPatchDisp(disp, pp.meshPoints());
|
||||
dumpMove
|
||||
(
|
||||
mesh.time().path()/"actualPatchDisplacement.obj",
|
||||
|
||||
@ -922,7 +922,7 @@ void Foam::refinementSurfaces::findNearest
|
||||
List<pointIndexHit>& hitInfo
|
||||
) const
|
||||
{
|
||||
labelList geometries(IndirectList<label>(surfaces_, surfacesToTest));
|
||||
labelList geometries(UIndirectList<label>(surfaces_, surfacesToTest));
|
||||
|
||||
// Do the tests. Note that findNearest returns index in geometries.
|
||||
searchableSurfacesQueries::findNearest
|
||||
@ -955,7 +955,7 @@ void Foam::refinementSurfaces::findNearestRegion
|
||||
labelList& hitRegion
|
||||
) const
|
||||
{
|
||||
labelList geometries(IndirectList<label>(surfaces_, surfacesToTest));
|
||||
labelList geometries(UIndirectList<label>(surfaces_, surfacesToTest));
|
||||
|
||||
// Do the tests. Note that findNearest returns index in geometries.
|
||||
List<pointIndexHit> hitInfo;
|
||||
@ -991,7 +991,7 @@ void Foam::refinementSurfaces::findNearestRegion
|
||||
|
||||
List<pointIndexHit> localHits
|
||||
(
|
||||
IndirectList<pointIndexHit>
|
||||
UIndirectList<pointIndexHit>
|
||||
(
|
||||
hitInfo,
|
||||
localIndices
|
||||
|
||||
@ -718,7 +718,7 @@ void Foam::fvMeshDistribute::getNeighbourData
|
||||
// Which processor they will end up on
|
||||
const labelList newProc
|
||||
(
|
||||
IndirectList<label>(distribution, pp.faceCells())
|
||||
UIndirectList<label>(distribution, pp.faceCells())
|
||||
);
|
||||
|
||||
OPstream toNeighbour(Pstream::blocking, procPatch.neighbProcNo());
|
||||
@ -1192,7 +1192,7 @@ void Foam::fvMeshDistribute::sendMesh
|
||||
//
|
||||
// forAll(cellZones, zoneI)
|
||||
// {
|
||||
// IndirectList<label>(cellZoneID, cellZones[zoneI]) = zoneI;
|
||||
// UIndirectList<label>(cellZoneID, cellZones[zoneI]) = zoneI;
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
@ -269,7 +269,7 @@ bool Foam::hexCellLooper::cut
|
||||
{
|
||||
FatalErrorIn("hexCellLooper::walkHex") << "Face:" << faceVerts
|
||||
<< " on points:" << facePoints << endl
|
||||
<< IndirectList<point>(facePoints, faceVerts)()
|
||||
<< UIndirectList<point>(facePoints, faceVerts)()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,8 +103,8 @@ void Foam::polyMeshGeometry::updateCellCentresAndVols
|
||||
)
|
||||
{
|
||||
// Clear the fields for accumulation
|
||||
IndirectList<vector>(cellCentres_, changedCells) = vector::zero;
|
||||
IndirectList<scalar>(cellVolumes_, changedCells) = 0.0;
|
||||
UIndirectList<vector>(cellCentres_, changedCells) = vector::zero;
|
||||
UIndirectList<scalar>(cellVolumes_, changedCells) = 0.0;
|
||||
|
||||
const labelList& own = mesh_.faceOwner();
|
||||
const labelList& nei = mesh_.faceNeighbour();
|
||||
@ -112,9 +112,9 @@ void Foam::polyMeshGeometry::updateCellCentresAndVols
|
||||
// first estimate the approximate cell centre as the average of face centres
|
||||
|
||||
vectorField cEst(mesh_.nCells());
|
||||
IndirectList<vector>(cEst, changedCells) = vector::zero;
|
||||
UIndirectList<vector>(cEst, changedCells) = vector::zero;
|
||||
scalarField nCellFaces(mesh_.nCells());
|
||||
IndirectList<scalar>(nCellFaces, changedCells) = 0.0;
|
||||
UIndirectList<scalar>(nCellFaces, changedCells) = 0.0;
|
||||
|
||||
forAll(changedFaces, i)
|
||||
{
|
||||
|
||||
@ -32,7 +32,6 @@ License
|
||||
#include "treeDataFace.H"
|
||||
#include "indexedOctree.H"
|
||||
#include "OFstream.H"
|
||||
#include "IndirectList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -153,11 +152,7 @@ void Foam::faceCoupleInfo::writePointsFaces() const
|
||||
(
|
||||
"cutToMasterPoints.obj",
|
||||
m.localPoints(),
|
||||
pointField
|
||||
(
|
||||
IndirectList<point>(c.localPoints(), masterToCutPoints_)()
|
||||
)
|
||||
);
|
||||
pointField(c.localPoints(), masterToCutPoints_));
|
||||
}
|
||||
{
|
||||
Pout<< "Writing cutToSlavePoints to cutToSlavePoints.obj" << endl;
|
||||
@ -166,10 +161,7 @@ void Foam::faceCoupleInfo::writePointsFaces() const
|
||||
(
|
||||
"cutToSlavePoints.obj",
|
||||
s.localPoints(),
|
||||
pointField
|
||||
(
|
||||
IndirectList<point>(c.localPoints(), slaveToCutPoints_)()
|
||||
)
|
||||
pointField(c.localPoints(), slaveToCutPoints_)
|
||||
);
|
||||
}
|
||||
|
||||
@ -405,7 +397,7 @@ Foam::label Foam::faceCoupleInfo::mostAlignedCutEdge
|
||||
if (report)
|
||||
{
|
||||
Pout<< "mostAlignedEdge : finding nearest edge among "
|
||||
<< IndirectList<edge>(cutFaces().edges(), pEdges)()
|
||||
<< UIndirectList<edge>(cutFaces().edges(), pEdges)()
|
||||
<< " connected to point " << pointI
|
||||
<< " coord:" << localPoints[pointI]
|
||||
<< " running between " << edgeStart << " coord:"
|
||||
@ -623,7 +615,7 @@ void Foam::faceCoupleInfo::setCutEdgeToPoints(const labelList& cutToMasterEdges)
|
||||
"(const labelList&)"
|
||||
) << " unsplitEdge:" << unsplitEdge
|
||||
<< " does not correspond to split edges "
|
||||
<< IndirectList<edge>(cutEdges, stringedEdges)()
|
||||
<< UIndirectList<edge>(cutEdges, stringedEdges)()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
@ -631,7 +623,7 @@ void Foam::faceCoupleInfo::setCutEdgeToPoints(const labelList& cutToMasterEdges)
|
||||
//Pout<< "For master edge:"
|
||||
// << unsplitEdge
|
||||
// << " Found stringed points "
|
||||
// << IndirectList<point>
|
||||
// << UIndirectList<point>
|
||||
// (
|
||||
// cutFaces().localPoints(),
|
||||
// splitPoints.shrink()
|
||||
@ -664,9 +656,9 @@ Foam::label Foam::faceCoupleInfo::matchFaces
|
||||
"(const scalar, const face&, const pointField&"
|
||||
", const face&, const pointField&)"
|
||||
) << "Different sizes for supposedly matching faces." << nl
|
||||
<< "f0:" << f0 << " coords:" << IndirectList<point>(points0, f0)()
|
||||
<< "f0:" << f0 << " coords:" << UIndirectList<point>(points0, f0)()
|
||||
<< nl
|
||||
<< "f1:" << f1 << " coords:" << IndirectList<point>(points1, f1)()
|
||||
<< "f1:" << f1 << " coords:" << UIndirectList<point>(points1, f1)()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
@ -721,10 +713,9 @@ Foam::label Foam::faceCoupleInfo::matchFaces
|
||||
", const face&, const pointField&)"
|
||||
) << "No unique match between two faces" << nl
|
||||
<< "Face " << f0 << " coords "
|
||||
<< IndirectList<point>(points0, f0)()
|
||||
<< nl
|
||||
<< UIndirectList<point>(points0, f0)() << nl
|
||||
<< "Face " << f1 << " coords "
|
||||
<< IndirectList<point>(points1, f1)()
|
||||
<< UIndirectList<point>(points1, f1)()
|
||||
<< "when using tolerance " << absTol
|
||||
<< " and forwardMatching:" << sameOrientation
|
||||
<< abort(FatalError);
|
||||
@ -1575,7 +1566,7 @@ void Foam::faceCoupleInfo::perfectPointMatch
|
||||
|
||||
|
||||
// Use compaction lists to renumber cutPoints.
|
||||
cutPoints_ = IndirectList<point>(cutPoints_, compactToCut)();
|
||||
cutPoints_ = UIndirectList<point>(cutPoints_, compactToCut)();
|
||||
{
|
||||
const faceList& cutLocalFaces = cutFaces().localFaces();
|
||||
|
||||
@ -1770,11 +1761,11 @@ void Foam::faceCoupleInfo::subDivisionMatch
|
||||
writeOBJ
|
||||
(
|
||||
"errorEdges.obj",
|
||||
IndirectList<edge>
|
||||
UIndirectList<edge>
|
||||
(
|
||||
cutFaces().edges(),
|
||||
cutFaces().pointEdges()[cutPointI]
|
||||
)(),
|
||||
),
|
||||
cutFaces().localPoints(),
|
||||
false
|
||||
);
|
||||
@ -1894,7 +1885,7 @@ void Foam::faceCoupleInfo::subDivisionMatch
|
||||
"(const polyMesh&, const bool, const scalar)"
|
||||
) << "Did not match all of cutFaces to a master face" << nl
|
||||
<< "First unmatched cut face:" << cutFaceI << " with points:"
|
||||
<< IndirectList<point>(cutFaces().points(), cutF)()
|
||||
<< UIndirectList<point>(cutFaces().points(), cutF)()
|
||||
<< nl
|
||||
<< "This usually means that the slave patch is not a"
|
||||
<< " subdivision of the master patch"
|
||||
|
||||
@ -1929,11 +1929,8 @@ Foam::Map<Foam::label> Foam::polyMeshAdder::findSharedPoints
|
||||
//(
|
||||
// pointField
|
||||
// (
|
||||
// IndirectList<point>
|
||||
// (
|
||||
// mesh.points(),
|
||||
// sharedPointLabels
|
||||
// )()
|
||||
// mesh.points(),
|
||||
// sharedPointLabels
|
||||
// ),
|
||||
// mergeDist,
|
||||
// false,
|
||||
|
||||
@ -110,7 +110,7 @@ Foam::labelListList Foam::addPatchCellLayer::calcGlobalEdgeFaces
|
||||
);
|
||||
|
||||
// Extract pp part
|
||||
return IndirectList<labelList>(globalEdgeFaces, meshEdges)();
|
||||
return UIndirectList<labelList>(globalEdgeFaces, meshEdges);
|
||||
}
|
||||
|
||||
|
||||
@ -629,7 +629,7 @@ void Foam::addPatchCellLayer::setRefinement
|
||||
|
||||
{
|
||||
labelList n(mesh_.nPoints(), 0);
|
||||
IndirectList<label>(n, meshPoints) = nPointLayers;
|
||||
UIndirectList<label>(n, meshPoints) = nPointLayers;
|
||||
syncTools::syncPointList(mesh_, n, maxEqOp<label>(), 0, false);
|
||||
|
||||
// Non-synced
|
||||
@ -706,7 +706,7 @@ void Foam::addPatchCellLayer::setRefinement
|
||||
|
||||
{
|
||||
pointField d(mesh_.nPoints(), wallPoint::greatPoint);
|
||||
IndirectList<point>(d, meshPoints) = firstLayerDisp;
|
||||
UIndirectList<point>(d, meshPoints) = firstLayerDisp;
|
||||
syncTools::syncPointList
|
||||
(
|
||||
mesh_,
|
||||
|
||||
@ -565,7 +565,7 @@ void Foam::combineFaces::setRefinement
|
||||
const labelList& setFaces = faceSets[setI];
|
||||
|
||||
masterFace_[setI] = setFaces[0];
|
||||
faceSetsVertices_[setI] = IndirectList<face>
|
||||
faceSetsVertices_[setI] = UIndirectList<face>
|
||||
(
|
||||
mesh_.faces(),
|
||||
setFaces
|
||||
|
||||
@ -28,7 +28,6 @@ License
|
||||
#include "polyMesh.H"
|
||||
#include "polyTopoChange.H"
|
||||
#include "ListOps.H"
|
||||
#include "IndirectList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -746,7 +746,7 @@ Foam::label Foam::hexRef8::findLevel
|
||||
|
||||
FatalErrorIn("hexRef8::findLevel(..)")
|
||||
<< "face:" << f
|
||||
<< " level:" << IndirectList<label>(pointLevel_, f)()
|
||||
<< " level:" << UIndirectList<label>(pointLevel_, f)()
|
||||
<< " startFp:" << startFp
|
||||
<< " wantedLevel:" << wantedLevel
|
||||
<< abort(FatalError);
|
||||
@ -774,7 +774,7 @@ Foam::label Foam::hexRef8::findLevel
|
||||
|
||||
FatalErrorIn("hexRef8::findLevel(..)")
|
||||
<< "face:" << f
|
||||
<< " level:" << IndirectList<label>(pointLevel_, f)()
|
||||
<< " level:" << UIndirectList<label>(pointLevel_, f)()
|
||||
<< " startFp:" << startFp
|
||||
<< " wantedLevel:" << wantedLevel
|
||||
<< abort(FatalError);
|
||||
@ -823,7 +823,7 @@ void Foam::hexRef8::checkInternalOrientation
|
||||
)
|
||||
{
|
||||
face compactFace(identity(newFace.size()));
|
||||
pointField compactPoints(IndirectList<point>(meshMod.points(), newFace)());
|
||||
pointField compactPoints(meshMod.points(), newFace);
|
||||
|
||||
vector n(compactFace.normal(compactPoints));
|
||||
|
||||
@ -869,7 +869,7 @@ void Foam::hexRef8::checkBoundaryOrientation
|
||||
)
|
||||
{
|
||||
face compactFace(identity(newFace.size()));
|
||||
pointField compactPoints(IndirectList<point>(meshMod.points(), newFace)());
|
||||
pointField compactPoints(meshMod.points(), newFace);
|
||||
|
||||
vector n(compactFace.normal(compactPoints));
|
||||
|
||||
@ -1308,11 +1308,11 @@ void Foam::hexRef8::createInternalFaces
|
||||
<< "cell:" << cellI << " cLevel:" << cLevel
|
||||
<< " cell points:" << cPoints
|
||||
<< " pointLevel:"
|
||||
<< IndirectList<label>(pointLevel_, cPoints)()
|
||||
<< UIndirectList<label>(pointLevel_, cPoints)()
|
||||
<< " face:" << faceI
|
||||
<< " f:" << f
|
||||
<< " pointLevel:"
|
||||
<< IndirectList<label>(pointLevel_, f)()
|
||||
<< UIndirectList<label>(pointLevel_, f)()
|
||||
<< " faceAnchorLevel:" << faceAnchorLevel[faceI]
|
||||
<< " faceMidPoint:" << faceMidPoint[faceI]
|
||||
<< " faceMidPointI:" << faceMidPointI
|
||||
@ -1381,11 +1381,11 @@ void Foam::hexRef8::createInternalFaces
|
||||
<< "cell:" << cellI << " cLevel:" << cLevel
|
||||
<< " cell points:" << cPoints
|
||||
<< " pointLevel:"
|
||||
<< IndirectList<label>(pointLevel_, cPoints)()
|
||||
<< UIndirectList<label>(pointLevel_, cPoints)()
|
||||
<< " face:" << faceI
|
||||
<< " f:" << f
|
||||
<< " pointLevel:"
|
||||
<< IndirectList<label>(pointLevel_, f)()
|
||||
<< UIndirectList<label>(pointLevel_, f)()
|
||||
<< " faceAnchorLevel:" << faceAnchorLevel[faceI]
|
||||
<< " faceMidPoint:" << faceMidPoint[faceI]
|
||||
<< " faceMidPointI:" << faceMidPointI
|
||||
@ -3511,7 +3511,7 @@ Foam::labelListList Foam::hexRef8::setRefinement
|
||||
<< " lower level" << endl
|
||||
<< "cellPoints:" << cPoints << endl
|
||||
<< "pointLevels:"
|
||||
<< IndirectList<label>(pointLevel_, cPoints)() << endl
|
||||
<< UIndirectList<label>(pointLevel_, cPoints)() << endl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
@ -4473,7 +4473,7 @@ void Foam::hexRef8::checkMesh() const
|
||||
<< "Coupled face " << faceI
|
||||
<< " on patch " << patchI
|
||||
<< " " << mesh_.boundaryMesh()[patchI].name()
|
||||
<< " coords:" << IndirectList<point>(mesh_.points(), f)()
|
||||
<< " coords:" << UIndirectList<point>(mesh_.points(), f)()
|
||||
<< " has face area:" << magArea
|
||||
<< " (coupled) neighbour face area differs:"
|
||||
<< neiFaceAreas[i]
|
||||
@ -4515,7 +4515,7 @@ void Foam::hexRef8::checkMesh() const
|
||||
<< "Coupled face " << faceI
|
||||
<< " on patch " << patchI
|
||||
<< " " << mesh_.boundaryMesh()[patchI].name()
|
||||
<< " coords:" << IndirectList<point>(mesh_.points(), f)()
|
||||
<< " coords:" << UIndirectList<point>(mesh_.points(), f)()
|
||||
<< " has size:" << f.size()
|
||||
<< " (coupled) neighbour face has size:"
|
||||
<< nVerts[i]
|
||||
@ -4565,7 +4565,7 @@ void Foam::hexRef8::checkMesh() const
|
||||
<< "Coupled face " << faceI
|
||||
<< " on patch " << patchI
|
||||
<< " " << mesh_.boundaryMesh()[patchI].name()
|
||||
<< " coords:" << IndirectList<point>(mesh_.points(), f)()
|
||||
<< " coords:" << UIndirectList<point>(mesh_.points(), f)()
|
||||
<< " has anchor vector:" << anchorVec
|
||||
<< " (coupled) neighbour face anchor vector differs:"
|
||||
<< anchorPoints[i]
|
||||
|
||||
@ -375,7 +375,7 @@ void Foam::removeFaces::mergeFaces
|
||||
//{
|
||||
// Pout<< "Modifying masterface " << faceI
|
||||
// << " from faces:" << faceLabels
|
||||
// << " old verts:" << IndirectList<face>(mesh_.faces(), faceLabels)
|
||||
// << " old verts:" << UIndirectList<face>(mesh_.faces(), faceLabels)
|
||||
// << " for new verts:"
|
||||
// << mergedFace
|
||||
// << " possibly new owner " << own
|
||||
|
||||
@ -353,7 +353,7 @@ void Foam::removePoints::setRefinement
|
||||
// Points from the mesh
|
||||
List<point> meshPoints
|
||||
(
|
||||
IndirectList<point>
|
||||
UIndirectList<point>
|
||||
(
|
||||
mesh_.points(),
|
||||
mesh_.faces()[savedFaceLabels_[saveI]] // mesh face
|
||||
|
||||
@ -202,7 +202,7 @@ void Foam::enrichedPatch::calcCutFaces() const
|
||||
// Grab the next point options
|
||||
// Pout << "curPointLabel: " << mp[curPointLabel] << endl;
|
||||
const labelList& nextPoints = pp[curPointLabel];
|
||||
// Pout << "nextPoints: " << IndirectList<label>(mp, nextPoints) << endl;
|
||||
// Pout << "nextPoints: " << UIndirectList<label>(mp, nextPoints) << endl;
|
||||
// Get the vector along the edge and the right vector
|
||||
vector ahead = curPoint - lp[prevPointLabel];
|
||||
ahead -= normal*(normal & ahead);
|
||||
|
||||
@ -165,7 +165,7 @@ void directMappedFixedValueFvPatchField<Type>::getNewValues
|
||||
if (Pstream::myProcNo() == sendProc)
|
||||
{
|
||||
OPstream toProc(Pstream::scheduled, recvProc);
|
||||
toProc<< IndirectList<Type>(sendValues, sendLabels[recvProc])();
|
||||
toProc<< UIndirectList<Type>(sendValues, sendLabels[recvProc])();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -188,7 +188,11 @@ void directMappedFixedValueFvPatchField<Type>::getNewValues
|
||||
|
||||
// Do data from myself
|
||||
{
|
||||
IndirectList<Type> fromFld(sendValues, sendLabels[Pstream::myProcNo()]);
|
||||
UIndirectList<Type> fromFld
|
||||
(
|
||||
sendValues,
|
||||
sendLabels[Pstream::myProcNo()]
|
||||
);
|
||||
|
||||
// Destination faces
|
||||
const labelList& faceLabels = receiveFaceLabels[Pstream::myProcNo()];
|
||||
|
||||
@ -162,8 +162,8 @@ void directMappedVelocityFluxFixedValueFvPatchField::getNewValues
|
||||
if (Pstream::myProcNo() == sendProc)
|
||||
{
|
||||
OPstream toProc(Pstream::scheduled, recvProc);
|
||||
toProc<< IndirectList<vector>(sendUValues, sendLabels[recvProc])();
|
||||
toProc<< IndirectList<scalar>
|
||||
toProc<< UIndirectList<vector>(sendUValues, sendLabels[recvProc])();
|
||||
toProc<< UIndirectList<scalar>
|
||||
(
|
||||
sendPhiValues,
|
||||
sendLabels[recvProc]
|
||||
@ -192,13 +192,13 @@ void directMappedVelocityFluxFixedValueFvPatchField::getNewValues
|
||||
|
||||
// Do data from myself
|
||||
{
|
||||
IndirectList<vector> fromUFld
|
||||
UIndirectList<vector> fromUFld
|
||||
(
|
||||
sendUValues,
|
||||
sendLabels[Pstream::myProcNo()]
|
||||
);
|
||||
|
||||
IndirectList<scalar> fromPhiFld
|
||||
UIndirectList<scalar> fromPhiFld
|
||||
(
|
||||
sendPhiValues,
|
||||
sendLabels[Pstream::myProcNo()]
|
||||
|
||||
@ -209,7 +209,7 @@ void Foam::directMappedPolyPatch::findSamples
|
||||
// patch faces
|
||||
const labelList patchFaces(identity(pp.size()) + pp.start());
|
||||
|
||||
const treeBoundBox patchBb
|
||||
treeBoundBox patchBb
|
||||
(
|
||||
treeBoundBox(pp.points(), pp.meshPoints()).extend
|
||||
(
|
||||
@ -217,6 +217,8 @@ void Foam::directMappedPolyPatch::findSamples
|
||||
1E-4
|
||||
)
|
||||
);
|
||||
patchBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
patchBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
|
||||
autoPtr<indexedOctree<treeDataFace> > boundaryTree
|
||||
(
|
||||
@ -472,7 +474,7 @@ void Foam::directMappedPolyPatch::calcMapping() const
|
||||
|
||||
forAll(subMap, procI)
|
||||
{
|
||||
sendLabels[procI] = IndirectList<label>
|
||||
sendLabels[procI] = UIndirectList<label>
|
||||
(
|
||||
sampleIndices,
|
||||
subMap[procI]
|
||||
@ -491,7 +493,7 @@ void Foam::directMappedPolyPatch::calcMapping() const
|
||||
forAll(constructMap, procI)
|
||||
{
|
||||
receiveFaceLabels[procI] =
|
||||
IndirectList<label>(patchFaces, constructMap[procI]);
|
||||
UIndirectList<label>(patchFaces, constructMap[procI]);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
|
||||
@ -26,7 +26,6 @@ License
|
||||
|
||||
#include "indexedOctree.H"
|
||||
#include "linePointRef.H"
|
||||
// #include "triSurface.H"
|
||||
#include "meshTools.H"
|
||||
#include "OFstream.H"
|
||||
|
||||
|
||||
@ -460,8 +460,10 @@ const Foam::indexedOctree<Foam::treeDataFace>& Foam::meshSearch::boundaryTree()
|
||||
}
|
||||
|
||||
treeBoundBox overallBb(mesh_.points());
|
||||
|
||||
Random rndGen(123456);
|
||||
overallBb.extend(rndGen, 1E-4);
|
||||
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
|
||||
boundaryTreePtr_ = new indexedOctree<treeDataFace>
|
||||
(
|
||||
@ -471,7 +473,7 @@ const Foam::indexedOctree<Foam::treeDataFace>& Foam::meshSearch::boundaryTree()
|
||||
mesh_,
|
||||
bndFaces // boundary faces only
|
||||
),
|
||||
overallBb.extend(rndGen, 1E-3), // overall search domain
|
||||
overallBb, // overall search domain
|
||||
8, // maxLevel
|
||||
10, // leafsize
|
||||
3.0 // duplicity
|
||||
@ -492,6 +494,10 @@ const Foam::indexedOctree<Foam::treeDataCell>& Foam::meshSearch::cellTree()
|
||||
//
|
||||
|
||||
treeBoundBox overallBb(mesh_.points());
|
||||
Random rndGen(123456);
|
||||
overallBb.extend(rndGen, 1E-4);
|
||||
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
|
||||
cellTreePtr_ = new indexedOctree<treeDataCell>
|
||||
(
|
||||
@ -522,6 +528,10 @@ const Foam::indexedOctree<Foam::treeDataPoint>&
|
||||
//
|
||||
|
||||
treeBoundBox overallBb(mesh_.cellCentres());
|
||||
Random rndGen(123456);
|
||||
overallBb.extend(rndGen, 1E-4);
|
||||
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
|
||||
cellCentreTreePtr_ = new indexedOctree<treeDataPoint>
|
||||
(
|
||||
|
||||
@ -545,7 +545,7 @@ Foam::label Foam::meshTools::otherEdge
|
||||
"meshTools::otherEdge(const primitiveMesh&, const labelList&"
|
||||
", const label, const label)"
|
||||
) << "Can not find edge in "
|
||||
<< IndirectList<edge>(mesh.edges(), edgeLabels)()
|
||||
<< UIndirectList<edge>(mesh.edges(), edgeLabels)()
|
||||
<< " connected to edge "
|
||||
<< thisEdgeI << " with vertices " << mesh.edges()[thisEdgeI]
|
||||
<< " on side " << thisVertI << abort(FatalError);
|
||||
|
||||
@ -102,8 +102,8 @@ void Foam::primitiveMeshGeometry::updateCellCentresAndVols
|
||||
)
|
||||
{
|
||||
// Clear the fields for accumulation
|
||||
IndirectList<vector>(cellCentres_, changedCells) = vector::zero;
|
||||
IndirectList<scalar>(cellVolumes_, changedCells) = 0.0;
|
||||
UIndirectList<vector>(cellCentres_, changedCells) = vector::zero;
|
||||
UIndirectList<scalar>(cellVolumes_, changedCells) = 0.0;
|
||||
|
||||
const labelList& own = mesh_.faceOwner();
|
||||
const labelList& nei = mesh_.faceNeighbour();
|
||||
@ -111,9 +111,9 @@ void Foam::primitiveMeshGeometry::updateCellCentresAndVols
|
||||
// first estimate the approximate cell centre as the average of face centres
|
||||
|
||||
vectorField cEst(mesh_.nCells());
|
||||
IndirectList<vector>(cEst, changedCells) = vector::zero;
|
||||
UIndirectList<vector>(cEst, changedCells) = vector::zero;
|
||||
scalarField nCellFaces(mesh_.nCells());
|
||||
IndirectList<scalar>(nCellFaces, changedCells) = 0.0;
|
||||
UIndirectList<scalar>(nCellFaces, changedCells) = 0.0;
|
||||
|
||||
forAll(changedFaces, i)
|
||||
{
|
||||
|
||||
@ -432,7 +432,7 @@ void Foam::searchableSurfaceCollection::getRegion
|
||||
labelList surfRegion;
|
||||
subGeom_[surfI].getRegion
|
||||
(
|
||||
IndirectList<pointIndexHit>(info, indices),
|
||||
UIndirectList<pointIndexHit>(info, indices),
|
||||
surfRegion
|
||||
);
|
||||
forAll(indices, i)
|
||||
@ -495,7 +495,7 @@ void Foam::searchableSurfaceCollection::getNormal
|
||||
vectorField surfNormal;
|
||||
subGeom_[surfI].getNormal
|
||||
(
|
||||
IndirectList<pointIndexHit>(info, indices),
|
||||
UIndirectList<pointIndexHit>(info, indices),
|
||||
surfNormal
|
||||
);
|
||||
forAll(indices, i)
|
||||
|
||||
@ -352,17 +352,24 @@ const Foam::indexedOctree<Foam::treeDataTriSurface>&
|
||||
{
|
||||
if (tree_.empty())
|
||||
{
|
||||
treeBoundBox bb(points(), meshPoints());
|
||||
|
||||
// Random number generator. Bit dodgy since not exactly random ;-)
|
||||
Random rndGen(65431);
|
||||
|
||||
// Slightly extended bb. Slightly off-centred just so on symmetric
|
||||
// geometry there are less face/edge aligned items.
|
||||
treeBoundBox bb
|
||||
(
|
||||
treeBoundBox(points(), meshPoints()).extend(rndGen, 1E-4)
|
||||
);
|
||||
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
|
||||
tree_.reset
|
||||
(
|
||||
new indexedOctree<treeDataTriSurface>
|
||||
(
|
||||
treeDataTriSurface(*this),
|
||||
bb.extend(rndGen, 1E-4), // slightly randomize bb
|
||||
bb,
|
||||
10, // maxLevel
|
||||
10, // leafsize
|
||||
3.0 // duplicity
|
||||
@ -375,12 +382,10 @@ const Foam::indexedOctree<Foam::treeDataTriSurface>&
|
||||
|
||||
|
||||
const Foam::indexedOctree<Foam::treeDataEdge>&
|
||||
Foam::triSurfaceMesh::edgeTree() const
|
||||
Foam::triSurfaceMesh::edgeTree() const
|
||||
{
|
||||
if (edgeTree_.empty())
|
||||
{
|
||||
treeBoundBox bb(localPoints());
|
||||
|
||||
// Boundary edges
|
||||
labelList bEdges
|
||||
(
|
||||
@ -395,6 +400,15 @@ const Foam::indexedOctree<Foam::treeDataEdge>&
|
||||
// Random number generator. Bit dodgy since not exactly random ;-)
|
||||
Random rndGen(65431);
|
||||
|
||||
// Slightly extended bb. Slightly off-centred just so on symmetric
|
||||
// geometry there are less face/edge aligned items.
|
||||
treeBoundBox bb
|
||||
(
|
||||
treeBoundBox(points(), meshPoints()).extend(rndGen, 1E-4)
|
||||
);
|
||||
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
|
||||
edgeTree_.reset
|
||||
(
|
||||
new indexedOctree<treeDataEdge>
|
||||
@ -406,7 +420,7 @@ const Foam::indexedOctree<Foam::treeDataEdge>&
|
||||
localPoints(), // points
|
||||
bEdges // selected edges
|
||||
),
|
||||
bb.extend(rndGen, 1E-4), // slightly randomize bb
|
||||
bb, // bb
|
||||
8, // maxLevel
|
||||
10, // leafsize
|
||||
3.0 // duplicity
|
||||
@ -463,8 +477,11 @@ void Foam::triSurfaceMesh::findNearest
|
||||
|
||||
forAll(samples, i)
|
||||
{
|
||||
static_cast<pointIndexHit&>(info[i]) =
|
||||
octree.findNearest(samples[i], nearestDistSqr[i]);
|
||||
static_cast<pointIndexHit&>(info[i]) = octree.findNearest
|
||||
(
|
||||
samples[i],
|
||||
nearestDistSqr[i]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -504,8 +521,11 @@ void Foam::triSurfaceMesh::findLineAny
|
||||
|
||||
forAll(start, i)
|
||||
{
|
||||
static_cast<pointIndexHit&>(info[i]) =
|
||||
octree.findLineAny(start[i], end[i]);
|
||||
static_cast<pointIndexHit&>(info[i]) = octree.findLineAny
|
||||
(
|
||||
start[i],
|
||||
end[i]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -255,10 +255,7 @@ void topoSet::writeDebug
|
||||
) const
|
||||
{
|
||||
// Bounding box of contents.
|
||||
boundBox bb
|
||||
(
|
||||
pointField(IndirectList<point>(coords, toc())())
|
||||
);
|
||||
boundBox bb(pointField(coords, toc()));
|
||||
|
||||
Pout<< "Set bounding box: min = "
|
||||
<< bb.min() << " max = " << bb.max() << " meters. " << endl << endl;
|
||||
|
||||
@ -50,19 +50,21 @@ triSurfaceSearch::triSurfaceSearch(const triSurface& surface)
|
||||
surface_(surface),
|
||||
treePtr_(NULL)
|
||||
{
|
||||
treeBoundBox treeBb(surface_.points(), surface_.meshPoints());
|
||||
// Random number generator. Bit dodgy since not exactly random ;-)
|
||||
Random rndGen(65431);
|
||||
|
||||
scalar tol = 1E-6 * treeBb.avgDim();
|
||||
|
||||
point& bbMin = treeBb.min();
|
||||
bbMin.x() -= tol;
|
||||
bbMin.y() -= tol;
|
||||
bbMin.z() -= tol;
|
||||
|
||||
point& bbMax = treeBb.max();
|
||||
bbMax.x() += 2*tol;
|
||||
bbMax.y() += 2*tol;
|
||||
bbMax.z() += 2*tol;
|
||||
// Slightly extended bb. Slightly off-centred just so on symmetric
|
||||
// geometry there are less face/edge aligned items.
|
||||
treeBoundBox treeBb
|
||||
(
|
||||
treeBoundBox(surface_.points(), surface_.meshPoints()).extend
|
||||
(
|
||||
rndGen,
|
||||
1E-4
|
||||
)
|
||||
);
|
||||
treeBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
treeBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
|
||||
treePtr_.reset
|
||||
(
|
||||
|
||||
@ -212,7 +212,7 @@ void Foam::sampledSets::combineSampledSets
|
||||
(
|
||||
samplePts.name(),
|
||||
samplePts.axis(),
|
||||
IndirectList<point>(allPts, indexSets[seti]),
|
||||
UIndirectList<point>(allPts, indexSets[seti]),
|
||||
refPt
|
||||
)
|
||||
);
|
||||
|
||||
@ -198,8 +198,11 @@ void Foam::sampledSets::combineSampledValues
|
||||
)
|
||||
);
|
||||
|
||||
masterValues[seti] =
|
||||
IndirectList<T>(allData, indexSets[seti])();
|
||||
masterValues[seti] = UIndirectList<T>
|
||||
(
|
||||
allData,
|
||||
indexSets[seti]
|
||||
)();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -32,6 +32,8 @@ License
|
||||
#include "slicedVolFields.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "OFstream.H"
|
||||
#include "meshTools.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -963,20 +965,8 @@ void Foam::isoSurface::calcSnappedPoint
|
||||
}
|
||||
|
||||
|
||||
//Pout<< "**hack" << endl;
|
||||
//pointField oldCollaped(collapsedPoint);
|
||||
// Synchronise snap location
|
||||
syncUnseparatedPoints(collapsedPoint, greatPoint);
|
||||
//forAll(collapsedPoint, pointI)
|
||||
//{
|
||||
// if (collapsedPoint[pointI] != oldCollaped[pointI])
|
||||
// {
|
||||
// Pout<< "**Synced point " << pointI
|
||||
// << " coord:" << mesh_.points()[pointI]
|
||||
// << " from " << oldCollaped[pointI]
|
||||
// << " to " << collapsedPoint[pointI]
|
||||
// << endl;
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
snappedPoint.setSize(mesh_.nPoints());
|
||||
@ -1759,6 +1749,7 @@ Foam::isoSurface::isoSurface
|
||||
mesh_(cVals.mesh()),
|
||||
pVals_(pVals),
|
||||
iso_(iso),
|
||||
regularise_(regularise),
|
||||
mergeDistance_(mergeTol*mesh_.bounds().mag())
|
||||
{
|
||||
if (debug)
|
||||
@ -1772,7 +1763,7 @@ Foam::isoSurface::isoSurface
|
||||
<< min(pVals_) << " / "
|
||||
<< max(pVals_) << nl
|
||||
<< " isoValue : " << iso << nl
|
||||
<< " regularise : " << regularise << nl
|
||||
<< " regularise : " << regularise_ << nl
|
||||
<< " mergeTol : " << mergeTol << nl
|
||||
<< endl;
|
||||
}
|
||||
@ -1888,7 +1879,7 @@ Foam::isoSurface::isoSurface
|
||||
|
||||
// Per cc -1 or a point inside snappedPoints.
|
||||
labelList snappedCc;
|
||||
if (regularise)
|
||||
if (regularise_)
|
||||
{
|
||||
calcSnappedCc
|
||||
(
|
||||
@ -1920,7 +1911,7 @@ Foam::isoSurface::isoSurface
|
||||
|
||||
// Per point -1 or a point inside snappedPoints.
|
||||
labelList snappedPoint;
|
||||
if (regularise)
|
||||
if (regularise_)
|
||||
{
|
||||
// Determine if point is on boundary.
|
||||
PackedBoolList isBoundaryPoint(mesh_.nPoints());
|
||||
|
||||
@ -31,17 +31,30 @@ Description
|
||||
G.M. Treece, R.W. Prager and A.H. Gee.
|
||||
|
||||
Note:
|
||||
- in parallel the regularisation (coarsening) always takes place
|
||||
and slightly different surfaces will be created compared to non-parallel.
|
||||
The surface will still be continuous though!
|
||||
- does tets without using cell centres/cell values. Not tested.
|
||||
- regularisation can create duplicate triangles/non-manifold surfaces.
|
||||
Current handling of those is bit ad-hoc for now and not perfect.
|
||||
- regularisation does not do boundary points so as to preserve the
|
||||
boundary perfectly.
|
||||
- uses geometric merge with fraction of bounding box as distance.
|
||||
- triangles can be between two cell centres so constant sampling
|
||||
does not make sense.
|
||||
- on empty patches behaves like zero gradient.
|
||||
- does not do 2D correctly, creates non-flat iso surface.
|
||||
- on processor boundaries might two overlapping (identical) triangles
|
||||
(one from either side)
|
||||
|
||||
The handling on coupled patches is a bit complex. All fields
|
||||
(values and coordinates) get rewritten so
|
||||
- empty patches get zerogradient (value) and facecentre (coordinates)
|
||||
- separated processor patch faces get interpolate (value) and facecentre
|
||||
(coordinates). (this is already the default for cyclics)
|
||||
- non-separated processor patch faces keep opposite value and cell centre
|
||||
|
||||
Now the triangle generation on non-separated processor patch faces
|
||||
can use the neighbouring value. Any separated processor face or cyclic
|
||||
face gets handled just like any boundary face.
|
||||
|
||||
|
||||
SourceFiles
|
||||
isoSurface.C
|
||||
@ -101,6 +114,9 @@ class isoSurface
|
||||
//- Isosurface value
|
||||
const scalar iso_;
|
||||
|
||||
//- Regularise?
|
||||
const Switch regularise_;
|
||||
|
||||
//- When to merge points
|
||||
const scalar mergeDistance_;
|
||||
|
||||
|
||||
@ -28,6 +28,8 @@ License
|
||||
#include "polyMesh.H"
|
||||
#include "syncTools.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "OFstream.H"
|
||||
#include "meshTools.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -565,18 +567,20 @@ void Foam::isoSurface::generateTriPoints
|
||||
{
|
||||
const polyPatch& pp = patches[patchI];
|
||||
|
||||
if (isA<processorPolyPatch>(pp) && collocatedPatch(pp))
|
||||
if (isA<processorPolyPatch>(pp))
|
||||
{
|
||||
// Coincident processor patches. Boundary field of
|
||||
// cVals and cCoords is opposite cell.
|
||||
const processorPolyPatch& cpp =
|
||||
refCast<const processorPolyPatch>(pp);
|
||||
|
||||
//if (refCast<const processorPolyPatch>(pp).owner())
|
||||
PackedBoolList isCollocated(collocatedFaces(cpp));
|
||||
|
||||
forAll(isCollocated, i)
|
||||
{
|
||||
label faceI = pp.start();
|
||||
label faceI = pp.start()+i;
|
||||
|
||||
forAll(pp, i)
|
||||
if (faceCutType_[faceI] != NOTCUT)
|
||||
{
|
||||
if (faceCutType_[faceI] != NOTCUT)
|
||||
if (isCollocated[i])
|
||||
{
|
||||
generateFaceTriPoints
|
||||
(
|
||||
@ -600,7 +604,30 @@ void Foam::isoSurface::generateTriPoints
|
||||
triMeshCells
|
||||
);
|
||||
}
|
||||
faceI++;
|
||||
else
|
||||
{
|
||||
generateFaceTriPoints
|
||||
(
|
||||
cVals,
|
||||
pVals,
|
||||
|
||||
cCoords,
|
||||
pCoords,
|
||||
|
||||
snappedPoints,
|
||||
snappedCc,
|
||||
snappedPoint,
|
||||
faceI,
|
||||
|
||||
cVals.boundaryField()[patchI][i],
|
||||
cCoords.boundaryField()[patchI][i],
|
||||
false,
|
||||
pTraits<Type>::zero,
|
||||
|
||||
triPoints,
|
||||
triMeshCells
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -422,7 +422,7 @@ bool Foam::faceTriangulation::split
|
||||
"split(const bool, const pointField&, const face&"
|
||||
", const vector&, label&)"
|
||||
) << "Illegal face:" << f
|
||||
<< " with points " << IndirectList<point>(points, f)()
|
||||
<< " with points " << UIndirectList<point>(points, f)()
|
||||
<< endl;
|
||||
|
||||
return false;
|
||||
@ -501,7 +501,8 @@ bool Foam::faceTriangulation::split
|
||||
"split(const bool, const pointField&, const face&"
|
||||
", const vector&, label&)"
|
||||
) << "Cannot find valid diagonal on face " << f
|
||||
<< " with points " << IndirectList<point>(points, f)() << nl
|
||||
<< " with points " << UIndirectList<point>(points, f)()
|
||||
<< nl
|
||||
<< "Returning naive triangulation starting from "
|
||||
<< f[maxIndex] << " which might not be correct for a"
|
||||
<< " concave or warped face" << endl;
|
||||
@ -530,7 +531,8 @@ bool Foam::faceTriangulation::split
|
||||
"split(const bool, const pointField&, const face&"
|
||||
", const vector&, label&)"
|
||||
) << "Cannot find valid diagonal on face " << f
|
||||
<< " with points " << IndirectList<point>(points, f)() << nl
|
||||
<< " with points " << UIndirectList<point>(points, f)()
|
||||
<< nl
|
||||
<< "Returning empty triFaceList" << endl;
|
||||
|
||||
return false;
|
||||
@ -564,7 +566,7 @@ bool Foam::faceTriangulation::split
|
||||
"split(const bool, const pointField&, const face&"
|
||||
", const vector&, label&)"
|
||||
) << "Illegal split of face:" << f
|
||||
<< " with points " << IndirectList<point>(points, f)()
|
||||
<< " with points " << UIndirectList<point>(points, f)()
|
||||
<< " at indices " << index1 << " and " << index2
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ void triSurface::calcSortedEdgeFaces() const
|
||||
|
||||
faceAngles.sort();
|
||||
|
||||
sortedEdgeFaces[edgeI] = IndirectList<label>
|
||||
sortedEdgeFaces[edgeI] = UIndirectList<label>
|
||||
(
|
||||
myFaceNbs,
|
||||
faceAngles.indices()
|
||||
@ -179,7 +179,7 @@ void triSurface::calcEdgeOwner() const
|
||||
<< "Edge " << edgeI << " vertices:" << e
|
||||
<< " is used by faces " << myFaces
|
||||
<< " vertices:"
|
||||
<< IndirectList<labelledTri>(localFaces(), myFaces)()
|
||||
<< UIndirectList<labelledTri>(localFaces(), myFaces)()
|
||||
<< " none of which use the edge vertices in the same order"
|
||||
<< nl << "I give up" << abort(FatalError);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user