Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Rocsurf Class Reference

#include <Rocsurf.h>

Inheritance diagram for Rocsurf:
Collaboration diagram for Rocsurf:

Public Member Functions

 Rocsurf ()
 
virtual ~Rocsurf ()
 
virtual Window_manifold_2manifold ()
 Obtain a reference to the manifold. More...
 
void initialize (const COM::Attribute *pmesh)
 Constructs the communication patterns of a distributed mesh. More...
 
void compute_normals (const COM::Attribute *mesh, COM::Attribute *nrm, const int *scheme=NULL)
 Computes nodal or elemental normals of a given window. More...
 
void compute_mcn (COM::Attribute *mcn, COM::Attribute *lbmcn)
 Computes nodal or elemental normals of a given window. More...
 
void serialize_mesh (const COM::Attribute *inmesh, COM::Attribute *outmesh)
 Serialize the mesh of a given window. More...
 
void compute_edge_lengths (double *lave, double *lmin, double *lmax)
 Computes edge lengths of a given window. More...
 
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. More...
 

Static Public Member Functions

static void load (const std::string &mname)
 Loads Rocsurf onto Roccom with a given module name. More...
 
static void unload (const std::string &mname)
 Unloads Rocsurf from Roccom. More...
 
static void interpolate_to_centers (const COM::Attribute *x, COM::Attribute *z)
 Interpolates nodal coordinates to element centers. More...
 
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 number of components of x. More...
 
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->window and saves the results in attribute areas. More...
 
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. More...
 
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 window volumes->window. More...
 
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->window. More...
 
static void compute_center (const COM::Attribute *mesh, Vector_3< double > &cnt)
 Computes the center of a body. More...
 
static void compute_signed_volumes (const COM::Attribute *mesh, double *vol)
 Computes the signed volume of a body. More...
 

Protected Types

enum  { SURF_COOKIE =7627873 }
 

Protected Member Functions

int validate_object () const
 

Static Protected Member Functions

template<class T >
static void normalize (T *a, int size) throw (int)
 

Protected Attributes

Window_manifold_2_wm
 
int _cookie
 

Static Protected Attributes

static const int scheme_vals [] = {E2N_USER, E2N_ONE, E2N_AREA, E2N_ANGLE}
 

Detailed Description

Definition at line 41 of file Rocsurf.h.

Member Enumeration Documentation

anonymous enum
protected
Enumerator
SURF_COOKIE 

Definition at line 162 of file Rocsurf.h.

162 { SURF_COOKIE=7627873};

Constructor & Destructor Documentation

Rocsurf ( )
inline

Definition at line 44 of file Rocsurf.h.

Referenced by load().

44 : _wm(NULL), _cookie(SURF_COOKIE) {}
Window_manifold_2 * _wm
Definition: Rocsurf.h:163
int _cookie
Definition: Rocsurf.h:165

Here is the caller graph for this function:

~Rocsurf ( )
virtual

Definition at line 33 of file Rocsurf.C.

References _wm.

33 { if (_wm) delete _wm; }
Window_manifold_2 * _wm
Definition: Rocsurf.h:163

Member Function Documentation

void compute_bounded_volumes ( const COM::Attribute *  old_location,
const COM::Attribute *  new_location,
COM::Attribute *  volumes,
void *  flag = NULL 
)
static

Computes the volume bounded between two different locations of each face of the surface mesh of window volumes->window.

Typically, the two locations of the surface correspond to the surface at two different snapshots of a simulation.

Parameters
old_locationstores the old nodal coordinates.
new_locationstores the new nodal coordinates.
volumesstores the bounded volume for each element.
Ifflag is present, then only compute volume for elements whose corresponding value of the volume attribute was set to nonzero value.

Definition at line 108 of file compute_bounded_volumes.C.

References arrange(), get_face_volume(), i, j, Element_node_enumerator::next(), normalize_coor(), Element_node_vectors_k_const< Value >::set(), Element_node_enumerator::size_of_edges(), and volume().

Referenced by load().

111  {
112 
113  assert( element_volume != NULL && element_volume ->size_of_components() == 1);
114  assert( element_volume->window() == old_location->window());
115  assert( element_volume->window() == new_location->window());
116 
117  std::vector< COM:: Pane*> panes;
118  element_volume->window() -> panes( panes);
119 
120  Point_3<Real> ps_face4[4];
121  Point_3<Real> ps_face3[3];
122  Point_3<Real> ps[8];
123 
124  // ps is used as a container for both the old and new coordinates
125  // the following ordering convention is used:
126  // the coordinates of the new surface occupy indexes 0 to 3
127  // the coordinates of the old surface occupy indexes 4 to 7
128  // both surfaces have coordinates listed in the same order
129  // i.e. ps[0] and ps[4] are new and old coordinates for the same node
130  // under these conventions, ps[3] and ps[7] are not used for triangular faces
131 
132  std::vector< COM::Pane*>::const_iterator it = panes.begin();
133  // Loop through the elements of the pane.
134  for (int i=0, local_npanes = panes.size(); i<local_npanes; ++i, ++it){
135  const COM::Pane &pane = **it;
136  Real *ptr_ev = (Real *)(pane.attribute( element_volume->id())->pointer());
137  const Point_3<Real> *ptr_new =
138  (const Point_3<Real>*)(pane.attribute( new_location->id())->pointer());
139  const Point_3<Real> *ptr_old =
140  (const Point_3<Real>*)(pane.attribute( old_location->id())->pointer());
141 
143 
144  Element_node_enumerator ene( &pane, 1);
145  for ( int j=pane.size_of_elements(); j>0; --j, ene.next(), ++ptr_ev) {
146  if ( flag!=NULL && *ptr_ev==0.) continue;
147 
148  Real volume = 0;
149  // if mesh is triangular, we have two triangular faces, 3 quadrilaterals
150  ps_new.set( ptr_new, ene, 1);
151  ps_old.set( ptr_old, ene, 1);
152 
153  ps[0]=ps_new[0];ps[1]=ps_new[1];ps[2]=ps_new[2];
154  ps[4]=ps_old[0];ps[5]=ps_old[1];ps[6]=ps_old[2];
155 
156  if (ene.size_of_edges()==3) {
157 
158  if ( ps[0]==ps[4] && ps[1]==ps[5] && ps[2]==ps[6])
159  { *ptr_ev = 0.; continue; }
160  ps[3] = Point_3<Real>(0,0,0);
161  normalize_coor( ps, 7, 6);
162 
163  // solid has two triangular faces
164  arrange(ps_face3,ps,0,2,1);
165  volume += get_face_volume(ps_face3, 3);
166  arrange(ps_face3,ps,4,5,6);
167  volume += get_face_volume(ps_face3, 3);
168  // quadrilateral faces
169  arrange(ps_face4,ps,0,4,6,2);
170  volume += get_face_volume(ps_face4, 4);
171  }
172  else{ // if not triangular, mesh is quadrilateral
173  ps[3]=ps_new[3]; ps[7]=ps_old[3];
174  if ( ps[0]==ps[4] && ps[1]==ps[5] && ps[2]==ps[6] && ps[3]==ps[7])
175  { *ptr_ev = 0.; continue; }
176  normalize_coor( ps, 8, 8);
177 
178  arrange(ps_face4,ps,0,3,2,1);
179  volume += get_face_volume(ps_face4, 4);
180  arrange(ps_face4,ps,4,5,6,7);
181  volume += get_face_volume(ps_face4, 4);
182  arrange(ps_face4,ps,3,7,6,2);
183  volume += get_face_volume(ps_face4, 4);
184  arrange(ps_face4,ps,0,4,7,3);
185  volume += get_face_volume(ps_face4, 4);
186  }
187  // Two quarilateral faces are the same in either case
188  arrange(ps_face4,ps,1,2,6,5);
189  volume += get_face_volume(ps_face4, 4);
190  arrange(ps_face4,ps,0,1,5,4);
191  volume += get_face_volume(ps_face4, 4);
192 
193  volume /= 3.;
194  *ptr_ev = -volume;
195  }
196  }
197 }
An adaptor for enumerating node IDs of an element.
void normalize_coor(Point_3< Real > ps_face[], int n, int k)
double Real
Definition: mapbasic.h:322
This is a helper class for accessing nodal data.
int volume(const block *b)
Definition: split.cpp:181
blockLoc i
Definition: read.cpp:79
SURF_BEGIN_NAMESPACE void arrange(Point_3< Real > ps_face[4], Point_3< Real > ps[8], int ind1, int ind2, int ind3, int ind4)
Real get_face_volume(Point_3< Real > ps_face[], int ne)
j indices j
Definition: Indexing.h:6
void set(const Value *p, Element_node_enumerator &ene, int strd)
initialize the accessor with a pointer and a specific stride.

Here is the call graph for this function:

Here is the caller graph for this function:

void compute_center ( const COM::Attribute *  mesh,
Vector_3< double > &  cnt 
)
static

Computes the center of a body.

Definition at line 291 of file compute_bounded_volumes.C.

References COM_NC, COMMPI_Initialized(), i, j, and MPI_SUM.

Referenced by compute_signed_volumes().

292  {
293  std::vector< const COM:: Pane*> panes;
294  mesh->window() -> panes( panes);
295 
296  struct Accumulator {
297  Accumulator() : cnt(Vector_3<Real>(0,0,0)), count(0) {}
298 
299  Vector_3<Real> cnt;
300  double count;
301  };
302  Accumulator global;
303 
304  std::vector< const COM::Pane*>::const_iterator it = panes.begin();
305  // Loop through the elements of the pane.
306  for (int i=0, local_npanes = panes.size(); i<local_npanes; ++i, ++it){
307  const COM::Pane &pane = **it;
308  const Vector_3<Real> *ptr =
309  (const Vector_3<Real>*)(pane.attribute( COM::COM_NC)->pointer());
310 
311  for ( int j=pane.size_of_real_nodes(); j>0; --j, ++ptr) {
312  global.cnt += *ptr;
313  global.count += 1.;
314  }
315  }
316 
317  // Perform reduction on cnt and count
318  Accumulator local=global;
319 
320  if ( COMMPI_Initialized()) {
321  MPI_Allreduce( &local.cnt[0], &global.cnt[0], 4, MPI_DOUBLE, MPI_SUM,
322  mesh->window()->get_communicator());
323  }
324  cnt = global.cnt/global.count;
325 }
double Real
Definition: mapbasic.h:322
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6
Some basic geometric data types.
Definition: mapbasic.h:54
int COMMPI_Initialized()
Definition: commpi.h:168
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_SUM

Here is the call graph for this function:

Here is the caller graph for this function:

void compute_edge_lengths ( double *  lave,
double *  lmin,
double *  lmax 
)

Computes edge lengths of a given window.

Definition at line 87 of file Rocsurf.C.

References _wm, ACROSS_PANE, COMMPI_Initialized(), i, iend, Halfedge::is_border(), max(), min(), MPI_MAX, MPI_MIN, MPI_SUM, Halfedge::next(), Vector_3< Type >::norm(), Halfedge::opposite(), Window_manifold_2::pm_begin(), Window_manifold_2::pm_end(), Halfedge::tangent(), and Window_manifold_2::window().

Referenced by load(), and Rocprop::load().

87  {
88 
90 
91  double local_lmin=HUGE_VAL, local_lmax=0, local_lsum=0, local_weights=0;
92 
93  // Loop through the panes to identify strong edges
94  for ( ; it!=iend; ++it) {
95  for (int i=0, nf=it->size_of_real_faces(); i<nf; ++i) {
96  Halfedge h=Halfedge( &*it, Edge_ID( i+1, 0), ACROSS_PANE), h0=h;
97  do {
98  Halfedge hopp=h.opposite();
99 
100  if ( hopp.is_border() || h < hopp) {
101  double l = h.tangent().norm();
102 
103  local_lmin = std::min( local_lmin, l);
104  local_lmax = std::max( local_lmax, l);
105  local_lsum += l;
106  local_weights += 1;
107  }
108  } while ( (h=h.next())!=h0);
109  }
110  }
111 
112  double global_lmin=local_lmin, global_lmax=local_lmax,
113  global_lsum=local_lsum, global_weighs=local_weights;
114 
115  if ( COMMPI_Initialized()) {
116  MPI_Comm comm = _wm->window()->get_communicator();
117  MPI_Allreduce( &local_lmin, &global_lmin, 1, MPI_DOUBLE, MPI_MIN, comm);
118  MPI_Allreduce( &local_lmax, &global_lmax, 1, MPI_DOUBLE, MPI_MAX, comm);
119  MPI_Allreduce( &local_lsum, &global_lsum, 1, MPI_DOUBLE, MPI_SUM, comm);
120  MPI_Allreduce( &local_weights, &global_weighs, 1, MPI_DOUBLE, MPI_SUM, comm);
121  }
122 
123  if ( lave) *lave = (global_weighs>0)? (global_lsum / global_weighs) : 0.;
124  if ( lmin) *lmin = global_lmin;
125  if ( lmax) *lmax = global_lmax;
126 }
Window_manifold_2 * _wm
Definition: Rocsurf.h:163
PM_iterator pm_begin()
Obtain an iterator to the first pane manifold of the window.
Definition: Manifold_2.h:223
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_MAX
MAP::Facet_ID Edge_ID
Definition: Manifold_2.h:49
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
Halfedge opposite() const
Get the ID of the opposite edge of a given edge.
Definition: Manifold_2.h:454
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_MIN
This class encapsulate a halfedge over a window manifold.
Definition: Manifold_2.h:446
Halfedge next() const
Get the next halfedge of its owner element.
Definition: Manifold_2.h:465
std::vector< Pane_manifold_2 >::iterator PM_iterator
Definition: Manifold_2.h:187
Vector_3< Real > tangent() const
Get the tangent of the given halfedge.
Definition: Manifold_2.h:484
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE knode iend
blockLoc i
Definition: read.cpp:79
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:346
bool is_border() const
Is the edge a border edge?
Definition: Manifold_2.h:476
COM::Window * window()
Obtain the underlying window object.
Definition: Manifold_2.h:203
int COMMPI_Initialized()
Definition: commpi.h:168
PM_iterator pm_end()
Obtain an iterator to the past-the-last pane manifold of the window.
Definition: Manifold_2.h:227
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_SUM
Type norm() const
Definition: mapbasic.h:112

Here is the call graph for this function:

Here is the caller graph for this function:

SURF_BEGIN_NAMESPACE void compute_element_areas ( COM::Attribute *  areas,
const COM::Attribute *  pnts = NULL 
)
static

Computes the area of each face of the surface mesh of window areas->window and saves the results in attribute areas.

If pnts is present, then use it in place of the nodal coordinates

Definition at line 41 of file compute_element_areas.C.

References COM_assertion, COM_assertion_msg, COM_compatible_types(), COM_DOUBLE, COM_NC, i, j, k, Element_node_enumerator::next(), Element_node_vectors_k_const< Value >::set(), Element_node_enumerator::size_of_edges(), and Element_node_enumerator::size_of_nodes().

Referenced by load().

42  {
43  COM_assertion_msg( element_areas && element_areas->is_elemental(),
44  "Argument must be elemental attribute");
45  COM_assertion_msg( element_areas->size_of_components()== 1 &&
46  COM_compatible_types(element_areas->data_type(), COM_DOUBLE),
47  "Argument must be double-precision scalars");
48 
49  std::vector< COM:: Pane*> panes;
50  element_areas->window() -> panes( panes);
52  Vector_2<Real> nc(0,0);
53 
54  std::vector< COM::Pane*>::const_iterator it = panes.begin();
55 
56  for (int i=0, local_npanes = panes.size(); i<local_npanes; ++i, ++it){
57  COM::Pane &pane = **it;
58 
59  const COM::Attribute *nc_pane = (pnts==NULL)?pane.attribute( COM::COM_NC):
60  pane.attribute( pnts->id());
61  COM::Attribute *a_pane = pane.attribute( element_areas->id());
62  COM_assertion( pane.size_of_elements()==0 ||
63  nc_pane->stride()==3 && a_pane->stride()==1);
64 
65  const Point_3<Real> *pnts = (const Point_3<Real>*)(nc_pane->pointer());
66  Real *ptr = (Real *)(a_pane->pointer());
67 
68  // Loop through elements of the pane
69  Element_node_enumerator ene( &pane, 1);
70  for ( int j=pane.size_of_elements(); j>0; --j, ene.next(),++ptr) {
71  Generic_element_2 e(ene.size_of_edges(), ene.size_of_nodes());
72  ps.set( pnts, ene, 1);
73  int size = e.get_num_gp();
74  Real this_area = 0;
75 
76  for (int k = 0; k<size; k++){
77  Real weight = e.get_gp_weight( k);
78  e.get_gp_nat_coor(k, nc);
79  Real jacobi_det = e.Jacobian_det(ps,nc);
80  this_area += weight * jacobi_det;
81  }
82  *ptr = this_area;
83  }
84  }
85 }
#define COM_assertion(EX)
Error checking utility similar to the assert macro of the C language.
An adaptor for enumerating node IDs of an element.
j indices k indices k
Definition: Indexing.h:6
#define COM_assertion_msg(EX, msg)
Encapsulation of the element-wise computations for two-dimensional elements.
double Real
Definition: mapbasic.h:322
This is a helper class for accessing nodal data.
int COM_compatible_types(COM_Type type1, COM_Type type2)
Definition: roccom_c++.h:563
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6
void set(const Value *p, Element_node_enumerator &ene, int strd)
initialize the accessor with a pointer and a specific stride.

Here is the call graph for this function:

Here is the caller graph for this function:

SURF_BEGIN_NAMESPACE void compute_element_normals ( COM::Attribute *  nrm,
const int *  to_normalize = NULL,
const COM::Attribute *  pnts = NULL 
)
static

Computes elemental normals of a given window.

Normalize the normals if to_normalize is NULL (default) or its value is nonzero. If pnts is present, then use it in place of the nodal coordinates

Definition at line 32 of file compute_element_normals.C.

References COM_assertion, COM_NC, Vector_3< Type >::cross_product(), i, j, Element_node_enumerator::next(), Vector_3< Type >::normalize(), Element_node_vectors_k_const< Value >::set(), Element_node_enumerator::size_of_edges(), and Element_node_enumerator::size_of_nodes().

Referenced by Window_manifold_2::compute_nodal_normals(), Window_manifold_2::compute_normals(), and load().

