#ifndef FASTERP_HH #define FASTERP_HH #include #include #include #include #include #include #include namespace CarpetInterp2 { using namespace std; int const dim = 3; // An interpolation point descriptor requires (3 * (max_order+1) + // 1) double precision values of memory int const max_order = 5; // Map C structures to MPI datatypes struct mpi_struct_descr_t { int blocklength; MPI_Aint displacement; MPI_Datatype type; }; void create_mpi_datatype (size_t count, mpi_struct_descr_t const descr[], MPI_Datatype & newtype); // A global location, given by its global coordinates struct fasterp_glocs_t { vector coords[dim]; fasterp_glocs_t (size_t const n) { for (int d=0; d maps; vector coords[dim]; fasterp_llocs_t (size_t const n) { maps.resize(n); for (int d=0; d const & varptrs, CCTK_REAL * restrict vals) const; private: template void interpolate (ivect const & lsh, vector const & varptrs, CCTK_REAL * restrict vals) const; template void interpolate (ivect const & lsh, vector const & varptrs, CCTK_REAL * restrict vals) const; }; // A receive descriptor, describing what is received from other // processors struct recv_proc_t { int p; // sending processor int offset; int npoints; // total number of received points }; struct recv_descr_t { vector procs; vector procinds; int npoints; // total number of received points vector index; // gather index list }; // A send descriptor; describing what to send to other processors struct send_comp_t { // This structure does not exist for all components -- components // which are not accessed are not described, making this a sparse // data structure. The field c contains the component number. vector locs; int c; // source component }; struct send_rl_t { vector comps; vector compinds; }; struct send_map_t { vector rls; }; struct send_proc_t { // This structure does not exist for all processors -- processors // with which there is no communication are not described, making // this a sparse data structure. The field p contains the // processor number. vector maps; int p; // receiving processor int offset; int npoints; // total number of sent points }; struct send_descr_t { vector procs; // vector procinds; int npoints; // total number of sent points }; class fasterp_setup_t { recv_descr_t recv_descr; send_descr_t send_descr; int order; public: fasterp_setup_t (cGH const * restrict cctkGH, fasterp_glocs_t const & locations, int order); ~ fasterp_setup_t (); void interpolate (cGH const * restrict cctkGH, vector const & varinds, vector & values) const; }; } // namespace CarpetInterp2 #endif // #define FASTERP_HH