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 using CH_XD::IntVect;
30 using CH_XD::Box;
31 using CH_XD::BaseFab;
32 ///these functions are meant to interface with the Proto language.
33 namespace ProtoCh
34 {
35 
36 
37 ///get point from intvect
38  extern Point getPoint( const IntVect& a_iv);
39 
40 /// gets proto box from chombo box
41  extern Proto::Box getProtoBox( const Box& a_box);
42 
43 ///get intvect from point
44  extern IntVect getIntVect(const Point & a_pt);
45 
46 ///get chombo box from proto box
47  extern Box getBox(const Proto::Box & a_bx);
48 
49 ///
50  template <typename T, int ncomp>
51  void aliasBoxData(BoxData<T, ncomp> & a_boxdata, const BaseFab<T>& a_bfr, const int a_startcomp = 0)
52  {
53  CH_assert( a_bfr.nComp() == (ncomp + a_startcomp));
54  Proto::Box region = getProtoBox(a_bfr.box());
55  a_boxdata.define(a_bfr.dataPtr(a_startcomp), region, ncomp);
56  }
57 
58 
59 }
60 
61 #endif
62 
63 #endif
#define CH_assert(cond)
Definition: CHArray.H:37
int nComp() const
{ accessors}
Definition: BaseFabImplem.H:234
Definition: BaseFab.H:80
T * dataPtr(int a_n=0)
Definition: BaseFabImplem.H:343
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:241