34  {
35 
36  assert( elem_nrmls != NULL && elem_nrmls ->size_of_components() == 3);
37 
38  std::vector< COM:: Pane*> panes;
39  elem_nrmls->window() -> panes( panes);
41 
42  Vector_2<Real> nc(0.5,0.5);
43  Vector_3<Real> J[2];
44 
45  std::vector< COM::Pane*>::const_iterator it = panes.begin();
46 
47  for (int i=0, local_npanes = panes.size(); i<local_npanes; ++i, ++it){
48  const COM::Pane &pane = **it;
49 
50  const COM::Attribute *nc_pane = (pnts==NULL)?pane.attribute( COM::COM_NC):
51  pane.attribute( pnts->id());
52  COM_assertion( pane.size_of_elements()==0 || nc_pane->stride()==3);
53 
54  const Point_3<Real> *pnts = (const Point_3<Real>*)(nc_pane->pointer());
56  (pane.attribute( elem_nrmls->id())->pointer());
57 
58  // Loop through elements of the pane
59  Element_node_enumerator ene( &pane, 1);
60 
61  for ( int j=pane.size_of_elements(); j>0; --j, ene.next(),++ptr) {
62  Generic_element_2 e(ene.size_of_edges(), ene.size_of_nodes());
63  ps.set( pnts, ene, 1);
64 
65  e.Jacobian( ps, nc, J);
66  *ptr = Vector_3<Real>::cross_product( J[0], J[1]);
67  if ( to_normalize==NULL || *to_normalize)
68  ptr->normalize();
69  else if ( e.size_of_edges()==3) // If triangle, reduce by half.
70  (*ptr) *= 0.5;
71  }
72  }
73 }
#define COM_assertion(EX)
Error checking utility similar to the assert macro of the C language.
An adaptor for enumerating node IDs of an element.
Encapsulation of the element-wise computations for two-dimensional elements.
Vector_3 & normalize()
Definition: mapbasic.h:114
This is a helper class for accessing nodal data.
blockLoc i
Definition: read.cpp:79
static Vector_3 cross_product(const Vector_3 &v, const Vector_3 &w)
Definition: mapbasic.h:104
j indices j
Definition: Indexing.h:6
void set(const Value *p, Element_node_enumerator &ene, int strd)
initialize the accessor with a pointer and a specific stride.

Here is the call graph for this function:

Here is the caller graph for this function:

void compute_mcn ( COM::Attribute *  mcn,
COM::Attribute *  lbmcn 
)

Computes nodal or elemental normals of a given window.

Definition at line 63 of file Rocsurf.C.

References _wm, COM_assertion_msg, Window_manifold_2::compute_mcn(), and validate_object().

Referenced by load().

64  {
65  COM_assertion_msg( validate_object()==0, "Invalid object");
66 
67  COM_assertion_msg( _wm, "initialization must be called first before calling compute_mcn");
68 
69  _wm->compute_mcn( mcn, lbmcn);
70 }
Window_manifold_2 * _wm
Definition: Rocsurf.h:163
#define COM_assertion_msg(EX, msg)
void compute_mcn(COM::Attribute *mcn_in, COM::Attribute *lbmcn_in)
int validate_object() const
Definition: Rocsurf.h:156

Here is the call graph for this function:

Here is the caller graph for this function:

void compute_normals ( const COM::Attribute *  mesh,
COM::Attribute *  nrm,
const int *  scheme = NULL 
)

Computes nodal or elemental normals of a given window.

Definition at line 49 of file Rocsurf.C.

References _wm, COM_assertion_msg, Window_manifold_2::compute_normals(), initialize(), and validate_object().

Referenced by load().

51  {
52  COM_assertion_msg( validate_object()==0, "Invalid object");
53 
54  if ( _wm == NULL) initialize( mesh);
55 
56  if ( scheme)
57  _wm->compute_normals( nrm, *scheme);
58  else
59  _wm->compute_normals( nrm);
60 }
Window_manifold_2 * _wm
Definition: Rocsurf.h:163
#define COM_assertion_msg(EX, msg)
static const int scheme
void initialize(const COM::Attribute *pmesh)
Constructs the communication patterns of a distributed mesh.
Definition: Rocsurf.C:35
void compute_normals(COM::Attribute *normals, int scheme=E2N_ANGLE, bool to_normalize=true)
Compute the normals at nodes or faces, depending on the type of the attribute normals.
Definition: Manifold_2.C:1045
int validate_object() const
Definition: Rocsurf.h:156

Here is the call graph for this function:

Here is the caller graph for this function:

void compute_signed_volumes ( const COM::Attribute *  mesh,
double *  vol 
)
static

Computes the signed volume of a body.

Definition at line 329 of file compute_bounded_volumes.C.

References COM_NC, compute_center(), get_face_volume(), i, j, Element_node_enumerator::next(), Element_node_vectors_k_const< Value >::set(), and Element_node_enumerator::size_of_edges().

Referenced by load().

329  {
330  std::vector< const COM:: Pane*> panes;
331  mesh->window() -> panes( panes);
332 
333  Vector_3<Real> cnt;
334  // First, obtain the center
335  compute_center( mesh, cnt);
336 
337  Point_3<Real> normalized_face[4];
338 
339  *vol = 0;
340  std::vector< const COM::Pane*>::const_iterator it = panes.begin();
341  // Loop through the elements of the pane.
342  for (int i=0, local_npanes = panes.size(); i<local_npanes; ++i, ++it){
343  const COM::Pane &pane = **it;
344  const Point_3<Real> *ptr =
345  (const Point_3<Real>*)(pane.attribute( COM::COM_NC)->pointer());
346 
348 
349  Element_node_enumerator ene( &pane, 1);
350  for ( int j=pane.size_of_elements(); j>0; --j, ene.next()) {
351  ps.set( ptr, ene, 1);
352 
353  normalized_face[0]=ps[0]-cnt;
354  normalized_face[1]=ps[1]-cnt;
355  normalized_face[2]=ps[2]-cnt;
356 
357  if (ene.size_of_edges()==3) {
358  *vol += get_face_volume(normalized_face, 3);
359  }
360  else{ // if not triangular, element is quadrilateral
361  normalized_face[3]=ps[3]-cnt;
362  *vol += get_face_volume(normalized_face, 4);
363  }
364  }
365  }
366 
367  // Divide the signed volume by 3.
368  *vol /= 3.;
369 }
An adaptor for enumerating node IDs of an element.
This is a helper class for accessing nodal data.
blockLoc i
Definition: read.cpp:79
Real get_face_volume(Point_3< Real > ps_face[], int ne)
j indices j
Definition: Indexing.h:6
static void compute_center(const COM::Attribute *mesh, Vector_3< double > &cnt)
Computes the center of a body.
void set(const Value *p, Element_node_enumerator &ene, int strd)
initialize the accessor with a pointer and a specific stride.

