Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Rocsurf.h
Go to the documentation of this file.
1 /* *******************************************************************
2  * Rocstar Simulation Suite *
3  * Copyright@2015, Illinois Rocstar LLC. All rights reserved. *
4  * *
5  * Illinois Rocstar LLC *
6  * Champaign, IL *
7  * www.illinoisrocstar.com *
8  * sales@illinoisrocstar.com *
9  * *
10  * License: See LICENSE file in top level of distribution package or *
11  * http://opensource.org/licenses/NCSA *
12  *********************************************************************/
13 /* *******************************************************************
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
15  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
16  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
17  * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
20  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
21  * USE OR OTHER DEALINGS WITH THE SOFTWARE. *
22  *********************************************************************/
23 // $Id: Rocsurf.h,v 1.12 2008/12/06 08:43:23 mtcampbe Exp $
24 
27 /*
28  * Las Modified: Dec. 13, 2002
29  */
30 
31 #ifndef __ROCSURF_H_
32 #define __ROCSURF_H_
33 
34 #include "surfbasic.h"
35 #include "roccom_devel.h"
36 
38 
39 class Window_manifold_2;
40 
41 class Rocsurf : public COM_Object {
42 public:
43  // protected:
44  Rocsurf() : _wm(NULL), _cookie(SURF_COOKIE) {}
45  virtual ~Rocsurf();
46 
48  static void load( const std::string &mname);
50  static void unload( const std::string &mname);
51 
53  static void interpolate_to_centers( const COM::Attribute *x,
54  COM::Attribute *z);
55 
58  static void integrate( const COM::Attribute *x, double *z);
59 
64  static void compute_element_areas( COM::Attribute *areas,
65  const COM::Attribute *pnts=NULL);
66 
70  static void compute_element_normals( COM::Attribute *nrm,
71  const int *to_normalize=NULL,
72  const COM::Attribute *pnts=NULL);
73 
85  static void compute_bounded_volumes( const COM::Attribute *old_location,
86  const COM::Attribute *new_location,
87  COM::Attribute *volumes,
88  void *flag=NULL);
89 
99  static void compute_swept_volumes( const COM::Attribute *location,
100  const COM::Attribute *disps,
101  COM::Attribute *volumes,
102  void *flag=NULL);
103 
106  static void compute_center( const COM::Attribute *mesh,
107  Vector_3<double> &cnt);
108 
111  static void compute_signed_volumes( const COM::Attribute *mesh,
112  double *vol);
113 
115  virtual Window_manifold_2 *manifold() { return _wm; }
116 
120  void initialize( const COM::Attribute *pmesh);
121 
123  void compute_normals( const COM::Attribute *mesh,
124  COM::Attribute *nrm,
125  const int *scheme=NULL);
126 
128  void compute_mcn( COM::Attribute *mcn, COM::Attribute *lbmcn);
129 
131  void serialize_mesh( const COM::Attribute *inmesh, COM::Attribute *outmesh);
132 
134  void compute_edge_lengths( double *lave, double *lmin, double *lmax);
135 
137  void elements_to_nodes( const COM::Attribute *elem_vals,
138  COM::Attribute *nodal_vals,
139  const COM::Attribute *mesh=NULL,
140  const int *scheme=NULL,
141  const COM::Attribute *elem_weights=NULL,
142  COM::Attribute *nodal_weights=NULL);
143 
144 protected:
145 
146  template <class T>
147  static void normalize( T *a, int size) throw(int) {
148  T tmp(0);
149  for (int i=0; i<size; ++i) tmp += a[i]*a[i];
150 
151  if ( tmp == 0) return;
152  tmp = std::sqrt(tmp);
153  for (int i=0; i<size; ++i) a[i] /= tmp;
154  }
155 
156  int validate_object() const {
157  if ( _cookie != SURF_COOKIE) return -1;
158  else return COM_Object::validate_object();
159  }
160 
161 protected:
162  enum { SURF_COOKIE=7627873};
164  static const int scheme_vals[];
165  int _cookie;
166 };
167 
169 
170 #endif
171 
172 
173 
174 
175 
176 
This class implements a data structure for 2-manifold over a whole window, which can be composed of m...
Definition: Manifold_2.h:185
static const int scheme_vals[]
Definition: Rocsurf.h:164
Window_manifold_2 * _wm
Definition: Rocsurf.h:163
void elements_to_nodes(const COM::Attribute *elem_vals, COM::Attribute *nodal_vals, const COM::Attribute *mesh=NULL, const int *scheme=NULL, const COM::Attribute *elem_weights=NULL, COM::Attribute *nodal_weights=NULL)
Computes nodal or elemental normals of a given window.
Definition: Rocsurf.C:72
static void normalize(T *a, int size)
Definition: Rocsurf.h:147
int _cookie
Definition: Rocsurf.h:165
Rocsurf()
Definition: Rocsurf.h:44
#define SURF_END_NAMESPACE
Definition: surfbasic.h:29
static void load(const std::string &mname)
Loads Rocsurf onto Roccom with a given module name.
Definition: Rocsurf.C:139
double sqrt(double d)
Definition: double.h:73
static void compute_bounded_volumes(const COM::Attribute *old_location, const COM::Attribute *new_location, COM::Attribute *volumes, void *flag=NULL)
Computes the volume bounded between two different locations of each face of the surface mesh of windo...
static void compute_signed_volumes(const COM::Attribute *mesh, double *vol)
Computes the signed volume of a body.
virtual ~Rocsurf()
Definition: Rocsurf.C:33
static const int scheme
#define SURF_BEGIN_NAMESPACE
Definition: surfbasic.h:28
void initialize(const COM::Attribute *pmesh)
Constructs the communication patterns of a distributed mesh.
Definition: Rocsurf.C:35
void compute_mcn(COM::Attribute *mcn, COM::Attribute *lbmcn)
Computes nodal or elemental normals of a given window.
Definition: Rocsurf.C:63
void int int int REAL REAL REAL * z
Definition: write.cpp:76
static void interpolate_to_centers(const COM::Attribute *x, COM::Attribute *z)
Interpolates nodal coordinates to element centers.
void serialize_mesh(const COM::Attribute *inmesh, COM::Attribute *outmesh)
Serialize the mesh of a given window.
Definition: Rocsurf.C:128
blockLoc i
Definition: read.cpp:79
void int int REAL * x
Definition: read.cpp:74
void compute_normals(const COM::Attribute *mesh, COM::Attribute *nrm, const int *scheme=NULL)
Computes nodal or elemental normals of a given window.
Definition: Rocsurf.C:49
static void integrate(const COM::Attribute *x, double *z)
Integrate a function given by an elemental attribute over surface z is an array of size equal to numb...
static void compute_element_normals(COM::Attribute *nrm, const int *to_normalize=NULL, const COM::Attribute *pnts=NULL)
Computes elemental normals of a given window.
static void compute_center(const COM::Attribute *mesh, Vector_3< double > &cnt)
Computes the center of a body.
static void compute_swept_volumes(const COM::Attribute *location, const COM::Attribute *disps, COM::Attribute *volumes, void *flag=NULL)
Computes the swept volume by a given displacement of each face of the surface mesh of window volumes-...
int validate_object() const
Definition: Rocsurf.h:156
void compute_edge_lengths(double *lave, double *lmin, double *lmax)
Computes edge lengths of a given window.
Definition: Rocsurf.C:87
static void unload(const std::string &mname)
Unloads Rocsurf from Roccom.
Definition: Rocsurf.C:219
static void compute_element_areas(COM::Attribute *areas, const COM::Attribute *pnts=NULL)
Computes the area of each face of the surface mesh of window areas-&gt;window and saves the results in a...
virtual Window_manifold_2 * manifold()
Obtain a reference to the manifold.
Definition: Rocsurf.h:115