diff options
author | schnetter <> | 2004-01-21 15:32:00 +0000 |
---|---|---|
committer | schnetter <> | 2004-01-21 15:32:00 +0000 |
commit | bb9506a03c40d2935d80a8cf2c9b9c3930d9f707 (patch) | |
tree | da98bc7bd0b6031bb948aaaeee16614655aa3106 /Carpet/CarpetLib/src | |
parent | 5113d28d69d8d11f5b24ee1c402359b8721601b1 (diff) |
Undo my previous changes, which did not compile.
darcs-hash:20040121153204-07bb3-2737dc30c6c1b867713208ee5dfe49085ba1b625.gz
Diffstat (limited to 'Carpet/CarpetLib/src')
-rw-r--r-- | Carpet/CarpetLib/src/data.cc | 229 |
1 files changed, 46 insertions, 183 deletions
diff --git a/Carpet/CarpetLib/src/data.cc b/Carpet/CarpetLib/src/data.cc index 61aa92f20..f6158bae8 100644 --- a/Carpet/CarpetLib/src/data.cc +++ b/Carpet/CarpetLib/src/data.cc @@ -1,15 +1,10 @@ -// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/data.cc,v 1.37 2004/01/21 14:25:09 schnetter Exp $ +// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/data.cc,v 1.38 2004/01/21 16:32:04 schnetter Exp $ #include <assert.h> #include <limits.h> -#include <stdlib.h> -#include <math.h> -#include <algorithm> #include <iostream> -#include <sstream> #include <string> -#include <vector> #include <mpi.h> @@ -39,17 +34,16 @@ static int nexttag () // Constructors template<class T, int D> -data<T,D>::data (const int varindex_, const operator_type transport_operator_) - : gdata<D>(varindex_, transport_operator_), +data<T,D>::data (const int varindex_) + : gdata<D>(varindex_), _storage(0), comm_active(false), tag(nexttag()) { } template<class T, int D> -data<T,D>::data (const int varindex_, const operator_type transport_operator_, - const ibbox& extent_, const int proc_) - : gdata<D>(varindex_, transport_operator_), +data<T,D>::data (const int varindex_, const ibbox& extent_, const int proc_) + : gdata<D>(varindex_), _storage(0), comm_active(false), tag(nexttag()) @@ -65,11 +59,8 @@ data<T,D>::~data () { // Pseudo constructors template<class T, int D> -data<T,D>* data<T,D>::make_typed (const int varindex_, - const operator_type transport_operator_) - const -{ - return new data(varindex_, transport_operator_); +data<T,D>* data<T,D>::make_typed (const int varindex_) const { + return new data(varindex_); } @@ -116,7 +107,7 @@ void data<T,D>::transfer_from (gdata<D>* gsrc) { data* src = (data*)gsrc; assert (!_storage); *this = *src; - *src = data(this->varindex, this->transport_operator); + *src = data(this->varindex); } @@ -168,12 +159,9 @@ void data<T,D>::change_processor_recv (const int newproc, void* const mem) _storage = (T*)mem; } - const double wtime1 = MPI_Wtime(); T dummy; MPI_Irecv (_storage, this->_size, dist::datatype(dummy), this->_proc, this->tag, dist::comm, &request); - const double wtime2 = MPI_Wtime(); - this->wtime_irecv += wtime2 - wtime1; } else if (rank == this->_proc) { // copy to other processor @@ -209,12 +197,9 @@ void data<T,D>::change_processor_send (const int newproc, void* const mem) assert (!mem); assert (_storage); - const double wtime1 = MPI_Wtime(); T dummy; MPI_Isend (_storage, this->_size, dist::datatype(dummy), newproc, this->tag, dist::comm, &request); - const double wtime2 = MPI_Wtime(); - this->wtime_isend += wtime2 - wtime1; } else { assert (!mem); @@ -242,11 +227,8 @@ void data<T,D>::change_processor_wait (const int newproc, void* const mem) if (rank == newproc) { // copy from other processor - const double wtime1 = MPI_Wtime(); MPI_Status status; MPI_Wait (&request, &status); - const double wtime2 = MPI_Wtime(); - this->wtime_irecvwait += wtime2 - wtime1; } else if (rank == this->_proc) { // copy to other processor @@ -254,11 +236,8 @@ void data<T,D>::change_processor_wait (const int newproc, void* const mem) assert (!mem); assert (_storage); - const double wtime1 = MPI_Wtime(); MPI_Status status; MPI_Wait (&request, &status); - const double wtime2 = MPI_Wtime(); - this->wtime_isendwait += wtime2 - wtime1; if (this->_owns_storage) { delete [] _storage; @@ -574,15 +553,6 @@ extern "C" { const int srcbbox[3][3], const int dstbbox[3][3], const int regbbox[3][3]); - void CCTK_FCALL CCTK_FNAME(prolongate_3d_real8_2tl_rf2) - (const CCTK_REAL8* src1, const CCTK_REAL8& t1, - const CCTK_REAL8* src2, const CCTK_REAL8& t2, - const int& srciext, const int& srcjext, const int& srckext, - CCTK_REAL8* dst, const CCTK_REAL8& t, - const int& dstiext, const int& dstjext, const int& dstkext, - const int srcbbox[3][3], - const int dstbbox[3][3], - const int regbbox[3][3]); void CCTK_FCALL CCTK_FNAME(prolongate_3d_real8_2tl_o3) (const CCTK_REAL8* src1, const CCTK_REAL8& t1, const CCTK_REAL8* src2, const CCTK_REAL8& t2, @@ -592,15 +562,6 @@ extern "C" { const int srcbbox[3][3], const int dstbbox[3][3], const int regbbox[3][3]); - void CCTK_FCALL CCTK_FNAME(prolongate_3d_real8_2tl_o3_rf2) - (const CCTK_REAL8* src1, const CCTK_REAL8& t1, - const CCTK_REAL8* src2, const CCTK_REAL8& t2, - const int& srciext, const int& srcjext, const int& srckext, - CCTK_REAL8* dst, const CCTK_REAL8& t, - const int& dstiext, const int& dstjext, const int& dstkext, - const int srcbbox[3][3], - const int dstbbox[3][3], - const int regbbox[3][3]); void CCTK_FCALL CCTK_FNAME(prolongate_3d_real8_2tl_minmod) (const CCTK_REAL8* src1, const CCTK_REAL8& t1, const CCTK_REAL8* src2, const CCTK_REAL8& t2, @@ -690,8 +651,6 @@ void data<CCTK_REAL8,3> const int order_space, const int order_time) { - const CCTK_REAL eps = 1.0e-10; - assert (has_storage()); assert (all(box.lower()>=extent().lower())); assert (all(box.upper()<=extent().upper())); @@ -735,46 +694,8 @@ void data<CCTK_REAL8,3> regbbox[2][d] = box.stride()[d]; } - // Check that the times are consistent - assert (times.size() > 0); - CCTK_REAL min_time = times[0]; - CCTK_REAL max_time = times[0]; - for (size_t tl=1; tl<times.size(); ++tl) { - min_time = min(min_time, times[tl]); - max_time = max(max_time, times[tl]); - } - if (time < min_time - eps || time > max_time + eps) { - ostringstream buf; - buf << "Internal error: extrapolation in time." - << " time=" << time - << " times=" << times; - CCTK_WARN (0, buf.str().c_str()); - } - - // Is it necessary to interpolate in time? - if (times.size() > 1) { - for (size_t tl=0; tl<times.size(); ++tl) { - assert (abs(1.5) > 1.4); - if (abs(times[tl] - time) < eps) { - // It is not. - vector<const gdata<3>*> my_gsrcs(1); - vector<CCTK_REAL> my_times(1); - my_gsrcs[0] = gsrcs[tl]; - my_times[0] = times[tl]; - const int my_order_time = 0; - this->interpolate_from_innerloop - (my_gsrcs, my_times, box, time, order_space, my_order_time); - return; - } - } - } - assert (all(dext.stride() == box.stride())); if (all(sext.stride() < dext.stride())) { - // Restrict - - assert (times.size() == 1); - assert (abs(times[0] - time) < eps); switch (transport_operator) { @@ -801,10 +722,9 @@ void data<CCTK_REAL8,3> default: assert (0); - } // switch (transport_operator) + } // switch (prolong_method) } else if (all(sext.stride() > dext.stride())) { - // Prolongate switch (transport_operator) { @@ -812,8 +732,6 @@ void data<CCTK_REAL8,3> switch (order_time) { case 0: - assert (times.size() == 1); - assert (abs(times[0] - time) < eps); assert (srcs.size()>=1); switch (order_space) { case 0: @@ -871,43 +789,23 @@ void data<CCTK_REAL8,3> switch (order_space) { case 0: case 1: - if (all (sext.stride() == dext.stride() * 2)) { - CCTK_FNAME(prolongate_3d_real8_2tl_rf2) - ((const CCTK_REAL8*)srcs[0]->storage(), times[0], - (const CCTK_REAL8*)srcs[1]->storage(), times[1], - srcshp[0], srcshp[1], srcshp[2], - (CCTK_REAL8*)storage(), time, - dstshp[0], dstshp[1], dstshp[2], - srcbbox, dstbbox, regbbox); - } else { - CCTK_FNAME(prolongate_3d_real8_2tl) - ((const CCTK_REAL8*)srcs[0]->storage(), times[0], - (const CCTK_REAL8*)srcs[1]->storage(), times[1], - srcshp[0], srcshp[1], srcshp[2], - (CCTK_REAL8*)storage(), time, - dstshp[0], dstshp[1], dstshp[2], - srcbbox, dstbbox, regbbox); - } + CCTK_FNAME(prolongate_3d_real8_2tl) + ((const CCTK_REAL8*)srcs[0]->storage(), times[0], + (const CCTK_REAL8*)srcs[1]->storage(), times[1], + srcshp[0], srcshp[1], srcshp[2], + (CCTK_REAL8*)storage(), time, + dstshp[0], dstshp[1], dstshp[2], + srcbbox, dstbbox, regbbox); break; case 2: case 3: - if (all (sext.stride() == dext.stride() * 2)) { - CCTK_FNAME(prolongate_3d_real8_2tl_o3_rf2) - ((const CCTK_REAL8*)srcs[0]->storage(), times[0], - (const CCTK_REAL8*)srcs[1]->storage(), times[1], - srcshp[0], srcshp[1], srcshp[2], - (CCTK_REAL8*)storage(), time, - dstshp[0], dstshp[1], dstshp[2], - srcbbox, dstbbox, regbbox); - } else { - CCTK_FNAME(prolongate_3d_real8_2tl_o3) - ((const CCTK_REAL8*)srcs[0]->storage(), times[0], - (const CCTK_REAL8*)srcs[1]->storage(), times[1], - srcshp[0], srcshp[1], srcshp[2], - (CCTK_REAL8*)storage(), time, - dstshp[0], dstshp[1], dstshp[2], - srcbbox, dstbbox, regbbox); - } + CCTK_FNAME(prolongate_3d_real8_2tl_o3) + ((const CCTK_REAL8*)srcs[0]->storage(), times[0], + (const CCTK_REAL8*)srcs[1]->storage(), times[1], + srcshp[0], srcshp[1], srcshp[2], + (CCTK_REAL8*)storage(), time, + dstshp[0], dstshp[1], dstshp[2], + srcbbox, dstbbox, regbbox); break; case 4: case 5: @@ -995,75 +893,40 @@ void data<CCTK_REAL8,3> case op_TVD: switch (order_time) { case 0: - assert (times.size() == 1); - assert (abs(times[0] - time) < eps); - switch (order_space) { - case 0: - case 1: - CCTK_WARN (0, "There is no stencil for op=""TVD"" with order_space=1"); - break; - case 2: - case 3: - CCTK_FNAME(prolongate_3d_real8_minmod) - ((const CCTK_REAL8*)srcs[0]->storage(), - srcshp[0], srcshp[1], srcshp[2], - (CCTK_REAL8*)storage(), - dstshp[0], dstshp[1], dstshp[2], - srcbbox, dstbbox, regbbox); - break; - default: - assert (0); - } + CCTK_FNAME(prolongate_3d_real8_minmod) + ((const CCTK_REAL8*)srcs[0]->storage(), + srcshp[0], srcshp[1], srcshp[2], + (CCTK_REAL8*)storage(), + dstshp[0], dstshp[1], dstshp[2], + srcbbox, dstbbox, regbbox); break; case 1: - switch (order_space) { - case 0: - case 1: - CCTK_WARN (0, "There is no stencil for op=""TVD"" with order_space=1"); - break; - case 2: - case 3: - CCTK_FNAME(prolongate_3d_real8_2tl_minmod) - ((const CCTK_REAL8*)srcs[0]->storage(), times[0], - (const CCTK_REAL8*)srcs[1]->storage(), times[1], - srcshp[0], srcshp[1], srcshp[2], - (CCTK_REAL8*)storage(), time, - dstshp[0], dstshp[1], dstshp[2], - srcbbox, dstbbox, regbbox); - break; - default: - assert (0); - } + CCTK_FNAME(prolongate_3d_real8_2tl_minmod) + ((const CCTK_REAL8*)srcs[0]->storage(), times[0], + (const CCTK_REAL8*)srcs[1]->storage(), times[1], + srcshp[0], srcshp[1], srcshp[2], + (CCTK_REAL8*)storage(), time, + dstshp[0], dstshp[1], dstshp[2], + srcbbox, dstbbox, regbbox); break; case 2: - switch (order_space) { - case 0: - case 1: - CCTK_WARN (0, "There is no stencil for op=""TVD"" with order_space=1"); - break; - case 2: - case 3: - CCTK_FNAME(prolongate_3d_real8_3tl_minmod) - ((const CCTK_REAL8*)srcs[0]->storage(), times[0], - (const CCTK_REAL8*)srcs[1]->storage(), times[1], - (const CCTK_REAL8*)srcs[2]->storage(), times[2], - srcshp[0], srcshp[1], srcshp[2], - (CCTK_REAL8*)storage(), time, - dstshp[0], dstshp[1], dstshp[2], - srcbbox, dstbbox, regbbox); - break; - default: - assert (0); - } + CCTK_FNAME(prolongate_3d_real8_3tl_minmod) + ((const CCTK_REAL8*)srcs[0]->storage(), times[0], + (const CCTK_REAL8*)srcs[1]->storage(), times[1], + (const CCTK_REAL8*)srcs[2]->storage(), times[2], + srcshp[0], srcshp[1], srcshp[2], + (CCTK_REAL8*)storage(), time, + dstshp[0], dstshp[1], dstshp[2], + srcbbox, dstbbox, regbbox); break; default: assert (0); - } // switch (order_time) + } break; default: assert(0); - } // switch (transport_operator) + } // switch (prolong_method) } else { assert (0); |