Commit e76a9624 authored by mattijs's avatar mattijs
Browse files

distributed surfaces

parent 9559aac4
......@@ -121,6 +121,12 @@ public:
return true;
}
//- Range of local indices that can be returned.
virtual label size() const
{
return 6;
}
// Single point queries.
......
......@@ -36,8 +36,8 @@ SourceFiles
#ifndef searchableSphere_H
#define searchableSphere_H
#include "searchableSurface.H"
#include "treeBoundBox.H"
#include "searchableSurface.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -127,6 +127,12 @@ public:
return true;
}
//- Range of local indices that can be returned.
virtual label size() const
{
return 1;
}
// Multiple point queries.
......
......@@ -56,6 +56,7 @@ namespace Foam
// Forward declaration of classes
class objectRegistry;
class mapDistribute;
class treeBoundBox;
/*---------------------------------------------------------------------------*\
......@@ -180,6 +181,15 @@ public:
//- Whether supports volume type below.
virtual bool hasVolumeType() const = 0;
//- Range of local indices that can be returned.
virtual label size() const = 0;
//- Range of global indices that can be returned.
virtual label globalSize() const
{
return size();
}
// Single point queries.
......@@ -296,16 +306,18 @@ public:
// Other
////- Get bounding box.
//const boundBox& bounds() const = 0;
////- Set bounding box.
//void setBounds
//(
// const boundBox&,
// autoPtr<mapDistribute>& faceMap,
// autoPtr<mapDistribute>& pointMap
//) = 0;
//- Set bounds of surface. Bounds currently set as list of
// bounding boxes. The bounds are hints to the surface as for
// the range of queries it can expect. faceMap/pointMap can be
// set if the surface has done any redistribution.
virtual void distribute
(
const List<treeBoundBox>&,
const bool keepNonLocal,
autoPtr<mapDistribute>& faceMap,
autoPtr<mapDistribute>& pointMap
)
{}
};
......
......@@ -149,7 +149,7 @@ public:
const pointField& start,
const pointField& end,
labelListList& surfaces,
List<List<pointIndexHit> >& surfaceHits
List<List<pointIndexHit> >&
) const;
//- Find nearest. Return -1 (and a miss()) or surface and nearest
......
......@@ -28,6 +28,8 @@ License
#include "Random.H"
#include "addToRunTimeSelectionTable.H"
#include "EdgeMap.H"
#include "triSurfaceFields.H"
#include "Time.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -299,57 +301,6 @@ const Foam::wordList& Foam::triSurfaceMesh::regions() const
}
//Foam::pointIndexHit Foam::triSurfaceMesh::findNearest
//(
// const point& sample,
// const scalar nearestDistSqr
//) const
//{
// return tree().findNearest(sample, nearestDistSqr);
//}
//
//
//Foam::pointIndexHit Foam::triSurfaceMesh::findNearestOnEdge
//(
// const point& sample,
// const scalar nearestDistSqr
//) const
//{
// return = edgeTree().findNearest(sample, nearestDistSqr);
//}
//
//
//Foam::pointIndexHit Foam::triSurfaceMesh::findNearest
//(
// const linePointRef& ln,
// treeBoundBox& tightest,
// point& linePoint
//) const
//{
// return tree().findNearest(ln, tightest, linePoint);
//}
//
//
//Foam::pointIndexHit Foam::triSurfaceMesh::findLine
//(
// const point& start,
// const point& end
//) const
//{
// return tree().findLine(start, end);
//}
//
//
//Foam::pointIndexHit Foam::triSurfaceMesh::findLineAny
//(
// const point& start,
// const point& end
//) const
//{
// return tree().findLineAny(start, end);
//}
// Find out if surface is closed.
bool Foam::triSurfaceMesh::hasVolumeType() const
{
......@@ -545,6 +496,29 @@ void Foam::triSurfaceMesh::getNormal
}
void Foam::triSurfaceMesh::getField
(
const word& fieldName,
const List<pointIndexHit>& info,
labelList& values
) const
{
const triSurfaceLabelField& fld = lookupObject<triSurfaceLabelField>
(
fieldName
);
values.setSize(info.size());
forAll(info, i)
{
if (info[i].hit())
{
values[i] = fld[info[i].index()];
}
}
}
void Foam::triSurfaceMesh::getVolumeType
(
const pointField& points,
......@@ -564,4 +538,31 @@ void Foam::triSurfaceMesh::getVolumeType
}
//- Write using given format, version and compression
bool Foam::triSurfaceMesh::writeObject
(
IOstream::streamFormat fmt,
IOstream::versionNumber ver,
IOstream::compressionType cmp
) const
{
fileName fullPath(searchableSurface::objectPath());
if (!mkDir(fullPath.path()))
{
return false;
}
triSurface::write(fullPath);
if (!file(fullPath))
{
return false;
}
//return objectRegistry::writeObject(fmt, ver, cmp);
return true;
}
// ************************************************************************* //
......@@ -36,6 +36,7 @@ SourceFiles
#ifndef triSurfaceMesh_H
#define triSurfaceMesh_H
#include "treeBoundBox.H"
#include "searchableSurface.H"
#include "objectRegistry.H"
#include "indexedOctree.H"
......@@ -142,8 +143,11 @@ public:
//- Whether supports volume type below. I.e. whether is closed.
virtual bool hasVolumeType() const;
// Multiple point queries.
//- Range of local indices that can be returned.
virtual label size() const
{
return triSurface::size();
}
virtual void findNearest
(
......@@ -196,6 +200,30 @@ public:
List<volumeType>&
) const;
//- Set bounds of surface. Bounds currently set as list of
// bounding boxes. The bounds are hints to the surface as for
// the range of queries it can expect. faceMap/pointMap can be
// set if the surface has done any redistribution.
virtual void distribute
(
const List<treeBoundBox>&,
const bool keepNonLocal,
autoPtr<mapDistribute>& faceMap,
autoPtr<mapDistribute>& pointMap
)
{}
// Other
//- Specific to triSurfaceMesh: from a set of hits (points and
// indices) get the specified field. Misses do not get set.
virtual void getField
(
const word& fieldName,
const List<pointIndexHit>&,
labelList& values
) const;
// regIOobject implementation
......@@ -205,6 +233,14 @@ public:
return false;
}
//- Write using given format, version and compression
virtual bool writeObject
(
IOstream::streamFormat fmt,
IOstream::versionNumber ver,
IOstream::compressionType cmp
) const;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment