OPAL (Object Oriented Parallel Accelerator Library)  2024.1
OPAL
UniformCartesian.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /***************************************************************************
3  *
4  * The IPPL Framework
5  *
6  *
7  * Visit http://people.web.psi.ch/adelmann/ for more details
8  *
9  ***************************************************************************/
10 
11 #ifndef UNIFORM_CARTESIAN_H
12 #define UNIFORM_CARTESIAN_H
13 
14 // UniformCartesian.h
15 // UniformCartesian class - represents uniform-spacing cartesian meshes.
16 
17 // include files
18 #include "Meshes/Mesh.h"
19 #include "Meshes/Centering.h"
21 #include "AppTypes/Vektor.h"
22 
23 // forward declarations
24 template<class T, unsigned D> class BareField;
25 template<class T, unsigned D, class M, class C> class Field;
26 template <unsigned Dim, class MFLOAT> class UniformCartesian;
27 template <unsigned Dim, class MFLOAT>
28 std::ostream& operator<<(std::ostream&, const UniformCartesian<Dim,MFLOAT>&);
29 template <unsigned Dim, class MFLOAT>
30 Inform& operator<<(Inform&, const UniformCartesian<Dim,MFLOAT>&);
31 
32 template <unsigned Dim, class MFLOAT=double>
33 class UniformCartesian : public Mesh<Dim>
34 {
35 public:
36  //# public typedefs
38  typedef MFLOAT MeshValue_t;
40 
41  // Default constructor (use initialize() to make valid)
43  {
44  hasSpacingFields = false;
45  };
46  // Destructor
48  {
49  if (hasSpacingFields) {
50  delete VertSpacings;
51  delete CellSpacings;
52  delete FlVert;
53  delete FlCell;
54  }
55  };
56 
57  // Non-default constructors
58  UniformCartesian(const NDIndex<Dim>& ndi);
59  UniformCartesian(const Index& I);
60  UniformCartesian(const Index& I, const Index& J);
61  UniformCartesian(const Index& I, const Index& J, const Index& K);
62  // These also take a MFLOAT* specifying the mesh spacings:
63  UniformCartesian(const NDIndex<Dim>& ndi, MFLOAT* const delX);
64  UniformCartesian(const Index& I, MFLOAT* const delX);
65  UniformCartesian(const Index& I, const Index& J, MFLOAT* const delX);
66  UniformCartesian(const Index& I, const Index& J, const Index& K,
67  MFLOAT* const delX);
68  // These further take a Vektor<MFLOAT,Dim>& specifying the origin:
69  UniformCartesian(const NDIndex<Dim>& ndi, MFLOAT* const delX,
70  const Vektor<MFLOAT,Dim>& orig);
71  UniformCartesian(const Index& I, MFLOAT* const delX,
72  const Vektor<MFLOAT,Dim>& orig);
73  UniformCartesian(const Index& I, const Index& J, MFLOAT* const delX,
74  const Vektor<MFLOAT,Dim>& orig);
75  UniformCartesian(const Index& I, const Index& J, const Index& K,
76  MFLOAT* const delX, const Vektor<MFLOAT,Dim>& orig);
77 
78  // initialize functions
79  void initialize(const NDIndex<Dim>& ndi);
80  void initialize(const Index& I);
81  void initialize(const Index& I, const Index& J);
82  void initialize(const Index& I, const Index& J, const Index& K);
83  // These also take a MFLOAT* specifying the mesh spacings:
84  void initialize(const NDIndex<Dim>& ndi, MFLOAT* const delX);
85  void initialize(const Index& I, MFLOAT* const delX);
86  void initialize(const Index& I, const Index& J, MFLOAT* const delX);
87  void initialize(const Index& I, const Index& J, const Index& K,
88  MFLOAT* const delX);
89  // These further take a Vektor<MFLOAT,Dim>& specifying the origin:
90  void initialize(const NDIndex<Dim>& ndi, MFLOAT* const delX,
91  const Vektor<MFLOAT,Dim>& orig);
92  void initialize(const Index& I, MFLOAT* const delX,
93  const Vektor<MFLOAT,Dim>& orig);
94  void initialize(const Index& I, const Index& J, MFLOAT* const delX,
95  const Vektor<MFLOAT,Dim>& orig);
96  void initialize(const Index& I, const Index& J, const Index& K,
97  MFLOAT* const delX, const Vektor<MFLOAT,Dim>& orig);
98 
99 
100 private:
101 
102  // Private member data:
103  MFLOAT meshSpacing[Dim]; // delta-x, delta-y (>1D), delta-z (>2D)
104  MFLOAT volume; // Cell length(1D), area(2D), or volume (>2D)
105  Vektor<MFLOAT,Dim> origin; // Origin of mesh coordinates (vertices)
106  FieldLayout<Dim>* FlCell; // Layouts for BareField* CellSpacings
107  FieldLayout<Dim>* FlVert; // Layouts for BareField* VertSpacings
108 
109  // Private member functions:
110  void setup(); // Private function doing tasks common to all constructors.
111  // Set only the derivative constants, using pre-set spacings:
112  void set_Dvc();
113 
114 
115 public:
116 
117  // Public member data:
118  unsigned gridSizes[Dim]; // Sizes (number of vertices)
119  Vektor<MFLOAT,Dim> Dvc[1<<Dim]; // Constants for derivatives.
120  bool hasSpacingFields; // Flags allocation of the following:
123 
124  // Public member functions:
125 
126  // Create BareField's of vertex and cell spacings; allow for specifying
127  // layouts via the FieldLayout e_dim_tag and vnodes parameters (these
128  // get passed in to construct the FieldLayout used to construct the
129  // BareField's).
130  void storeSpacingFields(); // Default; will have default layout
131  // Special cases for 1-3 dimensions, ala FieldLayout ctors:
132  void storeSpacingFields(e_dim_tag p1, int vnodes=-1);
133  void storeSpacingFields(e_dim_tag p1, e_dim_tag p2, int vnodes=-1);
135  int vnodes=-1);
136  // Next we have one for arbitrary dimension, ala FieldLayout ctor:
137  // All the others call this one internally:
138  void storeSpacingFields(e_dim_tag *p, int vnodes=-1);
139 
140  // These specify both the total number of vnodes and the numbers of vnodes
141  // along each dimension for the partitioning of the index space. Obviously
142  // this restricts the number of vnodes to be a product of the numbers along
143  // each dimension (the constructor implementation checks this): Special
144  // cases for 1-3 dimensions, ala FieldLayout ctors (see FieldLayout.h for
145  // more relevant comments, including definition of recurse):
147  unsigned vnodes1,
148  bool recurse=false,
149  int vnodes=-1);
151  unsigned vnodes1, unsigned vnodes2,
152  bool recurse=false,int vnodes=-1);
154  unsigned vnodes1, unsigned vnodes2, unsigned vnodes3,
155  bool recurse=false, int vnodes=-1);
156  // Next we have one for arbitrary dimension, ala FieldLayout ctor:
157  // All the others call this one internally:
159  unsigned* vnodesPerDirection,
160  bool recurse=false, int vnodes=-1);
161 
162  // Accessor functions for member data:
163  // Get the origin of mesh vertex positions:
165  // Get the spacings of mesh vertex positions along specified direction:
166  MFLOAT get_meshSpacing(unsigned d) const;
167  // Get the cell volume:
168  MFLOAT get_volume() const;
169 
170  // Set functions for member data:
171  // Set the origin of mesh vertex positions:
172  void set_origin(const Vektor<MFLOAT,Dim>& o);
173  // Set the spacings of mesh vertex positions (recompute Dvc, cell volume):
174  void set_meshSpacing(MFLOAT* const del);
175 
176  // Formatted output of UniformCartesian object:
177  void print(std::ostream&);
178 
179  void print(Inform &);
180 
181  //----Other UniformCartesian methods:----------------------------------------
182  // Volume of single cell indexed by input NDIndex;
183  MFLOAT getCellVolume(const NDIndex<Dim>&) const;
184  // Field of volumes of all cells:
187  // Volume of range of cells bounded by verticies specified by input NDIndex:
188  MFLOAT getVertRangeVolume(const NDIndex<Dim>&) const;
189  // Volume of range of cells spanned by input NDIndex (index of cells):
190  MFLOAT getCellRangeVolume(const NDIndex<Dim>&) const;
191  // Nearest vertex index to (x,y,z):
193  // Nearest vertex index with all vertex coordinates below (x,y,z):
195  // NDIndex for cell in cell-ctrd Field containing the point (x,y,z):
196  inline
198  {
199  return getVertexBelow(x); // I think these functions are identical. -tjw
200  }
201  // (x,y,z) coordinates of indexed vertex:
203  // Field of (x,y,z) coordinates of all vertices:
207  // (x,y,z) coordinates of indexed cell:
209  // Field of (x,y,z) coordinates of all cells:
213  // Vertex-vertex grid spacing of indexed cell:
215  // Field of vertex-vertex grid spacings of all cells:
219  // Cell-cell grid spacing of indexed vertex:
221  // Field of cell-cell grid spacings of all vertices:
225  // Array of surface normals to cells adjoining indexed cell:
227  // Array of (pointers to) Fields of surface normals to all cells:
230  // Similar functions, but specify the surface normal to a single face, using
231  // the following numbering convention: 0 means low face of 1st dim, 1 means
232  // high face of 1st dim, 2 means low face of 2nd dim, 3 means high face of
233  // 2nd dim, and so on:
234  Vektor<MFLOAT,Dim> getSurfaceNormal(const NDIndex<Dim>&, unsigned) const;
237  UniformCartesian<Dim,MFLOAT>,Cell>&, unsigned) const;
238 
239 };
240 
241 // I/O
242 
243 // Stream formatted output of UniformCartesian object:
244 template< unsigned Dim, class MFLOAT >
245 inline
246 std::ostream& operator<<(std::ostream& out, const UniformCartesian<Dim,MFLOAT>& mesh)
247 {
249  const_cast<UniformCartesian<Dim,MFLOAT>&>(mesh);
250  ncmesh.print(out);
251  return out;
252 }
253 
254 template< unsigned Dim, class MFLOAT >
255 inline
256 Inform& operator<<(Inform& out, const UniformCartesian<Dim,MFLOAT>& mesh)
257 {
259  const_cast<UniformCartesian<Dim,MFLOAT>&>(mesh);
260  ncmesh.print(out);
261  return out;
262 }
263 
264 //*****************************************************************************
265 // Stuff taken from old Cartesian.h, which now applies to UniformCartesian:
266 //*****************************************************************************
267 
268 #ifndef CARTESIAN_STENCIL_SETUP_H
270 #endif
271 
272 //----------------------------------------------------------------------
273 //
274 //
275 // Definitions of stencils.
276 //
277 // For each one we have first we have the user level function that takes
278 // a Field argument and returns an expression template.
279 // This is the thing the user code sees.
280 // These could use some asserts to make sure the Fields have
281 // enough guard cells.
282 //
283 // Then we have the 'apply' function that gets used in the inner loop
284 // when evaluating the expression. This would be better done as a
285 // member function of the tags above, but that would require member
286 // function templates, which we are holding off on for now.
287 //
288 //----------------------------------------------------------------------
289 
290 //----------------------------------------------------------------------
291 //
292 // Divergence Vert->Cell
293 //
294 // First is the user function for any dimension and element types.
295 // it returns a unary element type.
296 //
297 //----------------------------------------------------------------------
298 
300 //
301 // Here are the old style definitions.
302 //
304 
305 //----------------------------------------------------------------------
306 // Divergence Vektor/Vert -> Scalar/Cell
307 //----------------------------------------------------------------------
308 template < class T, class MFLOAT >
312 //----------------------------------------------------------------------
313 template < class T, class MFLOAT >
317 //----------------------------------------------------------------------
318 template < class T, class MFLOAT >
322 //----------------------------------------------------------------------
323 // Divergence Vektor/Cell -> Scalar/Vert
324 //----------------------------------------------------------------------
325 template < class T, class MFLOAT >
329 //----------------------------------------------------------------------
330 template < class T, class MFLOAT >
334 //----------------------------------------------------------------------
335 template < class T, class MFLOAT >
339 //----------------------------------------------------------------------
340 // Divergence Vektor/Vert -> Scalar/Vert
341 //----------------------------------------------------------------------
342 template < class T, class MFLOAT >
346 //----------------------------------------------------------------------
347 template < class T, class MFLOAT >
351 //----------------------------------------------------------------------
352 template < class T, class MFLOAT >
356 //----------------------------------------------------------------------
357 // Divergence Vektor/Edge -> Scalar/Vert
358 //----------------------------------------------------------------------
359 template < class T, class MFLOAT >
363 //----------------------------------------------------------------------
364 template < class T, class MFLOAT >
368 //----------------------------------------------------------------------
369 template < class T, class MFLOAT >
373 //----------------------------------------------------------------------
374 // Divergence Vektor/Cell -> Scalar/Cell
375 //----------------------------------------------------------------------
376 template < class T, class MFLOAT >
380 //----------------------------------------------------------------------
381 template < class T, class MFLOAT >
385 //----------------------------------------------------------------------
386 template < class T, class MFLOAT >
390 //----------------------------------------------------------------------
391 // Divergence Tenzor/Vert -> Vektor/Cell
392 //----------------------------------------------------------------------
393 template < class T, class MFLOAT >
395 Div(Field<Tenzor<T,1U>,1U,UniformCartesian<1U,MFLOAT>,Vert>& x,
396  Field<Vektor<T,1U>,1U,UniformCartesian<1U,MFLOAT>,Cell>& r);
397 //----------------------------------------------------------------------
398 template < class T, class MFLOAT >
400 Div(Field<Tenzor<T,2U>,2U,UniformCartesian<2U,MFLOAT>,Vert>& x,
401  Field<Vektor<T,2U>,2U,UniformCartesian<2U,MFLOAT>,Cell>& r);
402 //----------------------------------------------------------------------
403 template < class T, class MFLOAT >
405 Div(Field<Tenzor<T,3U>,3U,UniformCartesian<3U,MFLOAT>,Vert>& x,
406  Field<Vektor<T,3U>,3U,UniformCartesian<3U,MFLOAT>,Cell>& r);
407 //----------------------------------------------------------------------
408 // Divergence Tenzor/Cell -> Vektor/Vert
409 //----------------------------------------------------------------------
410 template < class T, class MFLOAT >
411 Field<Vektor<T,1U>,1U,UniformCartesian<1U,MFLOAT>,Vert>&
412 Div(Field<Tenzor<T,1U>,1U,UniformCartesian<1U,MFLOAT>,Cell>& x,
413  Field<Vektor<T,1U>,1U,UniformCartesian<1U,MFLOAT>,Vert>& r);
414 //----------------------------------------------------------------------
415 template < class T, class MFLOAT >
416 Field<Vektor<T,2U>,2U,UniformCartesian<2U,MFLOAT>,Vert>&
417 Div(Field<Tenzor<T,2U>,2U,UniformCartesian<2U,MFLOAT>,Cell>& x,
418  Field<Vektor<T,2U>,2U,UniformCartesian<2U,MFLOAT>,Vert>& r);
419 //----------------------------------------------------------------------
420 template < class T, class MFLOAT >
421 Field<Vektor<T,3U>,3U,UniformCartesian<3U,MFLOAT>,Vert>&
422 Div(Field<Tenzor<T,3U>,3U,UniformCartesian<3U,MFLOAT>,Cell>& x,
423  Field<Vektor<T,3U>,3U,UniformCartesian<3U,MFLOAT>,Vert>& r);
424 
425 //----------------------------------------------------------------------
426 // Grad Scalar/Vert -> Vektor/Cell
427 //----------------------------------------------------------------------
428 template < class T, class MFLOAT >
429 Field<Vektor<T,1U>,1U,UniformCartesian<1U,MFLOAT>,Cell>&
430 Grad(Field<T,1U,UniformCartesian<1U,MFLOAT>,Vert>& x,
431  Field<Vektor<T,1U>,1U,UniformCartesian<1U,MFLOAT>,Cell>& r);
432 //----------------------------------------------------------------------
433 template < class T, class MFLOAT >
434 Field<Vektor<T,2U>,2U,UniformCartesian<2U,MFLOAT>,Cell>&
435 Grad(Field<T,2U,UniformCartesian<2U,MFLOAT>,Vert>& x,
436  Field<Vektor<T,2u>,2U,UniformCartesian<2U,MFLOAT>,Cell>& r);
437 //----------------------------------------------------------------------
438 
440 template < class T, class MFLOAT >
441 Field<Vektor<T,3U>,3U,UniformCartesian<3U,MFLOAT>,Cell>&
442 Grad(Field<T,3U,UniformCartesian<3U,MFLOAT>,Vert>& x,
443  Field<Vektor<T,3U>,3U,UniformCartesian<3U,MFLOAT>,Cell>& r);
444 
446 template < class T, class MFLOAT >
447 Field<Vektor<T,3U>,3U,UniformCartesian<3U,MFLOAT>,Cell>&
448 Grad1Ord(Field<T,3U,UniformCartesian<3U,MFLOAT>,Vert>& x,
449  Field<Vektor<T,3U>,3U,UniformCartesian<3U,MFLOAT>,Cell>& r);
450 //----------------------------------------------------------------------
451 // Grad Scalar/Vert -> Vektor/Edge
452 //----------------------------------------------------------------------
453 template < class T, class MFLOAT >
454 Field<Vektor<T,1U>,1U,UniformCartesian<1U,MFLOAT>,Edge>&
455 Grad(Field<T,1U,UniformCartesian<1U,MFLOAT>,Vert>& x,
456  Field<Vektor<T,1U>,1U,UniformCartesian<1U,MFLOAT>,Edge>& r);
457 //----------------------------------------------------------------------
458 template < class T, class MFLOAT >
459 Field<Vektor<T,2U>,2U,UniformCartesian<2U,MFLOAT>,Edge>&
460 Grad(Field<T,2U,UniformCartesian<2U,MFLOAT>,Vert>& x,
461  Field<Vektor<T,2u>,2U,UniformCartesian<2U,MFLOAT>,Edge>& r);
462 //----------------------------------------------------------------------
463 template < class T, class MFLOAT >
464 Field<Vektor<T,3U>,3U,UniformCartesian<3U,MFLOAT>,Edge>&
465 Grad(Field<T,3U,UniformCartesian<3U,MFLOAT>,Vert>& x,
466  Field<Vektor<T,3U>,3U,UniformCartesian<3U,MFLOAT>,Edge>& r);
467 //----------------------------------------------------------------------
468 // Grad Scalar/Cell -> Vektor/Vert
469 //----------------------------------------------------------------------
470 template < class T, class MFLOAT >
471 Field<Vektor<T,1U>,1U,UniformCartesian<1U,MFLOAT>,Vert>&
472 Grad(Field<T,1U,UniformCartesian<1U,MFLOAT>,Cell>& x,
473  Field<Vektor<T,1U>,1U,UniformCartesian<1U,MFLOAT>,Vert>& r);
474 //----------------------------------------------------------------------
475 template < class T, class MFLOAT >
476 Field<Vektor<T,2U>,2U,UniformCartesian<2U,MFLOAT>,Vert>&
477 Grad(Field<T,2U,UniformCartesian<2U,MFLOAT>,Cell>& x,
478  Field<Vektor<T,2U>,2U,UniformCartesian<2U,MFLOAT>,Vert>& r);
479 //----------------------------------------------------------------------
480 template < class T, class MFLOAT >
481 Field<Vektor<T,3U>,3U,UniformCartesian<3U,MFLOAT>,Vert>&
482 Grad(Field<T,3U,UniformCartesian<3U,MFLOAT>,Cell>& x,
483  Field<Vektor<T,3U>,3U,UniformCartesian<3U,MFLOAT>,Vert>& r);
484 //----------------------------------------------------------------------
485 // Grad Scalar/Vert -> Vektor/Vert
486 //----------------------------------------------------------------------
487 template < class T, class MFLOAT >
488 Field<Vektor<T,1U>,1U,UniformCartesian<1U,MFLOAT>,Vert>&
489 Grad(Field<T,1U,UniformCartesian<1U,MFLOAT>,Vert>& x,
490  Field<Vektor<T,1U>,1U,UniformCartesian<1U,MFLOAT>,Vert>& r);
491 //----------------------------------------------------------------------
492 template < class T, class MFLOAT >
493 Field<Vektor<T,2U>,2U,UniformCartesian<2U,MFLOAT>,Vert>&
494 Grad(Field<T,2U,UniformCartesian<2U,MFLOAT>,Vert>& x,
495  Field<Vektor<T,2u>,2U,UniformCartesian<2U,MFLOAT>,Vert>& r);
496 //----------------------------------------------------------------------
497 template < class T, class MFLOAT >
498 Field<Vektor<T,3U>,3U,UniformCartesian<3U,MFLOAT>,Vert>&
499 Grad(Field<T,3U,UniformCartesian<3U,MFLOAT>,Vert>& x,
500  Field<Vektor<T,3U>,3U,UniformCartesian<3U,MFLOAT>,Vert>& r);
501 //----------------------------------------------------------------------
502 // Grad Scalar/Cell -> Vektor/Cell
503 //----------------------------------------------------------------------
504 template < class T, class MFLOAT >
505 Field<Vektor<T,1U>,1U,UniformCartesian<1U,MFLOAT>,Cell>&
506 Grad(Field<T,1U,UniformCartesian<1U,MFLOAT>,Cell>& x,
507  Field<Vektor<T,1U>,1U,UniformCartesian<1U,MFLOAT>,Cell>& r);
508 //----------------------------------------------------------------------
509 template < class T, class MFLOAT >
510 Field<Vektor<T,2U>,2U,UniformCartesian<2U,MFLOAT>,Cell>&
511 Grad(Field<T,2U,UniformCartesian<2U,MFLOAT>,Cell>& x,
512  Field<Vektor<T,2u>,2U,UniformCartesian<2U,MFLOAT>,Cell>& r);
513 //----------------------------------------------------------------------
514 template < class T, class MFLOAT >
515 Field<Vektor<T,3U>,3U,UniformCartesian<3U,MFLOAT>,Cell>&
516 Grad(Field<T,3U,UniformCartesian<3U,MFLOAT>,Cell>& x,
517  Field<Vektor<T,3U>,3U,UniformCartesian<3U,MFLOAT>,Cell>& r);
518 //----------------------------------------------------------------------
519 // Grad Vektor/Vert -> Tenzor/Cell
520 //----------------------------------------------------------------------
521 template < class T, class MFLOAT >
522 Field<Tenzor<T,1U>,1U,UniformCartesian<1U,MFLOAT>,Cell>&
523 Grad(Field<Vektor<T,1U>,1U,UniformCartesian<1U,MFLOAT>,Vert>& x,
524  Field<Tenzor<T,1U>,1U,UniformCartesian<1U,MFLOAT>,Cell>& r);
525 //----------------------------------------------------------------------
526 template < class T, class MFLOAT >
527 Field<Tenzor<T,2U>,2U,UniformCartesian<2U,MFLOAT>,Cell>&
528 Grad(Field<Vektor<T,2U>,2U,UniformCartesian<2U,MFLOAT>,Vert>& x,
529  Field<Tenzor<T,2U>,2U,UniformCartesian<2U,MFLOAT>,Cell>& r);
530 //----------------------------------------------------------------------
531 template < class T, class MFLOAT >
532 Field<Tenzor<T,3U>,3U,UniformCartesian<3U,MFLOAT>,Cell>&
533 Grad(Field<Vektor<T,3U>,3U,UniformCartesian<3U,MFLOAT>,Vert>& x,
534  Field<Tenzor<T,3U>,3U,UniformCartesian<3U,MFLOAT>,Cell>& r);
535 //----------------------------------------------------------------------
536 // Grad Vektor/Cell -> Tenzor/Vert
537 //----------------------------------------------------------------------
538 template < class T, class MFLOAT >
539 Field<Tenzor<T,1U>,1U,UniformCartesian<1U,MFLOAT>,Vert>&
540 Grad(Field<Vektor<T,1U>,1U,UniformCartesian<1U,MFLOAT>,Cell>& x,
541  Field<Tenzor<T,1U>,1U,UniformCartesian<1U,MFLOAT>,Vert>& r);
542 //----------------------------------------------------------------------
543 template < class T, class MFLOAT >
544 Field<Tenzor<T,2U>,2U,UniformCartesian<2U,MFLOAT>,Vert>&
545 Grad(Field<Vektor<T,2U>,2U,UniformCartesian<2U,MFLOAT>,Cell>& x,
546  Field<Tenzor<T,2U>,2U,UniformCartesian<2U,MFLOAT>,Vert>& r);
547 //----------------------------------------------------------------------
548 template < class T, class MFLOAT >
549 Field<Tenzor<T,3U>,3U,UniformCartesian<3U,MFLOAT>,Vert>&
550 Grad(Field<Vektor<T,3U>,3U,UniformCartesian<3U,MFLOAT>,Cell>& x,
551  Field<Tenzor<T,3U>,3U,UniformCartesian<3U,MFLOAT>,Vert>& r);
552 //----------------------------------------------------------------------
553 // Divergence SymTenzor/Vert -> Vektor/Cell
554 //----------------------------------------------------------------------
555 //----------------------------------------------------------------------
556 template < class T, class MFLOAT >
557 Field<Vektor<T,2U>,2U,UniformCartesian<2U,MFLOAT>,Cell>&
558 Div(Field<SymTenzor<T,2U>,2U,UniformCartesian<2U,MFLOAT>,Vert>& x,
559  Field<Vektor<T,2U>,2U,UniformCartesian<2U,MFLOAT>,Cell>& r);
560 //----------------------------------------------------------------------
561 template < class T, class MFLOAT >
562 Field<Vektor<T,3U>,3U,UniformCartesian<3U,MFLOAT>,Cell>&
563 Div(Field<SymTenzor<T,3U>,3U,UniformCartesian<3U,MFLOAT>,Vert>& x,
564  Field<Vektor<T,3U>,3U,UniformCartesian<3U,MFLOAT>,Cell>& r);
565 //----------------------------------------------------------------------
566 // Divergence SymTenzor/Cell -> Vektor/Vert
567 //----------------------------------------------------------------------
568 template < class T, class MFLOAT >
569 Field<Vektor<T,1U>,1U,UniformCartesian<1U,MFLOAT>,Vert>&
570 Div(Field<SymTenzor<T,1U>,1U,UniformCartesian<1U,MFLOAT>,Cell>& x,
571  Field<Vektor<T,1U>,1U,UniformCartesian<1U,MFLOAT>,Vert>& r);
572 //----------------------------------------------------------------------
573 template < class T, class MFLOAT >
574 Field<Vektor<T,2U>,2U,UniformCartesian<2U,MFLOAT>,Vert>&
575 Div(Field<SymTenzor<T,2U>,2U,UniformCartesian<2U,MFLOAT>,Cell>& x,
576  Field<Vektor<T,2U>,2U,UniformCartesian<2U,MFLOAT>,Vert>& r);
577 //----------------------------------------------------------------------
578 template < class T, class MFLOAT >
579 Field<Vektor<T,3U>,3U,UniformCartesian<3U,MFLOAT>,Vert>&
580 Div(Field<SymTenzor<T,3U>,3U,UniformCartesian<3U,MFLOAT>,Cell>& x,
581  Field<Vektor<T,3U>,3U,UniformCartesian<3U,MFLOAT>,Vert>& r);
582 
583 namespace IPPL {
584 
585 //----------------------------------------------------------------------
586 // Weighted average Cell to Vert
587 //----------------------------------------------------------------------
588 template < class T1, class T2, class MFLOAT >
590 Average(Field<T1,1U,UniformCartesian<1U,MFLOAT>,Cell>& x,
591  Field<T2,1U,UniformCartesian<1U,MFLOAT>,Cell>& w,
592  Field<T1,1U,UniformCartesian<1U,MFLOAT>,Vert>& r) ;
593 //----------------------------------------------------------------------
594 template < class T1, class T2, class MFLOAT >
596 Average(Field<T1,2U,UniformCartesian<2U,MFLOAT>,Cell>& x,
597  Field<T2,2U,UniformCartesian<2U,MFLOAT>,Cell>& w,
598  Field<T1,2U,UniformCartesian<2U,MFLOAT>,Vert>& r);
599 //----------------------------------------------------------------------
600 template < class T1, class T2, class MFLOAT >
602 Average(Field<T1,3U,UniformCartesian<3U,MFLOAT>,Cell>& x,
603  Field<T2,3U,UniformCartesian<3U,MFLOAT>,Cell>& w,
604  Field<T1,3U,UniformCartesian<3U,MFLOAT>,Vert>& r);
605 
606 //----------------------------------------------------------------------
607 // Weighted average Vert to Cell
608 //----------------------------------------------------------------------
609 template < class T1, class T2, class MFLOAT >
611 Average(Field<T1,1U,UniformCartesian<1U,MFLOAT>,Vert>& x,
612  Field<T2,1U,UniformCartesian<1U,MFLOAT>,Vert>& w,
613  Field<T1,1U,UniformCartesian<1U,MFLOAT>,Cell>& r) ;
614 //----------------------------------------------------------------------
615 template < class T1, class T2, class MFLOAT >
617 Average(Field<T1,2U,UniformCartesian<2U,MFLOAT>,Vert>& x,
618  Field<T2,2U,UniformCartesian<2U,MFLOAT>,Vert>& w,
619  Field<T1,2U,UniformCartesian<2U,MFLOAT>,Cell>& r);
620 //----------------------------------------------------------------------
621 template < class T1, class T2, class MFLOAT >
623 Average(Field<T1,3U,UniformCartesian<3U,MFLOAT>,Vert>& x,
624  Field<T2,3U,UniformCartesian<3U,MFLOAT>,Vert>& w,
625  Field<T1,3U,UniformCartesian<3U,MFLOAT>,Cell>& r);
626 
627 //----------------------------------------------------------------------
628 
629 //----------------------------------------------------------------------
630 // Unweighted average Cell to Vert
631 //----------------------------------------------------------------------
632 template < class T1, class MFLOAT >
634 Average(Field<T1,1U,UniformCartesian<1U,MFLOAT>,Cell>& x,
635  Field<T1,1U,UniformCartesian<1U,MFLOAT>,Vert>& r) ;
636 //----------------------------------------------------------------------
637 template < class T1, class MFLOAT >
639 Average(Field<T1,2U,UniformCartesian<2U,MFLOAT>,Cell>& x,
640  Field<T1,2U,UniformCartesian<2U,MFLOAT>,Vert>& r);
641 //----------------------------------------------------------------------
642 template < class T1, class MFLOAT >
644 Average(Field<T1,3U,UniformCartesian<3U,MFLOAT>,Cell>& x,
645  Field<T1,3U,UniformCartesian<3U,MFLOAT>,Vert>& r);
646 
647 //----------------------------------------------------------------------
648 // Unweighted average Vert to Cell
649 //----------------------------------------------------------------------
650 template < class T1, class MFLOAT >
652 Average(Field<T1,1U,UniformCartesian<1U,MFLOAT>,Vert>& x,
653  Field<T1,1U,UniformCartesian<1U,MFLOAT>,Cell>& r) ;
654 //----------------------------------------------------------------------
655 template < class T1, class MFLOAT >
657 Average(Field<T1,2U,UniformCartesian<2U,MFLOAT>,Vert>& x,
658  Field<T1,2U,UniformCartesian<2U,MFLOAT>,Cell>& r);
659 //----------------------------------------------------------------------
660 template < class T1, class MFLOAT >
662 Average(Field<T1,3U,UniformCartesian<3U,MFLOAT>,Vert>& x,
663  Field<T1,3U,UniformCartesian<3U,MFLOAT>,Cell>& r);
664 
665 //----------------------------------------------------------------------
666 }
667 
669 
670 #endif // UNIFORM_CARTESIAN_H
671 
672 /***************************************************************************
673  * $RCSfile: UniformCartesian.h,v $ $Author: adelmann $
674  * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:28 $
675  * IPPL_VERSION_ID: $Id: UniformCartesian.h,v 1.1.1.1 2003/01/23 07:40:28 adelmann Exp $
676  ***************************************************************************/
MFLOAT getCellVolume(const NDIndex< Dim > &) const
BareField< Vektor< MFLOAT, Dim >, Dim > * VertSpacings
NDIndex< Dim > getNearestVertex(const Vektor< MFLOAT, Dim > &) const
Definition: Centering.h:49
void set_meshSpacing(MFLOAT *const del)
Field< Vektor< MFLOAT, Dim >, Dim, UniformCartesian< Dim, MFLOAT >, Cell > & getDeltaVertexField(Field< Vektor< MFLOAT, Dim >, Dim, UniformCartesian< Dim, MFLOAT >, Cell > &) const
Field< Vektor< MFLOAT, Dim >, Dim, UniformCartesian< Dim, MFLOAT >, Cell > & getCellPositionField(Field< Vektor< MFLOAT, Dim >, Dim, UniformCartesian< Dim, MFLOAT >, Cell > &) const
Vektor< MFLOAT, Dim > MeshVektor_t
NDIndex< Dim > getCellContaining(const Vektor< MFLOAT, Dim > &x) const
Vektor< MFLOAT, Dim > get_origin() const
Definition: Index.h:236
Vektor< MFLOAT, Dim > getDeltaVertex(const NDIndex< Dim > &) const
Definition: Centering.h:31
Field< Vektor< MFLOAT, Dim >, Dim, UniformCartesian< Dim, MFLOAT >, Vert > & getVertexPositionField(Field< Vektor< MFLOAT, Dim >, Dim, UniformCartesian< Dim, MFLOAT >, Vert > &) const
Vektor< MFLOAT, Dim > getCellPosition(const NDIndex< Dim > &) const
void print(std::ostream &)
void getSurfaceNormalFields(Field< Vektor< MFLOAT, Dim >, Dim, UniformCartesian< Dim, MFLOAT >, Cell > **) const
Field< Vektor< T, 1U >, 1U, Cartesian< 1U, MFLOAT >, Cell > & Grad(Field< T, 1U, Cartesian< 1U, MFLOAT >, Vert > &x, Field< Vektor< T, 1U >, 1U, Cartesian< 1U, MFLOAT >, Cell > &r)
Definition: Cartesian.hpp:2702
Definition: Inform.h:42
MFLOAT get_volume() const
void set_origin(const Vektor< MFLOAT, Dim > &o)
e_dim_tag
Definition: FieldLayout.h:55
Field< Vektor< MFLOAT, Dim >, Dim, UniformCartesian< Dim, MFLOAT >, Cell > & getSurfaceNormalField(Field< Vektor< MFLOAT, Dim >, Dim, UniformCartesian< Dim, MFLOAT >, Cell > &, unsigned) const
const unsigned Dim
unsigned gridSizes[Dim]
double Div(double a, double b)
NDIndex< Dim > getVertexBelow(const Vektor< MFLOAT, Dim > &) const
Vektor< MFLOAT, Dim > getDeltaCell(const NDIndex< Dim > &) const
Definition: Mesh.h:35
MFLOAT getVertRangeVolume(const NDIndex< Dim > &) const
FieldLayout< Dim > * FlCell
Vektor< MFLOAT, Dim > origin
Field< Vektor< MFLOAT, Dim >, Dim, UniformCartesian< Dim, MFLOAT >, Vert > & getDeltaCellField(Field< Vektor< MFLOAT, Dim >, Dim, UniformCartesian< Dim, MFLOAT >, Vert > &) const
Field< Vektor< T, 3U >, 3U, UniformCartesian< 3U, MFLOAT >, Cell > & Grad1Ord(Field< T, 3U, UniformCartesian< 3U, MFLOAT >, Vert > &x, Field< Vektor< T, 3U >, 3U, UniformCartesian< 3U, MFLOAT >, Cell > &r)
Old Grad operator.
Field< T1, 1U, Cartesian< 1U, MFLOAT >, Vert > & Average(Field< T1, 1U, Cartesian< 1U, MFLOAT >, Cell > &x, Field< T2, 1U, Cartesian< 1U, MFLOAT >, Cell > &w, Field< T1, 1U, Cartesian< 1U, MFLOAT >, Vert > &r)
Definition: Cartesian.hpp:3113
MFLOAT get_meshSpacing(unsigned d) const
Definition: FFT.h:26
Definition: Tenzor.h:34
Vektor< MFLOAT, Dim > getSurfaceNormal(const NDIndex< Dim > &, unsigned) const
void initialize(const NDIndex< Dim > &ndi)
BareField< Vektor< MFLOAT, Dim >, Dim > * CellSpacings
FieldLayout< Dim > * FlVert
MFLOAT getCellRangeVolume(const NDIndex< Dim > &) const
Field< MFLOAT, Dim, UniformCartesian< Dim, MFLOAT >, Cell > & getCellVolumeField(Field< MFLOAT, Dim, UniformCartesian< Dim, MFLOAT >, Cell > &) const
Vektor< MFLOAT, Dim > * getSurfaceNormals(const NDIndex< Dim > &) const
MFLOAT meshSpacing[Dim]
Vektor< MFLOAT, Dim > getVertexPosition(const NDIndex< Dim > &) const
Vektor< MFLOAT, Dim > Dvc[1<< Dim]
Definition: Centering.h:42