SpatialOps
OneSidedOperatorTypes.h
1 /*
2  * Copyright (c) 2014 The University of Utah
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to
6  * deal in the Software without restriction, including without limitation the
7  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8  * sell copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20  * IN THE SOFTWARE.
21  */
22 
23 #ifndef SpatialOps_structured_OneSidedOpTypes_h
24 #define SpatialOps_structured_OneSidedOpTypes_h
25 
27 #include <spatialops/Nebo.h>
28 
29 namespace SpatialOps{
30 
65  template<typename OpDir, typename Offset=IndexTriplet<0,0,0> >
67  typedef OpDir DirT;
68  typedef typename Add<Offset,OpDir>::result Point2;
69  typedef NEBO_FIRST_POINT(Offset)::NEBO_ADD_POINT(Point2) StPtCollection;
70  };
71 
81  template<typename OpDir, typename Offset=IndexTriplet<0,0,0> >
83  typedef OpDir DirT;
84  typedef typename Add<OpDir,Offset>::result Point2;
85  typedef typename Add<OpDir,Point2>::result Point3;
86  typedef NEBO_FIRST_POINT(Offset)::NEBO_ADD_POINT(Point2)::NEBO_ADD_POINT(Point3) StPtCollection;
87  };
88 
114  template<typename Op, typename StencilT, typename FieldT, typename Offset=IndexTriplet<0,0,0> >
116 
117 #define BUILD_ONE_SIDED_OP_ACROSS_DIRS( Op, I1, I2, I3, StencilT, FieldT ) \
118  template<> struct OneSidedOpTypeBuilder<Op,StencilT<IndexTriplet<I1,I2,I3> >,FieldT>{ \
119  typedef NeboStencilBuilder<Op,StencilT<IndexTriplet<I1,I2,I3> >::StPtCollection, FieldT, FieldT> type; \
120  };
121 
122 #define ONE_SIDED_OP_BUILDERS( Op, I1, I2, I3, FieldT ) \
123  BUILD_ONE_SIDED_OP_ACROSS_DIRS( Op, I1, I2, I3, OneSidedStencil2, FieldT ) \
124  BUILD_ONE_SIDED_OP_ACROSS_DIRS( Op, I1, I2, I3, OneSidedStencil3, FieldT )
125 
126 #define BUILD_ONE_SIDED_STENCILS( FieldT ) \
127  ONE_SIDED_OP_BUILDERS( Gradient, 1, 0, 0, FieldT ) \
128  ONE_SIDED_OP_BUILDERS( Gradient, -1, 0, 0, FieldT ) \
129  ONE_SIDED_OP_BUILDERS( Gradient, 0, 1, 0, FieldT ) \
130  ONE_SIDED_OP_BUILDERS( Gradient, 0,-1, 0, FieldT ) \
131  ONE_SIDED_OP_BUILDERS( Gradient, 0, 0, 1, FieldT ) \
132  ONE_SIDED_OP_BUILDERS( Gradient, 0, 0,-1, FieldT )
133 
134 BUILD_ONE_SIDED_STENCILS( SVolField )
135 //BUILD_ONE_SIDED_STENCILS( SSurfXField )
136 //BUILD_ONE_SIDED_STENCILS( SSurfYField )
137 //BUILD_ONE_SIDED_STENCILS( SSurfZField )
138 //
139 BUILD_ONE_SIDED_STENCILS( XVolField )
140 //BUILD_ONE_SIDED_STENCILS( XSurfXField )
141 //BUILD_ONE_SIDED_STENCILS( XSurfYField )
142 //BUILD_ONE_SIDED_STENCILS( XSurfZField )
143 //
144 BUILD_ONE_SIDED_STENCILS( YVolField )
145 //BUILD_ONE_SIDED_STENCILS( YSurfXField )
146 //BUILD_ONE_SIDED_STENCILS( YSurfYField )
147 //BUILD_ONE_SIDED_STENCILS( YSurfZField )
148 //
149 BUILD_ONE_SIDED_STENCILS( ZVolField )
150 //BUILD_ONE_SIDED_STENCILS( ZSurfXField )
151 //BUILD_ONE_SIDED_STENCILS( ZSurfYField )
152 //BUILD_ONE_SIDED_STENCILS( ZSurfZField )
153 
154 } // namespace SpatialOps
155 
156 #endif // SpatialOps_structured_OneSidedOpTypes_h
Support for one-sided stencils.
Used for specifying field type traits.
Definition: IndexTriplet.h:121
OpDir DirT
The orientation of the stencil (IndexTriplet)
OpDir DirT
The orientation of the stencil (IndexTriplet)
Builds OneSidedDiv operator type from field type.
Support for one-sided stencils.
Abstracts a field.
Definition: SpatialField.h:132