Chombo + EB + MF  3.2
ProtoInterface.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 #ifndef _PROTOINTERFACE_H_
12 #define _PROTOINTERFACE_H_
13 
14 #ifdef USE_PROTO
15 #include "Proto.H"
16 #endif
17 #include "IntVect.H"
18 #include "Box.H"
19 #include "BaseFab.H"
20 
21 
22 
23 #ifdef USE_PROTO
24 
25 
26 using Proto::Point;
27 using Proto::BoxData;
28 using Proto::Var;
29 ///these functions are meant to interface with the Proto language.
30 namespace ProtoCh
31 {
32 
33 
34 ///get point from intvect
35  extern Point getPoint( const IntVect& a_iv);
36 
37 /// gets proto box from chombo box
38  extern Proto::Box getProtoBox( const Box& a_box);
39 
40 ///get intvect from point
41  extern IntVect getIntVect(const Point & a_pt);
42 
43 ///get chombo box from proto box
44  extern Box getBox(const Proto::Box & a_bx);
45 
46 ///
47  template <typename T, int ncomp>
48  void aliasBoxData(BoxData<T, ncomp> & a_boxdata, const BaseFab<T>& a_bfr, const int a_startcomp = 0)
49  {
50  CH_assert( a_bfr.nComp() == (ncomp + a_startcomp));
51  Proto::Box region = a_bfr.box();
52  a_boxdata.define(a_bfr.dataPtr(a_startcomp), region, ncomp);
53  }
54 
55 
56 }
57 
58 #endif
59 
60 #endif
#define CH_assert(cond)
Definition: CHArray.H:37
void define(const IntVect &small, const IntVect &big)
int nComp() const
{ accessors}
Definition: BaseFabImplem.H:264
Definition: BaseFab.H:81
T * dataPtr(int a_n=0)
Definition: BaseFabImplem.H:373
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:469
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
const Box & box() const
Definition: BaseFabImplem.H:271