SICALLBACK aaOcean_BeginEvaluate( ICENodeContext& in_ctxt ) { // get ocean pointer from user-data aaOcean *pOcean = (aaOcean *)(CValue::siPtrType)in_ctxt.GetUserData(); // get ICE node input port arrays CDataArrayLong PointID( in_ctxt, ID_IN_PointID); CDataArrayLong resolution( in_ctxt, ID_IN_RESOLUTION); CDataArrayLong seed( in_ctxt, ID_IN_SEED); CDataArrayFloat waveHeight( in_ctxt, ID_IN_WAVE_HEIGHT); CDataArrayFloat waveSpeed( in_ctxt, ID_IN_WAVESPEED); CDataArrayFloat chop( in_ctxt, ID_IN_CHOP); CDataArrayFloat oceanScale( in_ctxt, ID_IN_OCEAN_SCALE ); CDataArrayFloat oceanDepth( in_ctxt, ID_IN_OCEAN_DEPTH ); CDataArrayFloat windDir( in_ctxt, ID_IN_WINDDIR ); CDataArrayFloat cutoff( in_ctxt, ID_IN_CUTOFF); CDataArrayFloat velocity( in_ctxt, ID_IN_WINDVELOCITY); CDataArrayLong windAlign( in_ctxt, ID_IN_WINDALIGN ); CDataArrayFloat damp( in_ctxt, ID_IN_DAMP); CDataArrayBool enableFoam( in_ctxt, ID_IN_ENABLEFOAM); CDataArrayFloat time( in_ctxt, ID_IN_TIME); CDataArrayFloat loopTime( in_ctxt, ID_IN_REPEAT_TIME); CDataArrayFloat surfaceTension( in_ctxt, ID_IN_SURFACE_TENSION); CDataArrayFloat randWeight( in_ctxt, ID_IN_RAND_WEIGHT); pOcean->input(resolution[0], seed[0], oceanScale[0], oceanDepth[0], surfaceTension[0], velocity[0], cutoff[0], windDir[0], windAlign[0], damp[0], waveSpeed[0], waveHeight[0], chop[0], time[0], loopTime[0], enableFoam[0], randWeight[0]); return CStatus::OK; }
void loadUKP1(structMatrix sM,float time, float (*waveSpeedFunction)(int,float)) { float fDelta[3]; fDelta[X_AXIS] = MESH_HLENGTH/N_HNODES; fDelta[Y_AXIS] = MESH_VLENGTH/N_VNODES; loadIdentityMatrix(sM); // Load indexes for inner nodes for(int i=1;i<(N_HNODES-1);i++) { for(int j=1;j<(N_VNODES-1);j++) { int index = i*N_HNODES+j; sM->matrix[index][index] = (-1/(pow(fDelta[X_AXIS],2)) -1/(pow(fDelta[Y_AXIS],2)) + 2/(waveSpeed(index,time)*pow(DELTA_TIME,2))); sM->matrix[index][index-1] = sM->matrix[index][index+1] = 1/(2*pow(fDelta[X_AXIS],2)); sM->matrix[index][index-N_HNODES] = sM->matrix[index][index+N_HNODES] = 1/(2*pow(fDelta[Y_AXIS],2)); } } }