Chombo + EB  3.2
BaseFabImplem.H
Go to the documentation of this file.
1 #ifdef CH_LANG_CC
2 /*
3  * _______ __
4  * / ___/ / ___ __ _ / / ___
5  * / /__/ _ \/ _ \/ V \/ _ \/ _ \
6  * \___/_//_/\___/_/_/_/_.__/\___/
7  * Please refer to Copyright.txt, in Chombo's root directory.
8  */
9 #endif
10 
11 #include <utility>
12 #ifndef _BASEFABIMPLEM_H_
13 #define _BASEFABIMPLEM_H_
14 
15 #include "BaseFabMacros.H"
16 #include "CH_Timer.H"
17 #include "SliceSpec.H"
18 #include "MayDay.H"
19 #include "parstream.H"
20 #include "BoxIterator.H"
21 #include "NamespaceHeader.H"
22 
23 //
24 // BaseFab<Real> specializations
25 //
26 
27 template < > void BaseFab<Real>::define();
28 
29 template < > void BaseFab<Real>::undefine();
30 
31 template < > void BaseFab<Real>::setVal (Real val);
32 
33 template < > void BaseFab<int>::define();
34 
35 template < > void BaseFab<int>::undefine();
36 
37 template < > int BaseFab<int>::test();
38 
39 template <class T> int BaseFab<T>::testBoxAndComp()
40 {
41  MayDay::Warning("pretty minimal test");
43  BaseFab<T> blerg;
44  blerg.define(b, 1);
45 
46  if (blerg.nComp() != 1)
47  {
48  pout() << "ncomp busted" << endl;
49  return -2;
50  }
51  if (blerg.box() != b)
52  {
53  pout() << "box return busted" << endl;
54  return -2;
55  }
56  for (int idir = 0; idir < SpaceDim; idir++)
57  {
58  if (blerg.size()[idir] != 2)
59  {
60  pout() << "size busted" <<endl;
61  return -3;
62  }
63  }
64 
65  if (blerg.smallEnd() != IntVect::Zero)
66  {
67  pout() << "smallend busted" <<endl;
68  return -4;
69  }
70  if (blerg.bigEnd() != IntVect::Unit)
71  {
72  pout() << "bigend busted" <<endl;
73  return -5;
74  }
75  return 0;
76 }///
77 template <class T> int BaseFab<T>::test()
78 {
79  int retval = testBoxAndComp();
80  return retval;
81 }
82 
83 //
84 // Implementation.=====================================
85 //
86 template <class T> inline BaseFab<T>::BaseFab(BaseFab<T>&& a_in) noexcept
87  :m_domain(std::move(a_in.m_domain)),
88  m_nvar(a_in.m_nvar),
89  m_numpts(a_in.m_numpts),
90  m_truesize(a_in.m_truesize),
91  m_dptr(a_in.m_dptr),
92  m_aliased(a_in.m_aliased)
93 {
94  a_in.m_aliased=true;
95 }
96 
97 template <class T> inline BaseFab<T>& BaseFab<T>::operator=(BaseFab<T>&& a_in) noexcept
98 {
99  m_domain = std::move(a_in.m_domain);
100  m_nvar=a_in.m_nvar;
101  m_numpts=a_in.m_numpts;
102  std::swap(m_truesize,a_in.m_truesize);
103  std::swap(m_dptr,a_in.m_dptr);
104  std::swap(m_aliased,a_in.m_aliased);
105  return *this;
106 }
107 
108 template <class T> inline BaseFab<T>::BaseFab()
109  :
110  m_domain(Box()),
111  m_nvar(0),
112  m_numpts(0),
113  m_truesize(0),
114  m_dptr(0),
115  m_aliased(false)
116 {
117 }
118 
119 template <class T> inline BaseFab<T>::BaseFab(const Box& a_bx,
120  int a_n,
121  T* a_alias)
122  :
123  m_domain(a_bx),
124  m_nvar(a_n),
125  m_numpts(a_bx.numPts()),
126  m_truesize(a_bx.numPts() * a_n),
127  m_dptr(0),
128  m_aliased(false)
129 {
130  if (a_alias != NULL)
131  {
132  m_dptr = a_alias;
133  m_aliased = true;
134  }
135  else
136  {
137  define();
138  }
139 }
140 
141 template <class T> inline BaseFab<T>::BaseFab(const Interval& a_comps,
142  BaseFab<T>& a_original)
143  :
144  m_domain(a_original.m_domain),
145  m_nvar(a_comps.size()),
146  m_numpts(a_original.m_numpts),
147  m_truesize(a_original.m_numpts * m_nvar),
148  m_dptr(a_original.dataPtr(a_comps.begin())),
149  m_aliased(true)
150 {
151 }
152 
153 template <class T> inline BaseFab<T>::~BaseFab()
154 {
155  undefine();
156 }
157 
158 template <class T> void BaseFab<T>::resize(const Box& a_b,
159  int a_n,
160  T* a_alias)
161 {
162  // m_nvar = a_n;
163  // m_domain = a_b;
164  // m_numpts = m_domain.numPts();
165  //
166  // if (m_dptr == 0)
167  // {
168  // define();
169  // }
170  // else if (m_nvar*m_numpts > m_truesize)
171  // {
172  // undefine();
173  // define();
174  // }
175 
176  undefine();
177 
178  m_nvar = a_n;
179  m_domain = a_b;
180  m_numpts = m_domain.numPts();
181  m_truesize = m_numpts * m_nvar;
182 
183  if (a_alias != NULL)
184  {
185  m_dptr = a_alias;
186  m_aliased = true;
187  }
188  else
189  {
190  m_aliased = false;
191  define();
192  }
193 }
194 
195 template <class T> inline void BaseFab<T>::define(const Interval& a_comps,
196  BaseFab<T>& a_original)
197 {
198  undefine();
199 
200  m_domain = a_original.m_domain;
201  m_numpts = a_original.m_numpts;
202  m_truesize = a_original.m_numpts*a_comps.size();
203  m_nvar = a_comps.size();
204  m_dptr = a_original.dataPtr(a_comps.begin());
205  m_aliased = true;
206  // resize(a_original.m_domain, a_comps.size(),
207  // a_original.dataPtr(a_comps.begin()));
208 }
209 
210 template <class T> inline void BaseFab<T>::clear()
211 {
212  undefine();
213 
214  m_domain = Box();
215  m_nvar = 0;
216  m_numpts = 0;
217 }
218 
219 template <class T> inline int BaseFab<T>::nComp() const
220 {
221  return m_nvar;
222 }
223 
224 template <class T> Arena* BaseFab<T>::s_Arena = NULL;
225 
226 template <class T> inline const Box& BaseFab<T>::box() const
227 {
228  return m_domain;
229 }
230 
231 template <class T> inline IntVect BaseFab<T>::size() const
232 {
233  return m_domain.size();
234 }
235 
236 template <class T> inline const IntVect& BaseFab<T>::smallEnd() const
237 {
238  return m_domain.smallEnd();
239 }
240 
241 template <class T> inline const IntVect& BaseFab<T>::bigEnd() const
242 {
243  return m_domain.bigEnd();
244 }
245 
246 template <class T> inline T& BaseFab<T>::operator () (const IntVect& a_p,
247  int a_n)
248 {
249  CH_assert(a_n >= 0);
250  CH_assert(a_n < m_nvar);
251  CH_assert(!(m_dptr == 0));
252  CH_assert(m_domain.contains(a_p));
253 
254  long int ind1 = m_domain.index(a_p);
255  long int ind2 = a_n * m_numpts;
256  long int ind = ind1 + ind2;
257 
258  return m_dptr[ind];
259 }
260 
261 template <class T> inline T& BaseFab<T>::operator () (const IntVect& a_p)
262 {
263  CH_assert(!(m_dptr == 0));
264  CH_assert(m_domain.contains(a_p));
265 
266  return m_dptr[m_domain.index(a_p)];
267 }
268 
269 template <class T> inline const T& BaseFab<T>::operator () (const IntVect& a_p,
270  int a_n) const
271 {
272  CH_assert(a_n >= 0);
273  CH_assert(a_n < m_nvar);
274  CH_assert(!(m_dptr == 0));
275  CH_assert(m_domain.contains(a_p));
276 
277  return m_dptr[m_domain.index(a_p) + a_n * m_numpts];
278 }
279 
280 template <class T> inline const T& BaseFab<T>::operator () (const IntVect& a_p) const
281 {
282  CH_assert(!(m_dptr == 0));
283  CH_assert(m_domain.contains(a_p));
284 
285  return m_dptr[m_domain.index(a_p)];
286 }
287 
288 template <class T> inline void BaseFab<T>::getVal(T* a_data,
289  const IntVect& a_pos,
290  int a_n,
291  int a_numcomp) const
292 {
293  const int loc = m_domain.index(a_pos);
294  const long size = m_domain.numPts();
295 
296  CH_assert(!(m_dptr == 0));
297  CH_assert(a_n >= 0 && a_n + a_numcomp <= m_nvar);
298 
299  for (int k = 0; k < a_numcomp; k++)
300  {
301  a_data[k] = m_dptr[loc+(a_n+k)*size];
302  }
303 }
304 
305 template <class T> inline void BaseFab<T>::getVal(T* a_data,
306  const IntVect& a_pos) const
307 {
308  getVal(a_data,a_pos,0,m_nvar);
309 }
310 
311 template <class T> inline const int* BaseFab<T>::loVect() const
312 {
313  return m_domain.loVect();
314 }
315 
316 template <class T> inline const int* BaseFab<T>::hiVect() const
317 {
318  return m_domain.hiVect();
319 }
320 
321 template <class T> inline const int* BaseFab<T>::nCompPtr() const
322 {
323  CH_assert(!(m_dptr == 0));
324 
325  return &m_nvar;
326 }
327 
328 template <class T> inline T* BaseFab<T>::dataPtr(int a_n)
329 {
330  CH_assert(!(m_dptr == 0));
331  CH_assert((a_n >= 0) && (a_n < m_nvar));
332 
333  return &m_dptr[a_n * m_numpts];
334 }
335 
336 template <class T> inline const T* BaseFab<T>::dataPtr(int a_n) const
337 {
338  CH_assert(!(m_dptr == 0));
339  CH_assert((a_n >= 0) && (a_n < m_nvar));
340 
341  return &m_dptr[a_n * m_numpts];
342 }
343 
344 template <class T> inline bool BaseFab<T>::contains(const BaseFab<T>& a_fab) const
345 {
346  return box().contains(a_fab.box()) && m_nvar <= a_fab.m_nvar;
347 }
348 
349 template <class T> inline bool BaseFab<T>::contains (const Box& a_bx) const
350 {
351  return box().contains(a_bx);
352 }
353 
354 template <class T> inline void BaseFab<T>::setVal(T a_x,
355  const Box& a_bx,
356  int a_nstart,
357  int a_numcomp)
358 {
359  performSetVal(a_x,a_bx,a_nstart,a_numcomp);
360 }
361 
362 template <class T> inline void BaseFab<T>::setVal(T a_x,
363  const Box& a_bx,
364  int a_n)
365 {
366  performSetVal(a_x,a_bx,a_n,1);
367 }
368 
369 template <class T> inline void BaseFab<T>::setVal(T a_x,
370  int a_n)
371 {
372  performSetVal(a_x,m_domain,a_n,1);
373 }
374 
375 template <class T> inline void BaseFab<T>::setVal(T a_x)
376 {
377  performSetVal(a_x,box(),0,m_nvar);
378 }
379 
380 template <class T>
382  const Box& a_srcbox,
383  int a_srccomp,
384  const Box& a_destbox,
385  int a_destcomp,
386  int a_numcomp)
387 {
388  CH_assert(a_srcbox.sameSize(a_destbox));
389  CH_assert(a_src.box().contains(a_srcbox));
390  CH_assert(m_domain.contains(a_destbox));
391  CH_assert(a_srccomp >= 0 && a_srccomp+a_numcomp <= a_src.nComp());
392  CH_assert(a_destcomp >= 0 && a_destcomp+a_numcomp <= m_nvar);
393 
394  performCopy(a_src,a_srcbox,a_srccomp,a_destbox,a_destcomp,a_numcomp);
395 
396  return *this;
397 }
398 
399 template <class T>
401  int a_srccomp,
402  int a_destcomp,
403  int a_numcomp)
404 {
405  CH_assert(a_srccomp >= 0 && a_srccomp + a_numcomp <= a_src.m_nvar);
406  CH_assert(a_destcomp >= 0 && a_destcomp + a_numcomp <= m_nvar);
407 
408  Box overlap(m_domain);
409  overlap &= a_src.m_domain;
410 
411  if (!overlap.isEmpty())
412  {
413  performCopy(a_src,overlap,a_srccomp,overlap,a_destcomp,a_numcomp);
414  }
415 
416  return *this;
417 }
418 
419 template <class T>
421  const Box& a_destbox)
422 {
423  CH_assert(m_nvar <= a_src.m_nvar);
424  CH_assert(m_domain.contains(a_destbox));
425 
426  Box overlap(a_destbox);
427  overlap &= a_src.m_domain;
428 
429  if (!overlap.isEmpty())
430  {
431  performCopy(a_src,overlap,0,overlap,0,m_nvar);
432  }
433 
434  return *this;
435 }
436 
437 template <class T>
439 {
440  CH_assert(m_nvar <= a_src.m_nvar);
441  CH_assert(m_domain.sameType(a_src.m_domain));
442 
443  Box overlap(m_domain);
444  overlap &= a_src.m_domain;
445 
446  if (!overlap.isEmpty())
447  {
448  performCopy(a_src,overlap,0,overlap,0,m_nvar);
449  }
450 
451  return *this;
452 }
453 
454 template <class T> inline void BaseFab<T>::copy(const Box& a_RegionFrom,
455  const Interval& a_Cdest,
456  const Box& a_RegionTo,
457  const BaseFab<T>& a_src,
458  const Interval& a_Csrc)
459 {
460  if ((this == &a_src) && (a_RegionFrom == a_RegionTo) && (a_Cdest == a_Csrc) )
461  {
462  return;
463  }
464 
465  CH_assert(a_Cdest.size() == a_Csrc.size());
466 
467  copy(a_src, a_RegionFrom, a_Csrc.begin(), a_RegionTo,
468  a_Cdest.begin(), a_Cdest.size());
469 }
470 
471 template <class T> inline BaseFab<T>& BaseFab<T>::shift(const IntVect& a_v)
472 {
473  m_domain += a_v;
474 
475  return *this;
476 }
477 
478 template <class T> inline BaseFab<T>& BaseFab<T>::shift(int a_idir,
479  int a_ncells)
480 {
481  m_domain.shift(a_idir,a_ncells);
482 
483  return *this;
484 }
485 
486 template <class T> inline BaseFab<T> & BaseFab<T>::shiftHalf(int a_idir,
487  int a_numHalfs)
488 {
489  m_domain.shiftHalf(a_idir,a_numHalfs);
490 
491  return *this;
492 }
493 
494 template <class T> inline BaseFab<T> & BaseFab<T>::shiftHalf(const IntVect& a_v)
495 {
496  m_domain.shiftHalf(a_v);
497 
498  return *this;
499 }
500 
501 template <class T> inline size_t BaseFab<T>::size(const Box& a_box,
502  const Interval& a_comps) const
503 {
504  return a_box.numPts() * (sizeof(T) * a_comps.size());
505 }
506 
507 template <class T> inline void BaseFab<T>::linearOut(void* a_buf,
508  const Box& a_R,
509  const Interval& a_comps) const
510 {
511  linearOut2(a_buf, a_R, a_comps);
512 }
513 template <class T> inline void* BaseFab<T>::linearOut2(void* a_buf,
514  const Box& a_R,
515  const Interval& a_comps) const
516 {
517  T* buffer = (T*)a_buf;
518 
519  ForAllThisCBNN(T,a_R,a_comps.begin(),a_comps.size())
520  {
521  *buffer = thisR;
522  ++buffer;
523  } EndFor;
524  return (void*)buffer;
525 }
526 
527 template <class T> inline void BaseFab<T>::linearIn(void* a_buf,
528  const Box& a_R,
529  const Interval& a_comps)
530 {
531  // pout() << "basefab::linearin box = " << a_R << "comps = (" << a_comps.begin() << "," << a_comps.end() << ")" << endl;
532  linearIn2(a_buf, a_R, a_comps);
533 }
534 
535 template <class T> inline void* BaseFab<T>::linearIn2(void* a_buf,
536  const Box& a_R,
537  const Interval& a_comps)
538 {
539  T* buffer = (T*)a_buf;
540 
541  ForAllThisBNN(T,a_R,a_comps.begin(),a_comps.size())
542  {
543  thisR = *buffer;
544  ++buffer;
545  } EndFor;
546 
547  return (void*) buffer;
548 }
549 
550 // ---------------------------------------------------------
551 // this is for broadcast & gather; the Box is in the msg
552 template <class T> inline void BaseFab<T>::linearOut(void* a_outBuf) const
553 {
554  char * bufptr = static_cast<char*>(a_outBuf) ;
555 
556  CH_XD::linearOut( bufptr ,m_domain );
557  bufptr += CH_XD::linearSize(m_domain);
558 
559  CH_XD::linearOut( bufptr ,m_nvar );
560  bufptr += sizeof(int) ;
561 
562  linearOut( bufptr ,m_domain ,interval() );
563 }
564 
565 // ---------------------------------------------------------
566 // this is for broadcast & gather; the Box is in the msg
567 template <class T> inline void BaseFab<T>::linearIn(const void* const a_buf)
568 {
569  // first get the box, then the number of components, then the data
570  char * bufptr = static_cast<char*>(const_cast<void*>(a_buf)) ;
571 
572  CH_XD::linearIn( m_domain ,bufptr );
573  bufptr += CH_XD::linearSize( m_domain );
574 
575  int ncomps;
576  CH_XD::linearIn( ncomps ,bufptr );
577  bufptr += sizeof( ncomps );
578 
579  resize(m_domain, ncomps);
580 
581  // Tried calling:
582  // linearIn( bufptr, m_domain, Interval( 0,ncomps-1 ) );
583  // but it crashed with OPT setting.
584  // So we use BoxIterator instead.
585  T* buffer = (T*)bufptr;
586  for (int icomp = 0; icomp < ncomps; icomp++)
587  {
588  for (BoxIterator bit(m_domain); bit.ok(); ++bit)
589  {
590  IntVect iv = bit();
591  (*this)(iv, icomp) = *buffer;
592  ++buffer;
593  }
594  }
595 
596  // ForAllThisBNN(T,m_domain,0,ncomps)
597  // {
598  // thisR = *buffer;
599  // ++buffer;
600  // } EndFor;
601  // return (void*) buffer;
602 }
603 
604 // ---------------------------------------------------------
605 // this is for broadcast & gather; the Box is in the msg
606 template <class T> inline int BaseFab<T>::linearSize( ) const
607 { // the linearization contains the Box, #components, and data
608  return CH_XD::linearSize(m_domain) + sizeof(int) + size(m_domain, interval());
609 }
610 
611 template <class T> inline void BaseFab<T>::define()
612 {
613  CH_assert(m_nvar > 0);
614  CH_assert(m_dptr == 0);
615  // CH_assert(m_numpts > 0); // OK if box is empty
616  CH_assert(!m_aliased);
617  //CH_assert(!(The_FAB_Arena == 0));// not a sufficient test !!!
618 
619 #ifdef CH_USE_MEMORY_TRACKING
620  if (s_Arena == NULL)
621  {
622  s_Arena = new BArena(name().c_str());
623  }
624 #else
625  if (s_Arena == NULL)
626  {
627  s_Arena = new BArena("");
628  }
629 #endif
630 
631  if (s_Arena == NULL)
632  {
633  MayDay::Error("malloc in basefab failed");
634  }
635 
636  m_truesize = m_nvar * m_numpts;
637  if (m_truesize > 0)
638  {
639  m_dptr = static_cast<T*>(s_Arena->alloc(m_truesize * sizeof(T)));
640 
641 #ifdef CH_USE_MEMORY_TRACKING
642  ch_memcount+=m_truesize * sizeof(T) + sizeof(BaseFab<T>);
643  s_Arena->bytes += m_truesize * sizeof(T) + sizeof(BaseFab<T>);
644  CH_assert(s_Arena->bytes > 0);
645  if (s_Arena->bytes > s_Arena->peak)
646  {
647  s_Arena->peak = s_Arena->bytes;
648  }
649 #endif
650  }
651  else
652  { // m_truesize == 0: allocating no space
653  m_dptr = NULL;
654  }
655 
656  //
657  // Now call T::T() on the raw memo'ry so we have valid Ts.
658  //
659  T* ptr = m_dptr;
660 
661  for (long int i = 0; i < m_truesize; i++, ptr++)
662  {
663  new (ptr) T;
664  }
665 }
666 
667 template <class T> inline void BaseFab<T>::undefine()
668 {
669  //CH_assert(!(The_FAB_Arena == 0));
670  //
671  // Call T::~T() on the to-be-destroyed memory.
672  //
673  if (m_aliased)
674  {
675  m_dptr = 0;
676  return;
677  }
678 
679  if (m_dptr == 0)
680  {
681  return;
682  }
683 
684  T* ptr = m_dptr;
685 
686  for (long int i = 0; i < m_truesize; i++, ptr++)
687  {
688  ptr->~T();
689  }
690 
691  s_Arena->free(m_dptr);
692 
693 #ifdef CH_USE_MEMORY_TRACKING
694  ch_memcount -= m_truesize * sizeof(T) + sizeof(BaseFab<T>);
695  s_Arena->bytes -= m_truesize * sizeof(T) + sizeof(BaseFab<T>);
696  CH_assert(s_Arena->bytes >= 0);
697 #endif
698 
699  m_dptr = 0;
700 }
701 
702 template <class T> inline std::string BaseFab<T>::name()
703 {
704  std::string rtn = (typeid(T)).name();
705 
706  return rtn;
707 }
708 
709 template <class T>
710 inline void BaseFab<T>::performCopy(const BaseFab<T>& a_src,
711  const Box& a_srcbox,
712  int a_srccomp,
713  const Box& a_destbox,
714  int a_destcomp,
715  int a_numcomp)
716 {
717  CH_assert(a_src.box().contains(a_srcbox));
718  CH_assert(box().contains(a_destbox));
719  CH_assert(a_destbox.sameSize(a_srcbox));
720  CH_assert(a_srccomp >= 0 && a_srccomp + a_numcomp <= a_src.nComp());
721  CH_assert(a_destcomp >= 0 && a_destcomp + a_numcomp <= nComp());
722  // CH_TIME("BaseFab::performCopy")
723  ForAllThisBNNXCBN(T, a_destbox, a_destcomp, a_numcomp, a_src, a_srcbox, a_srccomp)
724  {
725  thisR = a_srcR;
726  } EndForTX
727 }
728 
729 template <class T> inline void BaseFab<T>::performSetVal(T a_x,
730  const Box& a_bx,
731  int a_nstart,
732  int a_numcomp)
733 {
734  CH_assert(m_domain.contains(a_bx));
735  CH_assert(a_nstart >= 0 && a_nstart + a_numcomp <= m_nvar);
736 
737  if (a_bx == m_domain)
738  {
739  T* data = &m_dptr[a_nstart * m_numpts];
740 
741  for (long i = 0, N = a_numcomp * m_numpts; i < N; i++)
742  {
743  *data++ = a_x;
744  }
745  }
746  else
747  {
748  ForAllThisBNN(T,a_bx,a_nstart,a_numcomp)
749  {
750  thisR = a_x;
751  } EndFor
752  }
753 }
754 
755 template <class T>
757 {
758  return m_aliased;
759 }
760 
761 template <class T> void
763  const SliceSpec& a_sliceSpec ) const
764 {
765  bool outofbounds;
766  Box degenerateBox;
767  this->box().degenerate( degenerateBox, a_sliceSpec, &outofbounds );
768  if ( outofbounds )
769  {
770  MayDay::Error( "Tried to slice out-of-bounds." );
771  }
772  a_slice.define( degenerateBox, this->nComp() );
773  a_slice.copy( *this, degenerateBox );
774 }
775 
776 #include "NamespaceFooter.H"
777 
778 #endif
int linearSize(void) const
Definition: BaseFabImplem.H:606
std::ostream & pout()
Use this in place of std::cout for program output.
bool ok()
Definition: BoxIterator.H:281
void clear()
Definition: BaseFabImplem.H:210
const int * loVect() const
{ Fortran interface functions}
Definition: BaseFabImplem.H:311
#define CH_assert(cond)
Definition: CHArray.H:37
void setVal(T a_x, const Box &a_bx, int a_nstart, int a_numcomp)
{ data modification functions}
Definition: BaseFabImplem.H:354
bool contains(const BaseFab< T > &a_fab) const
{ comparison functions}
Definition: BaseFabImplem.H:344
virtual ~BaseFab()
Definition: BaseFabImplem.H:153
BaseFab< T > & shift(const IntVect &a_v)
{ domain modification functions}
Definition: BaseFabImplem.H:471
virtual void linearIn(void *a_buf, const Box &a_R, const Interval &a_comps)
Definition: BaseFabImplem.H:527
Definition: SliceSpec.H:41
static std::string name()
Definition: BaseFabImplem.H:702
Box m_domain
Definition: BaseFab.H:576
iterates through the IntVects of a Box
Definition: BoxIterator.H:37
int m_nvar
Definition: BaseFab.H:577
int size() const
Definition: Interval.H:75
virtual void linearOut(void *a_buf, const Box &a_R, const Interval &a_comps) const
Definition: BaseFabImplem.H:507
A Concrete Class for Dynamic Memory Management.
Definition: Arena.H:124
BaseFab< T > & operator=(BaseFab< T > &&) noexcept
move assignment
Definition: BaseFabImplem.H:97
const int SpaceDim
Definition: SPACE.H:38
BaseFab()
Definition: BaseFabImplem.H:108
const IntVect & smallEnd() const
Definition: BaseFabImplem.H:236
int nComp() const
{ accessors}
Definition: BaseFabImplem.H:219
Definition: EBInterface.H:45
BaseFab< T > & shiftHalf(int a_dir, int a_numHalfs)
Definition: BaseFabImplem.H:486
bool isAliased() const
Definition: BaseFabImplem.H:756
Structure for passing component ranges in code.
Definition: Interval.H:23
static const IntVect Unit
Definition: IntVect.H:659
const char * name(const FArrayBox &a_dummySpecializationArg)
Definition: CH_HDF5.H:864
void linearOut(void *const a_outBuf, const T &inputT)
Definition: SPMDI.H:33
virtual void define(const Box &a_box, int a_comps, T *a_alias=NULL)
Definition: BaseFab.H:168
A Virtual Base Class for Dynamic Memory Managemen.
Definition: Arena.H:40
double Real
Definition: REAL.H:33
void define()
Definition: BaseFabImplem.H:611
virtual void performCopy(const BaseFab< T > &a_src, const Box &a_srcbox, int a_srccomp, const Box &a_destbox, int a_destcomp, int a_numcomp)
Definition: BaseFabImplem.H:710
BaseFab< T > & copy(const BaseFab< T > &a_src, const Box &a_srcbox, int a_srccomp, const Box &a_destbox, int a_destcomp, int a_numcomp)
Definition: BaseFabImplem.H:381
int linearSize(const T &inputT)
Definition: SPMDI.H:21
static void Error(const char *const a_msg=m_nullString, int m_exitCode=CH_DEFAULT_ERROR_CODE)
Print out message to cerr and exit with the specified exit code.
int begin() const
Definition: Interval.H:97
bool isEmpty() const
{ Comparison Functions}
Definition: Box.H:1846
const int * hiVect() const
Definition: BaseFabImplem.H:316
Definition: BaseFab.H:76
T * dataPtr(int a_n=0)
Definition: BaseFabImplem.H:328
static const IntVect Zero
Definition: IntVect.H:654
virtual void * linearOut2(void *a_buf, const Box &a_R, const Interval &a_comps) const
Same as linearOut, but returns the current location in the buffer.
Definition: BaseFabImplem.H:513
T *__restrict m_dptr
Definition: BaseFab.H:581
static void Warning(const char *const a_msg=m_nullString)
Print out message to cerr and continue.
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
bool m_aliased
Definition: BaseFab.H:582
size_t numPts() const
bool sameSize(const Box &b) const
Definition: Box.H:1896
bool contains(const IntVect &p) const
Definition: Box.H:1871
const int * nCompPtr() const
Definition: BaseFabImplem.H:321
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
void getVal(T *a_data, const IntVect &a_pos, int a_N, int a_numcomp) const
Definition: BaseFabImplem.H:288
T & operator()(const IntVect &a_p, int a_N)
Definition: BaseFabImplem.H:246
void const char const int const int * N
Definition: Lapack.H:83
void resize(const Box &a_b, int a_n=1, T *a_alias=NULL)
Definition: BaseFabImplem.H:158
void undefine()
Definition: BaseFabImplem.H:667
static int testBoxAndComp()
regression test
Definition: BaseFabImplem.H:39
void performSetVal(T a_x, const Box &a_bx, int a_nstart, int a_numcomp)
Definition: BaseFabImplem.H:729
static int test()
regression test
Definition: BaseFabImplem.H:77
void linearIn(T &a_outputT, const void *const inBuf)
Definition: SPMDI.H:27
virtual void * linearIn2(void *a_buf, const Box &a_R, const Interval &a_comps)
same as linearIn, but returns the current location in the buffer
Definition: BaseFabImplem.H:535
IntVect size() const
Definition: BaseFabImplem.H:231
void degenerate(BaseFab< T > &a_slice, const SliceSpec &a_sliceSpec) const
Definition: BaseFabImplem.H:762
long m_numpts
Definition: BaseFab.H:578
const IntVect & bigEnd() const
Definition: BaseFabImplem.H:241
const Box & box() const
Definition: BaseFabImplem.H:226