SpatialOps
field_type_inference.cpp
Go to the documentation of this file.
1 
68 #include <spatialops/structured/FVStaggered.h> // field type definitions, etc.
69 #include <spatialops/SpatialOpsTools.h> // for is_same_type
70 
71 #include <cassert>
72 
73 using namespace SpatialOps;
74 
75 int main()
76 {
77  //
78  // Field types associated with the non-staggered, cell-centered ("scalar") mesh
79  //
80  typedef FaceTypes<SVolField>::XFace XFaceT; // same as SSurfXField
81  typedef FaceTypes<SVolField>::YFace YFaceT; // same as SSurfYField
82  typedef FaceTypes<SVolField>::ZFace ZFaceT; // same as SSurfZField
83 
84  assert(( is_same_type< XFaceT, SSurfXField >() ));
85  assert(( is_same_type< YFaceT, SSurfYField >() ));
86  assert(( is_same_type< ZFaceT, SSurfZField >() ));
87 
88  //
89  // Field types associated with the x-staggered mesh
90  //
91  typedef FaceTypes<XVolField>::XFace XMeshXFaceT; // same as XSurfXField
92  typedef FaceTypes<XVolField>::YFace XMeshYFaceT; // same as XSurfYField
93  typedef FaceTypes<XVolField>::ZFace XMeshZFaceT; // same as XSurfZField
94 
95  assert(( is_same_type< XMeshXFaceT, XSurfXField >() ));
96  assert(( is_same_type< XMeshYFaceT, XSurfYField >() ));
97  assert(( is_same_type< XMeshZFaceT, XSurfZField >() ));
98 
99  //
100  // Field types associated with the y-staggered mesh
101  //
102  typedef FaceTypes<YVolField>::XFace YMeshXFaceT; // same as YSurfXField
103  typedef FaceTypes<YVolField>::YFace YMeshYFaceT; // same as YSurfYField
104  typedef FaceTypes<YVolField>::ZFace YMeshZFaceT; // same as YSurfZField
105 
106  assert(( is_same_type< YMeshXFaceT, YSurfXField >() ));
107  assert(( is_same_type< YMeshYFaceT, YSurfYField >() ));
108  assert(( is_same_type< YMeshZFaceT, YSurfZField >() ));
109 
110  //
111  // Field types associated with the z-staggered mesh
112  //
113  typedef FaceTypes<ZVolField>::XFace ZMeshXFaceT; // same as ZSurfXField
114  typedef FaceTypes<ZVolField>::YFace ZMeshYFaceT; // same as ZSurfYField
115  typedef FaceTypes<ZVolField>::ZFace ZMeshZFaceT; // same as ZSurfZField
116 
117  assert(( is_same_type< ZMeshXFaceT, ZSurfXField >() ));
118  assert(( is_same_type< ZMeshYFaceT, ZSurfYField >() ));
119  assert(( is_same_type< ZMeshZFaceT, ZSurfZField >() ));
120 
121  return 0;
122 }
Define Face field types in terms of a cell field type.