void tfsfInit(Grid *g) { printf("Enter location of TFSF boundary: "); scanf(" %d", &tfsfBoundary); ezIncInit(g); // initialize source function return; }
int main(int argc, char** argv) { gridInit(g); // Initialize the grid ezIncInit(g); // Initialize the sources initializeGlobalDevicePointers(); // Initialize all global dev pointers to zero runFdtdWithFieldDisplay(argc, argv); }
int main() { Grid *g; ALLOC_1D(g, 1, Grid); // allocate memory for Grid gridInit(g); // initialize the grid ezIncInit(g); snapshotInit2d(g); // initialize snapshots /* do time stepping */ for (Time = 0; Time < MaxTime; Time++) { updateH2d(g); // update magnetic field updateE2d(g); // update electric field Ez(SizeX / 2, SizeY / 2) = ezInc(Time, 0.0); // add a source snapshot2d(g); // take a snapshot (if appropriate) } // end of time-stepping return 0; }
int main() { Grid *g; /*@ \label{improved2A} @*/ ALLOC_1D(g, 1, Grid); // allocate memory for Grid /*@ \label{improved2B} @*/ gridInit2(g); // initialize the grid /*@ \label{improved2C} @*/ ezIncInit(g); // initialize source function /*@ \label{improved2H} @*/ /* do time stepping */ for (Time = 0; Time < MaxTime; Time++) { /*@ \label{improved2D} @*/ updateH2(g); // update magnetic field /*@ \label{improved2E} @*/ updateE2(g); // update electric field /*@ \label{improved2F} @*/ Ez(0) = ezInc(Time, 0.0); // apply source function /*@ \label{improved2Z} @*/ printf("%g\n", Ez(50)); // print output /*@ \label{improved2G} @*/ } // end of time-stepping return 0; }