Here is the call graph for this function:

Here is the caller graph for this function:

void compute_swept_volumes ( const COM::Attribute *  location,
const COM::Attribute *  disps,
COM::Attribute *  volumes,
void *  flag = NULL 
)
static

Computes the swept volume by a given displacement of each face of the surface mesh of window volumes->window.

Parameters
old_locationstores the nodal coordinates.
dispsstores the nodal displacement.
volumesstores the swept volume for each element.
Ifflag is present, then only compute volume for elements whose corresponding value of the volume attribute was set to nonzero value.

Definition at line 199 of file compute_bounded_volumes.C.

References arrange(), get_face_volume(), i, j, Element_node_enumerator::next(), normalize_coor(), Element_node_vectors_k_const< Value >::set(), Element_node_enumerator::size_of_edges(), and volume().

Referenced by load().

202  {
203 
204  assert( element_volume != NULL && element_volume ->size_of_components() == 1);
205  assert( element_volume->window() == location->window());
206  assert( element_volume->window() == disps->window());
207 
208  std::vector< COM:: Pane*> panes;
209  element_volume->window() -> panes( panes);
210 
211  Point_3<Real> ps_face4[4];
212  Point_3<Real> ps_face3[3];
213  Point_3<Real> ps[8];
214 
215  // ps is used as a container for both the old and new coordinates
216  // the following ordering convention is used:
217  // the coordinates of the new surface occupy indexes 0 to 3
218  // the coordinates of the old surface occupy indexes 4 to 7
219  // both surfaces have coordinates listed in the same order
220  // i.e. ps[0] and ps[4] are new and old coordinates for the same node
221  // under these conventions, ps[3] and ps[7] are not used for triangular faces
222 
223  std::vector< COM::Pane*>::const_iterator it = panes.begin();
224  // Loop through the elements of the pane.
225  for (int i=0, local_npanes = panes.size(); i<local_npanes; ++i, ++it){
226  const COM::Pane &pane = **it;
227  Real *ptr_ev = (Real *)(pane.attribute( element_volume->id())->pointer());
228  const Point_3<Real> *ptr_pos =
229  (const Point_3<Real>*)(pane.attribute( location->id())->pointer());
230  const Vector_3<Real> *ptr_disp =
231  (const Vector_3<Real>*)(pane.attribute( disps->id())->pointer());
232 
235 
236  Element_node_enumerator ene( &pane, 1);
237  for ( int j=pane.size_of_elements(); j>0; --j, ene.next(), ++ptr_ev) {
238  if ( flag!=NULL && *ptr_ev==0.) continue;
239 
240  Real volume = 0;
241  // if mesh is triangular, we have two triangular faces, 3 quadrilaterals
242  ds.set( ptr_disp, ene, 1);
243  pnts.set( ptr_pos, ene, 1);
244 
245  ps[0]=pnts[0]+ds[0];ps[1]=pnts[1]+ds[1];ps[2]=pnts[2]+ds[2];
246  ps[4]=pnts[0];ps[5]=pnts[1];ps[6]=pnts[2];
247 
248  if (ene.size_of_edges()==3) {
249 
250  if ( ps[0]==ps[4] && ps[1]==ps[5] && ps[2]==ps[6])
251  { *ptr_ev = 0.; continue; }
252  ps[3] = Point_3<Real>(0,0,0);
253  normalize_coor( ps, 7, 6);
254 
255  // solid has two triangular faces
256  arrange(ps_face3,ps,0,2,1);
257  volume += get_face_volume(ps_face3, 3);
258  arrange(ps_face3,ps,4,5,6);
259  volume += get_face_volume(ps_face3, 3);
260  // quadrilateral faces
261  arrange(ps_face4,ps,0,4,6,2);
262  volume += get_face_volume(ps_face4, 4);
263  }
264  else{ // if not triangular, mesh is quadrilateral
265  ps[3]=pnts[3]+ds[3]; ps[7]=pnts[3];
266  if ( ps[0]==ps[4] && ps[1]==ps[5] && ps[2]==ps[6] && ps[3]==ps[7])
267  { *ptr_ev = 0.; continue; }
268  normalize_coor( ps, 8, 8);
269 
270  arrange(ps_face4,ps,0,3,2,1);
271  volume += get_face_volume(ps_face4, 4);
272  arrange(ps_face4,ps,4,5,6,7);
273  volume += get_face_volume(ps_face4, 4);
274  arrange(ps_face4,ps,3,7,6,2);
275  volume += get_face_volume(ps_face4, 4);
276  arrange(ps_face4,ps,0,4,7,3);
277  volume += get_face_volume(ps_face4, 4);
278  }
279  // Two quarilateral faces are the same in either case
280  arrange(ps_face4,ps,1,2,6,5);
281  volume += get_face_volume(ps_face4, 4);
282  arrange(ps_face4,ps,0,1,5,4);
283  volume += get_face_volume(ps_face4, 4);
284 
285  volume /= 3.;
286  *ptr_ev = -volume;
287  }
288  }
289 }
An adaptor for enumerating node IDs of an element.
void normalize_coor(Point_3< Real > ps_face[], int n, int k)
double Real
Definition: mapbasic.h:322
This is a helper class for accessing nodal data.
int volume(const block *b)
Definition: split.cpp:181
blockLoc i
Definition: read.cpp:79
SURF_BEGIN_NAMESPACE void arrange(Point_3< Real > ps_face[4], Point_3< Real > ps[8], int ind1, int ind2, int ind3, int ind4)
Real get_face_volume(Point_3< Real > ps_face[], int ne)
j indices j
Definition: Indexing.h:6
void set(const Value *p, Element_node_enumerator &ene, int strd)
initialize the accessor with a pointer and a specific stride.

Here is the call graph for this function:

Here is the caller graph for this function:

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 at line 72 of file Rocsurf.C.

References _wm, COM_assertion_msg, E2N_AREA, Window_manifold_2::elements_to_nodes(), initialize(), and validate_object().

Referenced by load().

