Dear Steven and meep users,

I need to time average |Ex|² over a period of time in C++ interface.
Currently, I do this as follows, but IMO, this is not appropriate method
when MPI is used.

//Initialzing an array
    const double resolution_sampling = 0.2;
    const int total = int(x_width / resolution_sampling);
    double *samples = new dcomp [total];
    for (int i = 0; i < total; i++) {
            *(samples + i)  = 0.0;    // Initialize all elements to zero.
    }
.............................
.............................
//In Main loop

        for (int i = 0; i < total; i++) {
           dcomp myfield = field1.get_field(Ex, vec((double)(i *
resolution_sampling), 5.0))
            * (samples + i) += abs(myfield) * abs(myfield);
        }



My questions are:
1. Is there any better method available to do this?
2. Since I run Meep over a cluster, how can I save the output of "samples"
to a file?

Thanks
Joe.
_______________________________________________
meep-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Reply via email to