26 # include <spatialops/SpatialOpsConfigure.h> 30 # include <spatialops/structured/SpatialMask.h> 36 # include <boost/math/special_functions/erf.hpp> 37 # include <boost/math/special_functions/gamma.hpp> 38 # include <boost/shared_ptr.hpp> 39 # include <boost/enable_shared_from_this.hpp> 42 # ifdef NEBO_REPORT_BACKEND 47 # ifdef ENABLE_THREADS 50 # include <boost/bind.hpp> 51 # include <spatialops/ThreadPool.h> 53 # include <spatialops/Semaphore.h> 59 # include <spatialops/structured/MemoryTypes.h> 69 template<
typename ... Args>
71 namespace CompileTimeOptionalArgsNamespace
78 inline GhostData calculate_actual_ghost(
bool const useGhost,
83 std::ostringstream msg;
84 msg <<
"Nebo error in " <<
"Nebo Ghost Checking" <<
":\n";
85 msg <<
"Not enough valid extra cells to validate all interior ";
86 msg <<
"cells in the X direction";
88 msg <<
"\t - " << __FILE__ <<
" : " << __LINE__;
89 throw(std::runtime_error(msg.str()));;
93 std::ostringstream msg;
94 msg <<
"Nebo error in " <<
"Nebo Ghost Checking" <<
":\n";
95 msg <<
"Not enough valid extra cells to validate all interior ";
96 msg <<
"cells in the Y direction";
98 msg <<
"\t - " << __FILE__ <<
" : " << __LINE__;
99 throw(std::runtime_error(msg.str()));;
103 std::ostringstream msg;
104 msg <<
"Nebo error in " <<
"Nebo Ghost Checking" <<
":\n";
105 msg <<
"Not enough valid extra cells to validate all interior ";
106 msg <<
"cells in the Z direction";
108 msg <<
"\t - " << __FILE__ <<
" : " << __LINE__;
109 throw(std::runtime_error(msg.str()));;
113 ? min((lhs + point_to_ghost(bc.
has_extra())), rhs)
119 template<
typename Type1,
typename Type2>
126 template<
typename Type>
129 inline IntVec nebo_find_partition(
IntVec const & extent,
130 int const thread_count) {
135 if(thread_count <= extent[2]) { z = thread_count; }
136 else if(thread_count <= extent[1]) { y = thread_count; }
137 else if(thread_count <= extent[0]) { x = thread_count; };
142 inline int nebo_partition_count(
IntVec const & split) {
143 return split[0] * split[1] * split[2];
146 inline void nebo_set_up_extents(
IntVec const & current,
158 for(
size_t i=0; i<3; ++i ){
159 assert( fullExtent[i] >= split[i] );
160 assert( split[i] > 0 );
161 assert( current[i] < split[i] );
162 assert( current[i] >= 0 );
167 IntVec const stdExtent = fullExtent / split;
170 IntVec const nExtra(fullExtent[0] % split[0],
171 fullExtent[1] % split[1],
172 fullExtent[2] % split[2]);
175 IntVec const pastExtra(current[0] < nExtra[0] ? current[0] : nExtra[0],
176 current[1] < nExtra[1] ? current[1] : nExtra[1],
177 current[2] < nExtra[2] ? current[2] : nExtra[2]);
180 IntVec const currentExtra(current[0] < nExtra[0] ? 1 : 0,
181 current[1] < nExtra[1] ? 1 : 0,
182 current[2] < nExtra[2] ? 1 : 0);
185 IntVec const low = stdExtent * current + pastExtra;
186 IntVec const high = low + stdExtent + currentExtra;
197 inline IntVec nebo_next_partition(
IntVec const & current,
201 if(current[2] < split[2] - 1)
202 result =
IntVec(current[0], current[1], 1 + current[2]);
203 else if(current[1] < split[1] - 1)
204 result =
IntVec(current[0], 1 + current[1], 0);
205 else result =
IntVec(1 + current[0], 0, 0);
210 template<
typename Operand,
typename FieldType>
213 FieldType
typedef field_type;
215 Operand
typedef Expression;
221 inline Operand
const & expr(
void)
const {
return expr_; }
227 template<
typename Operand,
typename T>
232 Operand
typedef Expression;
238 inline Operand
const & expr(
void)
const {
return expr_; }
244 template<
typename Operand,
typename FieldType>
247 FieldType
typedef field_type;
249 Operand
typedef Expression;
255 inline Operand
const & expr(
void)
const {
return expr_; }
261 template<
typename Operand,
typename T>
266 Operand
typedef Expression;
272 inline Operand
const & expr(
void)
const {
return expr_; }
316 : outerIndex_(idx), mappedValueRef_(mappedValueRef)
319 inline int * outerIndex (
void)
const {
return outerIndex_; }
321 inline void setOuterIndex (
const int x,
const int y,
const int z) {
328 mappedValueRef_ = mappedValue;
333 inline double * mappedValueRef (
void) {
return mappedValueRef_; }
336 int *
const outerIndex_;
337 double * mappedValueRef_;
342 # ifdef ENABLE_THREADS
bool has_bc(const int dir, const BCSide side) const
query to see if a physical boundary is present in the given direction (0=x, 1=y, 2=z) and the specifi...
int has_extra(const int dir) const
obtain the number of extra cells actually present on this field due to presence of physical boundarie...
IntVec get_plus() const
obtain the IntVec containing the number of ghost cells on the (+) faces
Holds information about the number of ghost cells on each side of the domain.
Parameter used to initialize Nebo expression operands across modes. The argument only stores informat...
IntVec get_minus() const
obtain the IntVec containing the number of ghost cells on the (-) faces
Provides information about boundary cells for various fields.