78 {
79  COM_assertion_msg( validate_object()==0, "Invalid object");
80 
81  if ( _wm == NULL) initialize( mesh);
82 
83  _wm->elements_to_nodes( elem_vals, nodal_vals, scheme?*scheme:E2N_AREA,
84  elem_weights, nodal_weights);
85 }
Window_manifold_2 * _wm
Definition: Rocsurf.h:163
#define COM_assertion_msg(EX, msg)
void elements_to_nodes(const COM::Attribute *evals, COM::Attribute *nvals, const int scheme=E2N_ONE, const COM::Attribute *ews=NULL, COM::Attribute *nws=NULL, const int tosum=false)
Convert element values to nodal values using weighted averaging.
Definition: Manifold_2.C:816
static const int scheme
void initialize(const COM::Attribute *pmesh)
Constructs the communication patterns of a distributed mesh.
Definition: Rocsurf.C:35
int validate_object() const
Definition: Rocsurf.h:156

Here is the call graph for this function:

Here is the caller graph for this function:

void initialize ( const COM::Attribute *  pmesh)

Constructs the communication patterns of a distributed mesh.

If the input is pmesh, then use the given pconn. Otherwise, compute pconn.

Definition at line 35 of file Rocsurf.C.

References _wm, COM_assertion_msg, COM_MESH, COM_PMESH, Window_manifold_2::init_communicator(), and validate_object().

Referenced by compute_normals(), elements_to_nodes(), Rocprop::initialize(), load(), serialize_mesh(), and Rocmop::smoother_specific_init().

35  {
36  COM_assertion_msg( validate_object()==0, "Invalid object");
37  COM_assertion_msg( !mesh || mesh->id()==COM::COM_MESH ||
38  mesh->id()==COM::COM_PMESH,
39  "Input argument must be a mesh or pmesh");
40 
41  if ( _wm) delete _wm;
42 
43  _wm = new Window_manifold_2( const_cast<COM::Attribute*>(mesh));
44 
46 }
This class implements a data structure for 2-manifold over a whole window, which can be composed of m...
Definition: Manifold_2.h:185
Window_manifold_2 * _wm
Definition: Rocsurf.h:163
#define COM_assertion_msg(EX, msg)
void init_communicator()
Initialize a pane communicator.
Definition: Manifold_2.C:389
int validate_object() const
Definition: Rocsurf.h:156

Here is the call graph for this function:

Here is the caller graph for this function:

void integrate ( const COM::Attribute *  x,
double *  z 
)
static

Integrate a function given by an elemental attribute over surface z is an array of size equal to number of components of x.

Definition at line 88 of file compute_element_areas.C.

References COM_assertion, COM_assertion_msg, COM_compatible_types(), COM_DOUBLE, COM_NC, COMMPI_Initialized(), copy, i, j, k, MPI_SUM, Element_node_enumerator::next(), Element_node_vectors_k_const< Value >::set(), Element_node_enumerator::size_of_edges(), and Element_node_enumerator::size_of_nodes().

Referenced by load().

88  {
89 
90  COM_assertion_msg( x && x->is_elemental(),
91  "Argument must be elemental attribute");
93  "Argument must be double precision");
94 
95  const int ncomp = x->size_of_components();
96  // Initialize output to 0.
97  for ( int kk=0; kk<ncomp; ++kk) z[kk]=0.;
98 
99  std::vector< const COM:: Pane*> panes;
100  x->window()-> panes( panes);
102  Vector_2<Real> nc(0,0);
103 
104  std::vector< const COM::Pane*>::const_iterator it = panes.begin();
105 
106  for (int i=0, local_npanes = panes.size(); i<local_npanes; ++i, ++it){
107  const COM::Pane &pane = **it;
108  // Assuming contiguous layout
109  const COM::Attribute *nc_pane = pane.attribute( COM::COM_NC);
110  const COM::Attribute *x_pane = pane.attribute( x->id());
111  COM_assertion( pane.size_of_elements()==0 ||
112  nc_pane->stride()==3 && x_pane->stride()==ncomp);
113 
114  const Point_3<Real> *pnts = (const Point_3<Real>*)(nc_pane->pointer());
115  const Real *xptr = (Real *)(x_pane->pointer());
116 
117  // Loop through elements of the pane
118  Element_node_enumerator ene( &pane, 1);
119  for ( int j=pane.size_of_elements(); j>0; --j, ene.next(), xptr+=ncomp) {
120  Generic_element_2 e(ene.size_of_edges(), ene.size_of_nodes());
121  ps.set( pnts, ene, 1);
122  int size = e.get_num_gp();
123 
124  for (int k = 0; k<size; k++){
125  Real weight = e.get_gp_weight( k);
126  e.get_gp_nat_coor(k, nc);
127  Real jacobi_det = e.Jacobian_det(ps,nc);
128 
129  for ( int kk=0; kk<ncomp; ++kk)
130  z[kk] += weight * jacobi_det * xptr[kk];
131  }
132  }
133  }
134 
135  if ( COMMPI_Initialized()) {
136  // Perform reduction on all processros within the communicator.
137  std::vector<double> lval(ncomp);
138  std::copy( z, z+ncomp, lval.begin());
139  MPI_Allreduce( &lval[0], z, ncomp, MPI_DOUBLE, MPI_SUM,
140  x->window()->get_communicator());
141  }
142 }
#define COM_assertion(EX)
Error checking utility similar to the assert macro of the C language.
An adaptor for enumerating node IDs of an element.
j indices k indices k
Definition: Indexing.h:6
#define COM_assertion_msg(EX, msg)
Encapsulation of the element-wise computations for two-dimensional elements.
double Real
Definition: mapbasic.h:322
This is a helper class for accessing nodal data.
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to ** copy
Definition: roccomf90.h:20
void int int int REAL REAL REAL * z
Definition: write.cpp:76
int COM_compatible_types(COM_Type type1, COM_Type type2)
Definition: roccom_c++.h:563
blockLoc i
Definition: read.cpp:79
void int int REAL * x
Definition: read.cpp:74
j indices j
Definition: Indexing.h:6
void set(const Value *p, Element_node_enumerator &ene, int strd)
initialize the accessor with a pointer and a specific stride.
int COMMPI_Initialized()
Definition: commpi.h:168
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_SUM

Here is the call graph for this function:

Here is the caller graph for this function:

void interpolate_to_centers ( const COM::Attribute *  x,
COM::Attribute *  z 
)
static

Interpolates nodal coordinates to element centers.

Definition at line 100 of file interpolate_to_centers.C.

