Interpolator Class Reference

Interpolator is a general template for a class that performs interpolation of data between arbitrary points in space (e.g., particle positions) and field element positions. More...

#include <Interpolation.h>


Detailed Description

Interpolator is a general template for a class that performs interpolation of data between arbitrary points in space (e.g., particle positions) and field element positions.

Interpolator is templated on the dimensionality and axis type of the spatial positions and a tag type that indicates what sort of interpolation scheme to use.

Each specialization of Interpolator should provide nine gather/scatter methods corresponding to the nine global functions declared above. Each method has the same interface as the corresponding global function except that the InterpolatorTag argument is not needed. These methods actually implement the gather or scatter using PatchParticle functors and dimension-specific specializations of the actual interpolation computational kernel.

In addition to these gather/scatter methods, the Interpolator specialization should export a typedef called Cache_t that is the type of an object suitable for caching all the necessary interpolation data for this type of Interpolator. The actual type that Cache_t refers to can be defined external to the Interpolator specialization, and an insertion operator for sending a Cache_t type to an ostream should be provided.

Here is an example of what this might look like:

// New interpolator tag
struct Foo { };

// declaration of interpolation data cache type
struct Bar;

// Definition of Interpolator class template specialization
template <int Dim, class T>
struct Interpolator<Dim,T,Foo>
{
  // typedef for the CacheData struct
  typedef Bar Cache_t;

  // gather/scatter using particle position attribute
  template <class PA, class FC, class PPos>
  static
  void gather(const PA&, const FC&, const PPos&) { ... }

  template <class PA, class FC, class PPos>
  static
  void scatter(const PA&, const FC&, const PPos&) { ... }

  template <class ValueT, class FC, class PPos>
  static
  void scatterValue(const ValueT&, const FC&, const PPos&) { ... }

  // gather/scatter using particle position attribute and cached
  // interpolation data
  template <class PA, class FC, class PPos, class EngineTag>
  static
  void gatherCache(const PA&, const FC&, const PPos&,
                   const DynamicArray<Cache_t,EngineTag>&) { ... }

  template <class PA, class FC, class PPos, class EngineTag>
  static
  void scatterCache(const PA&, const FC&, const PPos&,
                    const DynamicArray<Cache_t,EngineTag>&) { ... }

  template <class ValueT, class FC, class PPos, class EngineTag>
  static
  void scatterValueCache(const ValueT&, const FC&, const PPos&,
                         const DynamicArray<Cache_t,EngineTag>&) { ... }

  // gather/scatter using cached interpolation data
  template <class PA, class FC, class EngineTag>
  static
  void gatherCache(const PA&, const FC&,
                   const DynamicArray<Cache_t,EngineTag>&) { ... }

  template <class PA, class FC, class EngineTag>
  static
  void scatterCache(const PA&, const FC&,
                    const DynamicArray<Cache_t,EngineTag>&) { ... }

  template <class ValueT, class FC, class EngineTag>
  static
  void scatterValueCache(const ValueT&, const FC&,
                         const DynamicArray<Cache_t,EngineTag>&) { ... }
};

// definition of interpolation data cache type
struct Bar
{
  // Add data here for location of nearest grid point (a Loc<Dim>)
  // and distance to particle position (a Vector<Dim,AxisType_t>) as needed.
  // Also provide a templated print function that prints CacheData.
  // Publicly export Dim and AxisType_t.
};

// Send interpolation data cache type to an ostream
inline
std::ostream&
operator<<(std::ostream& o, const Bar&)
{
  // print out cache data
  return o;
}

The documentation for this class was generated from the following file:

Generated on Wed Mar 16 06:20:15 2011 for FreePOOMA by  doxygen 1.5.9