Commit 9408b80f authored by Robert Maynard's avatar Robert Maynard

Add pointForEach API to the smtk::mesh::Interface.

parent af275131
......@@ -235,6 +235,10 @@ public:
smtk::mesh::PointConnectivity& bpc,
const smtk::mesh::ContainsFunctor& containsFunctor) const = 0;
//----------------------------------------------------------------------------
virtual void pointForEach( const HandleRange &points,
smtk::mesh::PointForEach& filter) const = 0;
//----------------------------------------------------------------------------
virtual void cellForEach( smtk::mesh::PointConnectivity& a,
smtk::mesh::CellForEach& filter) const = 0;
......
......@@ -162,6 +162,15 @@ public:
smtk::mesh::CollectionPtr m_collection;
};
//----------------------------------------------------------------------------
class SMTKCORE_EXPORT PointForEach
{
public:
virtual void operator()(const smtk::mesh::Handle& pointId,
const double* const coords)=0;
smtk::mesh::CollectionPtr m_collection;
};
//----------------------------------------------------------------------------
enum ContainmentType
......
......@@ -920,6 +920,30 @@ smtk::mesh::HandleRange Interface::pointDifference(const smtk::mesh::HandleRange
return detail::vectorToRange(vresult);
}
//----------------------------------------------------------------------------
void Interface::pointForEach(const smtk::mesh::HandleRange &points,
smtk::mesh::MeshForEach& filter) const
{
if(!points.empty())
{
std::vector<double> coords;
coords.reserve(3);
typedef smtk::mesh::HandleRange::const_iterator cit;
for(cit i = points.begin(); i!= points.end(); ++i)
{
//grab the coordinates for a single point
smtk::mesh::HandleRange singlHandle(*i,*i);
m_iface->get_coords(singlHandle, &coords[0]);
//call the custom filter
filter(*i,&coords[0]);
}
}
return;
}
//----------------------------------------------------------------------------
void Interface::cellForEach(smtk::mesh::PointConnectivity& pc,
smtk::mesh::CellForEach& filter) const
......
......@@ -203,6 +203,10 @@ public:
smtk::mesh::PointConnectivity& bpc,
const smtk::mesh::ContainsFunctor& containsFunctor) const;
//----------------------------------------------------------------------------
void pointForEach( const HandleRange &points,
smtk::mesh::PointForEach& filter) const;
//----------------------------------------------------------------------------
void cellForEach( smtk::mesh::PointConnectivity& a,
smtk::mesh::CellForEach& filter) 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