References COM_DOUBLE, COM_DOUBLE_PRECISION, i, and j.

Referenced by load().

101  {
102  assert( x->is_nodal() && z->is_elemental()
103  && x->size_of_components() == z->size_of_components());
104  assert( x->data_type() == COM_DOUBLE ||
105  x->data_type() == COM_DOUBLE_PRECISION);
106  assert( z->data_type() == COM_DOUBLE ||
107  z->data_type() == COM_DOUBLE_PRECISION);
108 
109  std::vector<const COM::Pane*> xpanes;
110  std::vector<COM::Pane*> zpanes;
111 
112  x->window()->panes(xpanes);
113  z->window()->panes(zpanes);
114 
115  std::vector<COM::Pane*>::iterator zit, zend;
116  std::vector<const COM::Pane*>::const_iterator xit;
117 
118  const int ndim = x->size_of_components();
119  // Loop through all the panes.
120  for( zit = zpanes.begin(), zend = zpanes.end(), xit = xpanes.begin();
121  zit != zend; ++zit, ++xit) {
122  //Loop for each dimension.
123  for(int i = 0; i < ndim; ++i) {
124  COM::Attribute *z_pa = (*zit)->attribute(z->id()+((ndim>1)?i+1:0));
125  Real *zval = reinterpret_cast<Real *>(z_pa->pointer());
126  int zstrd=z_pa->stride();
127 
128  const COM::Attribute *x_pa = (*xit)->attribute(x->id()+((ndim>1)?i+1:0));
129  const Real *xval = reinterpret_cast<const Real *>(x_pa->pointer());
130 
131  Nodal_scalar_const_2d<Real> X(x_pa->stride(), 0);
132  Element_node_enumerator ene( *xit, 1);
133  Field<Nodal_scalar_const_2d<Real> > f( X, xval, ene);
134 
135  for (int j=(*xit)->size_of_elements(); j>0; --j, ene.next(), zval+=zstrd)
136  Generic_element_2( ene.size_of_edges(), ene.size_of_nodes()).
137  interpolate_to_center( f, zval);
138  }
139  }
140 }
An adaptor for enumerating node IDs of an element.
Adpator for element-wise data container.
Encapsulation of the element-wise computations for two-dimensional elements.
double Real
Definition: mapbasic.h:322
void int int int REAL REAL REAL * z
Definition: write.cpp:76
Adpator for accessing constant scalar node-centered data.
blockLoc i
Definition: read.cpp:79
void int int REAL * x
Definition: read.cpp:74
j indices j
Definition: Indexing.h:6

Here is the caller graph for this function:

void load ( const std::string &  mname)
static

Loads Rocsurf onto Roccom with a given module name.

Definition at line 139 of file Rocsurf.C.

References COM_DOUBLE, COM_INT, COM_INTEGER, COM_METADATA, COM_new_attribute(), COM_new_window(), COM_RAWDATA, COM_set_array_const(), COM_set_function(), COM_set_member_function(), COM_set_object(), COM_VOID, COM_window_init_done(), compute_bounded_volumes(), compute_edge_lengths(), compute_element_areas(), compute_element_normals(), compute_mcn(), compute_normals(), compute_signed_volumes(), compute_swept_volumes(), E2N_ANGLE, E2N_AREA, E2N_ONE, E2N_USER, elements_to_nodes(), initialize(), integrate(), interpolate_to_centers(), Rocsurf(), scheme_vals, and serialize_mesh().

Referenced by Rocsurf_load_module(), rocsurf_load_module(), ROCSURF_LOAD_MODULE(), rocsurf_load_module_(), and ROCSURF_LOAD_MODULE_().

