Shiokaze Framework
A research-oriented fluid solver for computer graphics
shape.h
Go to the documentation of this file.
1 /*
2 ** shape.h
3 **
4 ** This is part of Shiokaze, a research-oriented fluid solver for computer graphics.
5 ** Created by Ryoichi Ando <rand@nii.ac.jp> on Feb 10, 2018.
6 **
7 ** Permission is hereby granted, free of charge, to any person obtaining a copy of
8 ** this software and associated documentation files (the "Software"), to deal in
9 ** the Software without restriction, including without limitation the rights to use,
10 ** copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
11 ** Software, and to permit persons to whom the Software is furnished to do so,
12 ** subject to the following conditions:
13 **
14 ** The above copyright notice and this permission notice shall be included in all copies
15 ** or substantial portions of the Software.
16 **
17 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
18 ** INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
19 ** PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 ** HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
21 ** CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
22 ** OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24 //
25 #ifndef SHKZ_SHAPE_H
26 #define SHKZ_SHAPE_H
27 //
28 #include <shiokaze/math/vec.h>
29 #include <algorithm>
30 #include <cstdint>
31 #include <functional>
32 #include <cmath>
33 //
35 //
37 //
42 struct shape2 {
49  shape2( const unsigned gn[DIM2] ) : w(gn[0]), h(gn[1]) {}
58  shape2( unsigned w, unsigned h ) : w(w), h(h) {}
63  shape2() : w(0), h(0) {}
70  bool operator==( const shape2 &shape ) const {
71  return w==shape.w && h==shape.h;
72  }
79  bool operator!=( const shape2 &shape ) const {
80  return ! (*this == shape);
81  }
88  unsigned operator[](unsigned idx) const {
89  if( idx == 0 ) return w;
90  else if( idx == 1 ) return h;
91  else return 0;
92  }
99  unsigned& operator[](unsigned idx) {
100  static unsigned dummy (0);
101  if( idx == 0 ) return w;
102  else if( idx == 1 ) return h;
103  else return dummy;
104  }
113  shape2 operator+(const shape2& rhs) const {
114  return shape2(w+rhs.w,h+rhs.h);
115  }
122  void operator+=(const shape2& rhs) {
123  w += rhs.w;
124  h += rhs.h;
125  }
134  shape2 operator-(const shape2& rhs) const {
135  return shape2(w-rhs.w,h-rhs.h);
136  }
143  void operator-=(const shape2& rhs) {
144  w -= rhs.w;
145  h -= rhs.h;
146  }
155  shape2 operator*(double s) const {
156  return shape2(s*w,s*h);
157  }
164  void operator*=(double v) {
165  w *= v;
166  h *= v;
167  }
176  shape2 operator/(double s) const {
177  return shape2(w/s,h/s);
178  }
185  void operator/=(double v) {
186  w /= v;
187  h /= v;
188  }
197  void get( unsigned &w, unsigned &h ) const {
198  w = this->w;
199  h = this->h;
200  }
207  void get( unsigned gn[DIM2] ) const {
208  gn[0] = w;
209  gn[1] = h;
210  }
219  vec2d box( double dx ) const {
220  return vec2d(dx*w,dx*h);
221  }
228  bool operator<(const shape2& rhs) const {
229  return hash() < rhs.hash();
230  }
235  size_t hash() const {
236  size_t _w (w);
237  size_t _h (h);
238  unsigned log2h = (unsigned)log2(h)+1;
239  return _w ^ (_h << log2h);
240  }
245  shape2 cell() const { return shape2(w,h); }
250  shape2 nodal() const { return shape2(w+1,h+1); }
257  shape2 face(int dim) const { return shape2(w+(dim==0),h+(dim==1)); }
264  template <class T> vec2i find_cell( const vec2<T> &p ) const {
265  return cell().clamp(p);
266  }
273  template <class T> vec2i find_node( const vec2<T> &p ) const {
274  return nodal().clamp(p+vec2d(0.5,0.5));
275  }
282  template <class T> vec2i find_face( const vec2<T> &p, unsigned dim ) const {
283  return face(dim).clamp(p+0.5*vec2d(dim==0,dim==1));
284  }
289  double dx() const {
290  double dx(1.0);
291  for( unsigned dim : DIMS2 ) dx = std::min(dx,1.0/(*this)[dim]);
292  return dx;
293  }
298  unsigned max() const {
299  unsigned result (0);
300  for( int dim : DIMS2 ) result = std::max(result,(*this)[dim]);
301  return result;
302  }
311  vec2i clamp( const vec2i &pi ) const {
312  return clamp(pi[0],pi[1]);
313  }
324  vec2i clamp( int i, int j ) const {
325  if( i < 0 ) i = 0;
326  if( i > w-1 ) i = w-1;
327  if( j < 0 ) j = 0;
328  if( j > h-1 ) j = h-1;
329  return vec2i(i,j);
330  }
341  bool out_of_bounds( int i, int j ) const {
342  return ( i < 0 || i >= w || j < 0 || j >= h );
343  }
352  bool out_of_bounds( const vec2i &pi ) const {
353  return out_of_bounds(pi[0],pi[1]);
354  }
365  bool on_edge( int i, int j ) const {
366  return i==0 || j==0 || i==w-1 || j==h-1;
367  }
376  bool on_edge( const vec2i &pi ) const {
377  return on_edge(pi[0],pi[1]);
378  }
385  size_t count() const {
386  size_t _w(w);
387  size_t _h(h);
388  return _w*_h;
389  }
396  bool empty() const {
397  return w == 0 && h == 0;
398  }
409  size_t encode( int i, int j ) const {
410  size_t _w(w);
411  return _w*j+i;
412  }
421  size_t encode( const vec2i &pi ) const {
422  return encode(pi[0],pi[1]);
423  }
432  vec2i decode( size_t value ) const {
433  return vec2i( value % w, value / w );
434  }
441  void for_each( std::function<void(int i, int j)> func ) const {
442  for( int j=0; j<h; ++j ) for( int i=0; i<w; ++i ) {
443  func(i,j);
444  }
445  }
452  void interruptible_for_each( std::function<bool(int i, int j)> func ) const {
453  for( int j=0; j<h; ++j ) for( int i=0; i<w; ++i ) {
454  if(func(i,j)) return;
455  }
456  }
461  unsigned w;
466  unsigned h;
467 };
468 //
469 static inline shape2 operator*(double s, const shape2 &shape) {
470  return shape*s;
471 }
472 static inline shape2 operator/(double s, const shape2 &shape) {
473  return shape/s;
474 }
475 //
478 struct shape3 {
485  shape3( const unsigned gn[DIM2] ) : w(gn[0]), h(gn[1]), d(gn[2]) {}
496  shape3( unsigned w, unsigned h, unsigned d) : w(w), h(h), d(d) {}
501  shape3() : w(0), h(0), d(0) {}
508  bool operator==( const shape3 &shape ) const {
509  return w==shape.w && h==shape.h && d==shape.d;
510  }
517  bool operator!=( const shape3 &shape ) const {
518  return ! (*this == shape);
519  }
526  unsigned operator[](unsigned idx) const {
527  if( idx == 0 ) return w;
528  else if( idx == 1 ) return h;
529  else if( idx == 2 ) return d;
530  else return 0;
531  }
538  unsigned& operator[](unsigned idx) {
539  static unsigned dummy (0);
540  if( idx == 0 ) return w;
541  else if( idx == 1 ) return h;
542  else if( idx == 2 ) return d;
543  else return dummy;
544  }
553  shape3 operator+(const shape3& rhs) const {
554  return shape3(w+rhs.w,h+rhs.h,d+rhs.d);
555  }
562  void operator+=(const shape3& rhs) {
563  w += rhs.w;
564  h += rhs.h;
565  d += rhs.d;
566  }
575  shape3 operator-(const shape3& rhs) const {
576  return shape3(w-rhs.w,h-rhs.h,d-rhs.d);
577  }
584  void operator-=(const shape3& rhs) {
585  w -= rhs.w;
586  h -= rhs.h;
587  d -= rhs.d;
588  }
597  shape3 operator*(double s) const {
598  return shape3(s*w,s*h,s*d);
599  }
606  void operator*=(double v) {
607  w *= v;
608  h *= v;
609  d *= v;
610  }
619  shape3 operator/(double s) const {
620  return shape3(w/s,h/s,d/s);
621  }
628  void operator/=(double v) {
629  w /= v;
630  h /= v;
631  d /= v;
632  }
643  void get( unsigned &w, unsigned &h, unsigned &d ) const {
644  w = this->w;
645  h = this->h;
646  d = this->d;
647  }
654  void get( unsigned gn[DIM3] ) const {
655  gn[0] = w;
656  gn[1] = h;
657  gn[2] = d;
658  }
667  vec3d box( double dx ) const {
668  return vec3d(dx*w,dx*h,dx*d);
669  }
676  bool operator<(const shape2& rhs) const {
677  return hash() < rhs.hash();
678  }
683  size_t hash() const {
684  size_t _w (w);
685  size_t _h (h);
686  size_t _d (h);
687  unsigned log2h = (unsigned)log2(h)+1;
688  unsigned log2d = (unsigned)log2(d)+1;
689  return _w ^ (_h << log2h) ^ (_d << (log2h+log2d));
690  }
695  shape3 cell() const { return shape3(w,h,d); }
700  shape3 nodal() const { return shape3(w+1,h+1,d+1); }
707  shape3 face(int dim) const { return shape3(w+(dim==0),h+(dim==1),d+(dim==2)); }
714  shape3 edge(int dim) const { return shape3(w+(dim!=0),h+(dim!=1),d+(dim!=2)); }
721  vec3i find_cell( const vec3d &p ) const {
722  return shape3(w,h,d).clamp(p);
723  }
730  template <class T> vec3i find_node( const vec3<T> &p ) const {
731  return nodal().clamp(p+vec3d(0.5,0.5,0.5));
732  }
739  template <class T> vec3i find_edge( const vec3<T> &p, unsigned dim ) const {
740  return edge(dim).clamp(p+0.5*vec3d(dim!=0,dim!=1,dim!=2));
741  }
748  template <class T> vec3i find_face( const vec3<T> &p, unsigned dim ) const {
749  return face(dim).clamp(p+0.5*vec3d(dim==0,dim==1,dim==2));
750  }
755  double dx() const {
756  double dx(1.0);
757  for( unsigned dim : DIMS3 ) dx = std::min(dx,1.0/(*this)[dim]);
758  return dx;
759  }
764  unsigned max() const {
765  unsigned result (0);
766  for( int dim : DIMS3 ) result = std::max(result,(*this)[dim]);
767  return result;
768  }
777  vec3i clamp( const vec3i &pi ) const {
778  return clamp(pi[0],pi[1],pi[2]);
779  }
790  vec3i clamp( int i, int j, int k ) const {
791  if( i < 0 ) i = 0;
792  if( i > w-1 ) i = w-1;
793  if( j < 0 ) j = 0;
794  if( j > h-1 ) j = h-1;
795  if( k < 0 ) k = 0;
796  if( k > d-1 ) k = d-1;
797  return vec3i(i,j,k);
798  }
811  bool out_of_bounds( int i, int j, int k ) const {
812  return ( i < 0 || i >= w || j < 0 || j >= h || k < 0 || k >= d );
813  }
822  bool out_of_bounds( const vec3i &pi ) const {
823  return out_of_bounds(pi[0],pi[1],pi[2]);
824  }
837  bool on_edge( int i, int j, int k ) const {
838  return i==0 || j==0 || i==w-1 || j==h-1 || k==d-1 || k==d-1;
839  }
848  bool on_edge( const vec3i &pi ) const {
849  return on_edge(pi[0],pi[1],pi[2]);
850  }
857  size_t count() const {
858  size_t _w (w);
859  size_t _h (h);
860  size_t _d (d);
861  return _w*_h*_d;
862  }
869  bool empty() const {
870  return w == 0 && h == 0 && d == 0;
871  }
883  size_t encode( int i, int j, int k ) const {
884  size_t _w (w);
885  size_t _h (h);
886  size_t _d (d);
887  return (_w*_h)*k+_w*j+i;
888  }
897  size_t encode( const vec3i &pi ) const {
898  return encode(pi[0],pi[1],pi[2]);
899  }
908  vec3i decode( size_t value ) const {
909  size_t plane_count = w*h;
910  int k = value / plane_count;
911  size_t m = value % plane_count;
912  int i = m % w;
913  int j = m / w;
914  return vec3i(i,j,k);
915  }
922  void for_each( std::function<void(int i, int j, int k)> func ) const {
923  for( int k=0; k<d; ++k ) for( int j=0; j<h; ++j ) for( int i=0; i<w; ++i ) {
924  func(i,j,k);
925  }
926  }
933  void interruptible_for_each( std::function<bool(int i, int j, int k)> func ) const {
934  for( int k=0; k<d; ++k ) for( int j=0; j<h; ++j ) for( int i=0; i<w; ++i ) {
935  if(func(i,j,k)) return;
936  }
937  }
942  unsigned w;
947  unsigned h;
952  unsigned d;
953 };
954 //
955 static inline shape3 operator*(double s, const shape3 &shape) {
956  return shape*s;
957 }
958 static inline shape3 operator/(double s, const shape3 &shape) {
959  return shape/s;
960 }
961 //
963 //
964 #endif
shape2::get
void get(unsigned gn[DIM2]) const
Get the dimensional numbers of this shape.
Definition: shape.h:207
shape2::operator<
bool operator<(const shape2 &rhs) const
Compare the hash from the input shape.
Definition: shape.h:228
shape3::w
unsigned w
Width of the shape.
Definition: shape.h:942
shape3::interruptible_for_each
void interruptible_for_each(std::function< bool(int i, int j, int k)> func) const
Perform a serial loop operation.
Definition: shape.h:933
shape3::out_of_bounds
bool out_of_bounds(int i, int j, int k) const
Get if the position is outside of the index space of this shape.
Definition: shape.h:811
shape2::operator-=
void operator-=(const shape2 &rhs)
Shrink the shape by the input shape.
Definition: shape.h:143
shape3::hash
size_t hash() const
Get the hash number of this shape.
Definition: shape.h:683
shape2::hash
size_t hash() const
Get the hash number of this shape.
Definition: shape.h:235
shape3::shape3
shape3()
Constructor for shape3.
Definition: shape.h:501
shape2::find_node
vec2i find_node(const vec2< T > &p) const
Find the nearest nodal position from the input fractional position.
Definition: shape.h:273
shape3::cell
shape3 cell() const
Get the shape for the cell-centered grid from this shape.
Definition: shape.h:695
shape3::operator==
bool operator==(const shape3 &shape) const
Get if this shape is equal to the input shape.
Definition: shape.h:508
shape3::operator/=
void operator/=(double v)
Scale this shape (by division) by the input number.
Definition: shape.h:628
shape2::operator!=
bool operator!=(const shape2 &shape) const
Get if this shape is different from the input shape.
Definition: shape.h:79
shape2::operator/
shape2 operator/(double s) const
Get a scaled (by division) shape by the input number.
Definition: shape.h:176
shape2::on_edge
bool on_edge(const vec2i &pi) const
Get if the position lies on the edge of the index space of this shape.
Definition: shape.h:376
shape3::shape3
shape3(const unsigned gn[DIM2])
Constructor for shape3.
Definition: shape.h:485
shape3::operator!=
bool operator!=(const shape3 &shape) const
Get if this shape is different from the input shape.
Definition: shape.h:517
shape3::operator-=
void operator-=(const shape3 &rhs)
Shrink the shape by the input shape.
Definition: shape.h:584
shape2::out_of_bounds
bool out_of_bounds(const vec2i &pi) const
Get if the position is outside of the index space of this shape.
Definition: shape.h:352
shape3::get
void get(unsigned gn[DIM3]) const
Get the dimensional numbers of this shape.
Definition: shape.h:654
shape3::operator*=
void operator*=(double v)
Scale this shape by the input number.
Definition: shape.h:606
shape3::h
unsigned h
Height of the shape.
Definition: shape.h:947
shape3::face
shape3 face(int dim) const
Get the shape for the staggered grid of a specified dimension from this shape.
Definition: shape.h:707
shape3::get
void get(unsigned &w, unsigned &h, unsigned &d) const
Get the dimensional numbers of this shape.
Definition: shape.h:643
shape3::encode
size_t encode(int i, int j, int k) const
Encode an index position to an integer.
Definition: shape.h:883
shape2::find_face
vec2i find_face(const vec2< T > &p, unsigned dim) const
Find the nearest facial position (in the context of staggered grid) from the input fractional positio...
Definition: shape.h:282
shape3::decode
vec3i decode(size_t value) const
Decode from an integer to an index coordinate.
Definition: shape.h:908
shape3::count
size_t count() const
Count the number of cells of the grid of this shape.
Definition: shape.h:857
shape3
Structure that defines a three dimensional shape such as width, height and depth.
Definition: shape.h:478
shape3::dx
double dx() const
Get the length of grid cell size.
Definition: shape.h:755
shape2::encode
size_t encode(const vec2i &pi) const
Encode an index position to an integer.
Definition: shape.h:421
shape2::count
size_t count() const
Count the number of cells of the grid of this shape.
Definition: shape.h:385
shape3::d
unsigned d
Depth of the shape.
Definition: shape.h:952
shape2::out_of_bounds
bool out_of_bounds(int i, int j) const
Get if the position is outside of the index space of this shape.
Definition: shape.h:341
shape3::encode
size_t encode(const vec3i &pi) const
Encode an index position to an integer.
Definition: shape.h:897
shape2::find_cell
vec2i find_cell(const vec2< T > &p) const
Find the nearest cell position from the input fractional position.
Definition: shape.h:264
shape2::h
unsigned h
Height of the shape.
Definition: shape.h:466
shape3::on_edge
bool on_edge(const vec3i &pi) const
Get if the position lies on the edge of the index space of this shape.
Definition: shape.h:848
shape2::clamp
vec2i clamp(int i, int j) const
Get the new constrained position within the index space of this shape.
Definition: shape.h:324
shape2::shape2
shape2(const unsigned gn[DIM2])
Constructor for shape2.
Definition: shape.h:49
shape3::operator/
shape3 operator/(double s) const
Get a scaled (by division) shape by the input number.
Definition: shape.h:619
shape2::cell
shape2 cell() const
Get the shape for the cell-centered grid from this shape.
Definition: shape.h:245
shape3::find_face
vec3i find_face(const vec3< T > &p, unsigned dim) const
Find the nearest facial position (in the context of staggered grid) from the input fractional positio...
Definition: shape.h:748
shape2::box
vec2d box(double dx) const
Get the world coordinate size of the shape.
Definition: shape.h:219
SHKZ_BEGIN_NAMESPACE
#define SHKZ_BEGIN_NAMESPACE
Name space beggining definition for shiokaze.
Definition: common.h:39
shape3::find_node
vec3i find_node(const vec3< T > &p) const
Find the nearest nodal position from the input fractional position.
Definition: shape.h:730
shape2::max
unsigned max() const
Get the maximal number in all the dimensions.
Definition: shape.h:298
shape3::empty
bool empty() const
Get if all the lengthes of this shape is zero.
Definition: shape.h:869
shape2::decode
vec2i decode(size_t value) const
Decode from an integer to an index coordinate.
Definition: shape.h:432
shape2::get
void get(unsigned &w, unsigned &h) const
Get the dimensional numbers of this shape.
Definition: shape.h:197
shape2::w
unsigned w
Width of the shape.
Definition: shape.h:461
shape2::face
shape2 face(int dim) const
Get the shape for the staggered grid of a specified dimension from this shape.
Definition: shape.h:257
shape3::clamp
vec3i clamp(int i, int j, int k) const
Get the new constrained position within the index space of this shape.
Definition: shape.h:790
shape2::operator[]
unsigned operator[](unsigned idx) const
Get the number of a specified dimensional of this shape.
Definition: shape.h:88
shape3::for_each
void for_each(std::function< void(int i, int j, int k)> func) const
Perform a three dimensional serial loop operation.
Definition: shape.h:922
shape2::interruptible_for_each
void interruptible_for_each(std::function< bool(int i, int j)> func) const
Perform a serial loop operation.
Definition: shape.h:452
shape3::operator-
shape3 operator-(const shape3 &rhs) const
Get an shrunk shape by the input shape.
Definition: shape.h:575
shape3::operator+=
void operator+=(const shape3 &rhs)
Expand this shape by the input shape.
Definition: shape.h:562
shape2::shape2
shape2(unsigned w, unsigned h)
Constructor for shape2.
Definition: shape.h:58
shape3::operator+
shape3 operator+(const shape3 &rhs) const
Get an expanded shape by the input shape.
Definition: shape.h:553
shape3::operator[]
unsigned & operator[](unsigned idx)
Get the writable number of a specified dimensional of this shape.
Definition: shape.h:538
shape3::find_edge
vec3i find_edge(const vec3< T > &p, unsigned dim) const
Find the nearest edge position from the input fractional position.
Definition: shape.h:739
shape3::on_edge
bool on_edge(int i, int j, int k) const
Get if the position lies on the edge of the index space of this shape.
Definition: shape.h:837
shape2::operator*
shape2 operator*(double s) const
Get a scaled shape by the input number.
Definition: shape.h:155
shape2::operator+=
void operator+=(const shape2 &rhs)
Expand this shape by the input shape.
Definition: shape.h:122
shape2::dx
double dx() const
Get the length of grid cell size.
Definition: shape.h:289
shape2::nodal
shape2 nodal() const
Get the shape for the nodal defined grid from this shape.
Definition: shape.h:250
shape2::operator-
shape2 operator-(const shape2 &rhs) const
Get an shrunk shape by the input shape.
Definition: shape.h:134
vec
Fixed sized vector structure.
Definition: vec.h:38
shape2::empty
bool empty() const
Get if all the lengthes of this shape is zero.
Definition: shape.h:396
shape2::operator[]
unsigned & operator[](unsigned idx)
Get the writable number of a specified dimensional of this shape.
Definition: shape.h:99
shape2::shape2
shape2()
Constructor for shape2.
Definition: shape.h:63
shape2::operator/=
void operator/=(double v)
Scale this shape (by division) by the input number.
Definition: shape.h:185
vec.h
shape3::edge
shape3 edge(int dim) const
Get the shape of edge of a specified dimension from this shape.
Definition: shape.h:714
shape2::encode
size_t encode(int i, int j) const
Encode an index position to an integer.
Definition: shape.h:409
shape3::max
unsigned max() const
Get the maximal number in all the dimensions.
Definition: shape.h:764
shape3::box
vec3d box(double dx) const
Get the world coordinate size of the shape.
Definition: shape.h:667
shape3::find_cell
vec3i find_cell(const vec3d &p) const
Find the nearest cell position from the input fractional position.
Definition: shape.h:721
shape3::clamp
vec3i clamp(const vec3i &pi) const
Get the new constrained position within the index space of this shape.
Definition: shape.h:777
shape3::operator<
bool operator<(const shape2 &rhs) const
Compare the hash from the input shape.
Definition: shape.h:676
shape3::out_of_bounds
bool out_of_bounds(const vec3i &pi) const
Get if the position is outside of the index space of this shape.
Definition: shape.h:822
shape3::operator[]
unsigned operator[](unsigned idx) const
Get the number of a specified dimensional of this shape.
Definition: shape.h:526
shape2::operator==
bool operator==(const shape2 &shape) const
Get if this shape is equal to the input shape.
Definition: shape.h:70
shape2
Structure that defines shape such as width, height.
Definition: shape.h:42
SHKZ_END_NAMESPACE
#define SHKZ_END_NAMESPACE
Name space end definition for shiokaze.
Definition: common.h:44
shape2::clamp
vec2i clamp(const vec2i &pi) const
Get the new constrained position within the index space of this shape.
Definition: shape.h:311
shape2::on_edge
bool on_edge(int i, int j) const
Get if the position lies on the edge of the index space of this shape.
Definition: shape.h:365
shape3::shape3
shape3(unsigned w, unsigned h, unsigned d)
Constructor for shape2.
Definition: shape.h:496
shape2::operator*=
void operator*=(double v)
Scale this shape by the input number.
Definition: shape.h:164
shape2::operator+
shape2 operator+(const shape2 &rhs) const
Get an expanded shape by the input shape.
Definition: shape.h:113
shape3::nodal
shape3 nodal() const
Get the shape for the nodal defined grid from this shape.
Definition: shape.h:700
shape3::operator*
shape3 operator*(double s) const
Get a scaled shape by the input number.
Definition: shape.h:597
shape2::for_each
void for_each(std::function< void(int i, int j)> func) const
Perform a two dimensional serial loop operation.
Definition: shape.h:441