27 template<
class GRID,
class T>
30 if(weights[0]>0.0) val += mpVal->get(x+1, y+0, z+0) * weights[0];
31 if(weights[1]>0.0) val += mpVal->get(x-1, y+0, z+0) * weights[1];
32 if(weights[2]>0.0) val += mpVal->get(x+0, y+1, z+0) * weights[2];
33 if(weights[3]>0.0) val += mpVal->get(x+0, y-1, z+0) * weights[3];
35 if(weights[4]>0.0) val += mpVal->get(x+0, y+0, z+1) * weights[4];
36 if(weights[5]>0.0) val += mpVal->get(x+0, y+0, z-1) * weights[5];
41 template<
class GRID,
class T>
46 void initMarching(GRID* val,
FlagGrid* flags) {
50 inline bool isInitialized() {
return mpVal != 0; }
53 inline void transpTouch(
int x,
int y,
int z, Real *weights, Real time) {
54 if(!mpVal || !mpFlags->isEmpty(x,y,z))
return;
55 T val = fmInterpolateNeighbors<GRID,T>(mpVal,x,y,z,weights);
56 (*mpVal)(x,y,z) = val;
63 template<
class GRID,
class T>
68 inline bool isInitialized() {
return mpVal != 0; }
69 void initMarching(GRID* val,
const FlagGrid* flags) {
75 inline void transpTouch(
int x,
int y,
int z, Real *weights, Real time) {
76 if(!mpVal || !mpFlags->isEmpty(x,y,z))
return;
78 T val = fmInterpolateNeighbors<GRID,T>(mpVal,x,y,z,weights);
81 if (mpFlags->isEmpty(x-1,y,z)) (*mpVal)(x,y,z).x = val.x;
82 if (mpFlags->isEmpty(x,y-1,z)) (*mpVal)(x,y,z).y = val.y;
83 if(mpVal->is3D()) {
if (mpFlags->isEmpty(x,y,z-1)) (*mpVal)(x,y,z).z = val.z; }
96 static inline bool compare(
const Real x,
const Real y) {
101 const Real d = fabs((time) - ((o.time)));
102 if (d > 0.)
return (time) > ((o.time));
103 if (p.z != o.p.z)
return p.z > o.p.z;
104 if (p.y != o.p.y)
return p.y > o.p.y;
115 static inline bool compare(
const Real x,
const Real y) {
120 const Real d = fabs((time) - ((o.time)));
121 if (d > 0.)
return (time) < ((o.time));
122 if (p.z != o.p.z)
return p.z < o.p.z;
123 if (p.y != o.p.y)
return p.y < o.p.y;
130 template<
class T,
int TDIR>
135 static inline Real InvalidTime() {
return -1000; }
136 static inline Real InvtOffset() {
return 500; }
138 enum SpecialValues { FlagInited = 1, FlagIsOnHeap = 2};
144 void performMarching();
147 inline bool isInvalid(Real v)
const {
return (v <= InvalidTime()); }
149 void addToList(
const Vec3i& p,
const Vec3i& src);
152 inline Real
phi2time(Real phival) {
return (phival-InvalidTime()+ InvtOffset()) * -1.0; }
155 inline Real
time2phi(Real tval) {
return (InvalidTime() - InvtOffset() - tval); }
157 inline Real _phi(
int i,
int j,
int k) {
return mLevelset(i,j,k); }
170 std::priority_queue<T, std::vector<T>, std::less<T> >
mHeap;
176 template<
int C>
inline Real calcWeights(
int& okCnt,
int& invcnt, Real* v,
const Vec3i& idx);
178 inline Real calculateDistance(
const Vec3i& pos);
Definition: commonkernels.h:22
Real mMaxTime
maximal time to march for
Definition: fastmarch.h:167
FmValueTransportVec3< MACGrid, Vec3 > mVelTransport
velocity extrpolation
Definition: fastmarch.h:164
Real time2phi(Real tval)
... and back
Definition: fastmarch.h:155
T fmInterpolateNeighbors(GRID *mpVal, int x, int y, int z, Real *weights)
Fast marching. Transport certain values.
Definition: fastmarch.h:28
Basic inlined vector class.
Definition: vectorbase.h:71
std::priority_queue< T, std::vector< T >, std::less< T > > mHeap
fast marching list
Definition: fastmarch.h:170
void transpTouch(int x, int y, int z, Real *weights, Real time)
cell is touched by marching from source cell
Definition: fastmarch.h:53
Real phi2time(Real phival)
convert phi to time value
Definition: fastmarch.h:152
Definition: fastmarch.h:42
void transpTouch(int x, int y, int z, Real *weights, Real time)
cell is touched by marching from source cell
Definition: fastmarch.h:75
Definition: fastmarch.h:110
Definition: fastmarch.h:91
fast marching algorithm wrapper class
Definition: fastmarch.h:131
bool isInvalid(Real v) const
test value for invalidity
Definition: fastmarch.h:147
Definition: fastmarch.h:64