139  {
140  Rocsurf *surf = new Rocsurf();
141 
142  COM_new_window( mname.c_str());
143 
144  std::string glb=mname+".global";
145 
146  COM_new_attribute( glb.c_str(), 'w', COM_VOID, 1, "");
147  COM_set_object( glb.c_str(), 0, surf);
148 
149  COM_Type types[7];
150 
151  types[0] = COM_METADATA; types[1] = COM_METADATA;
152  types[2] = COM_METADATA; types[3] = COM_VOID;
153  COM_set_function( (mname+".interpolate_to_centers").c_str(),
154  (Func_ptr)interpolate_to_centers, "io", types);
155 
156  COM_set_function( (mname+".compute_element_areas").c_str(),
157  (Func_ptr)compute_element_areas, "oI", types);
158 
159  COM_set_function( (mname+".compute_bounded_volumes").c_str(),
160  (Func_ptr)compute_bounded_volumes, "iioI", types);
161 
162  COM_set_function( (mname+".compute_swept_volumes").c_str(),
163  (Func_ptr)compute_swept_volumes, "iioI", types);
164 
165  types[0] = COM_METADATA; types[1] = COM_DOUBLE;
166  COM_set_function( (mname+".integrate").c_str(),
167  (Func_ptr)integrate, "io", types);
168 
169  COM_set_function( (mname+".compute_signed_volumes").c_str(),
170  (Func_ptr)compute_signed_volumes, "io", types);
171 
172  types[1] = COM_INTEGER;
173  COM_set_function( (mname+".compute_element_normals").c_str(),
174  (Func_ptr)compute_element_normals, "oII", types);
175 
176 
177  types[0] = COM_RAWDATA; types[1] = types[2] = COM_METADATA;
178  COM_set_member_function( (mname+".initialize").c_str(),
179  (Member_func_ptr)(&Rocsurf::initialize),
180  glb.c_str(), "bi", types);
181 
182  types[3] = COM_INT;
183  COM_set_member_function( (mname+".compute_normals").c_str(),
184  (Member_func_ptr)(&Rocsurf::compute_normals),
185  glb.c_str(), "bioI", types);
186 
187 
188  COM_set_member_function( (mname+".compute_mcn").c_str(),
189  (Member_func_ptr)(&Rocsurf::compute_mcn),
190  glb.c_str(), "boo", types);
191 
192  types[3] = types[5] = types[6] = COM_METADATA; types[4] = COM_INT;
193  COM_set_member_function( (mname+".elements_to_nodes").c_str(),
194  (Member_func_ptr)(&Rocsurf::elements_to_nodes),
195  glb.c_str(), "bioiIIO", types);
196 
197  COM_new_attribute((mname+".E2N_USER").c_str(), 'w', COM_INT, 1, "");
198  COM_set_array_const((mname+".E2N_USER").c_str(), 0, &scheme_vals[E2N_USER]);
199  COM_new_attribute((mname+".E2N_ONE").c_str(), 'w', COM_INT, 1, "");
200  COM_set_array_const((mname+".E2N_ONE").c_str(), 0, &scheme_vals[E2N_ONE]);
201  COM_new_attribute((mname+".E2N_AREA").c_str(), 'w', COM_INT, 1, "");
202  COM_set_array_const((mname+".E2N_AREA").c_str(), 0, &scheme_vals[E2N_AREA]);
203  COM_new_attribute((mname+".E2N_ANGLE").c_str(), 'w', COM_INT, 1, "");
204  COM_set_array_const((mname+".E2N_ANGLE").c_str(), 0, &scheme_vals[E2N_ANGLE]);
205 
206  types[1] = types[2] = types[3] = COM_DOUBLE;
207  COM_set_member_function( (mname+".compute_edge_lengths").c_str(),
208  (Member_func_ptr)(&Rocsurf::compute_edge_lengths),
209  glb.c_str(), "boOO", types);
210 
211  types[1] = types[2] = COM_METADATA;
212  COM_set_member_function( (mname+".serialize_mesh").c_str(),
213  (Member_func_ptr)(&Rocsurf::serialize_mesh),
214  glb.c_str(), "bio", types);
215 
216  COM_window_init_done( mname.c_str());
217 }
static const int scheme_vals[]
Definition: Rocsurf.h:164
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
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
Rocsurf()
Definition: Rocsurf.h:44
void COM_set_function(const char *wf_str, Func_ptr func, const char *intents, const COM_Type *types)
Definition: roccom_c++.h:323
void COM_set_object(const char *wa_str, int pane_id, Type *addr)
Definition: roccom_c++.h:144
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.
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(* Func_ptr)()
Pointer of functions.
Definition: roccom_basic.h:123
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
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...
void COM_window_init_done(const char *w_str, int pane_changed=true)
Definition: roccom_c++.h:102
void COM_new_window(const char *wname, MPI_Comm c=MPI_COMM_NULL)
Definition: roccom_c++.h:86
void COM_set_array_const(const char *wa_str, int pane_id, const void *addr, int strd=0, int cap=0)
Definition: roccom_c++.h:160
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_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-...
void compute_edge_lengths(double *lave, double *lmin, double *lmax)
Computes edge lengths of a given window.
Definition: Rocsurf.C:87
void COM_new_attribute(const char *wa_str, const char loc, const int type, int ncomp, const char *unit)
Registering an attribute type.
Definition: roccom_c++.h:118
void COM_set_member_function(const char *wf_str, Member_func_ptr func, const char *wa_str, const char *intents, const COM_Type *types)
Definition: roccom_c++.h:330
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...

Here is the call graph for this function:

Here is the caller graph for this function:

virtual Window_manifold_2* manifold ( )
inlinevirtual

Obtain a reference to the manifold.

Definition at line 115 of file Rocsurf.h.

References _wm.

115 { return _wm; }
Window_manifold_2 * _wm
Definition: Rocsurf.h:163
static void normalize ( T *  a,
int  size 
)
throw (int
)
inlinestaticprotected

Definition at line 147 of file Rocsurf.h.

References i, and sqrt().

147  {
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  }
double sqrt(double d)
Definition: double.h:73
blockLoc i
Definition: read.cpp:79

Here is the call graph for this function:

void serialize_mesh ( const COM::Attribute *  inmesh,
COM::Attribute *  outmesh 
)

Serialize the mesh of a given window.

Definition at line 128 of file Rocsurf.C.

References _wm, COM_assertion_msg, initialize(), Window_manifold_2::serialize_window(), and validate_object().

Referenced by load().

128  {
129  COM_assertion_msg( validate_object()==0, "Invalid object");
130 
131  if ( _wm == NULL) initialize( inmesh);
132 
133  COM::Window *outwin = outmesh->window();
134 
135  // Serialize input mesh and put into output mesh
136  _wm->serialize_window( outwin);
137 }
Window_manifold_2 * _wm
Definition: Rocsurf.h:163
#define COM_assertion_msg(EX, msg)
void initialize(const COM::Attribute *pmesh)
Constructs the communication patterns of a distributed mesh.
Definition: Rocsurf.C:35
void serialize_window(COM::Window *outwin) const
Create a serial window (with single pane) from the current window.
Definition: Manifold_2.C:1353
int validate_object() const
Definition: Rocsurf.h:156

Here is the call graph for this function:

Here is the caller graph for this function:

void unload ( const std::string &  mname)
static

Unloads Rocsurf from Roccom.

Definition at line 219 of file Rocsurf.C.

References COM_delete_window(), and COM_get_object().

Referenced by Rocsurf_unload_module(), rocsurf_unload_module(), ROCSURF_UNLOAD_MODULE(), rocsurf_unload_module_(), and ROCSURF_UNLOAD_MODULE_().

219  {
220  Rocsurf *surf;
221  std::string glb=mname+".global";
222 
223  COM_get_object( glb.c_str(), 0, &surf);
224  delete surf;
225 
226  COM_delete_window( mname.c_str());
227 }
void COM_delete_window(const char *wname)
Definition: roccom_c++.h:94
void COM_get_object(const char *wa_str, int pane_id, Type **addr)
Definition: roccom_c++.h:152

Here is the call graph for this function:

Here is the caller graph for this function:

int validate_object ( ) const
inlineprotected

Definition at line 156 of file Rocsurf.h.

References _cookie, and SURF_COOKIE.

Referenced by compute_mcn(), compute_normals(), elements_to_nodes(), initialize(), serialize_mesh(), and Rocprop::validate_object().

156  {
157  if ( _cookie != SURF_COOKIE) return -1;
158  else return COM_Object::validate_object();
159  }
int _cookie
Definition: Rocsurf.h:165

Here is the caller graph for this function:

Member Data Documentation

int _cookie
protected

Definition at line 165 of file Rocsurf.h.

Referenced by validate_object().

SURF_BEGIN_NAMESPACE const int scheme_vals = {E2N_USER, E2N_ONE, E2N_AREA, E2N_ANGLE}
staticprotected

Definition at line 164 of file Rocsurf.h.

Referenced by load().


The documentation for this class was generated from the following files: