コード例 #1
0
/*@
  Mesh_DomainToGlobal
  -maps a locally numbered entity to that entity's global number.
   (e.g. entity is a node if topodim=MT_VERTEX (see StgDomain/Mesh/src/types.h))
  Example:

  globalNodeNumber=Mesh_DomainToGlobal( feMesh, MT_VERTEX, localNodeNumber);
  
  Note:
  "Local" refers to entities on local processor that are in the domain of that the current processor.
  "Domain" refers to "Local" entities as well as entities from the shadowed region.
  So Domain is a superset of Local.

  This function can be used with "Local" indices as well as "Domain" indices
  because it is generally assumed that any Shadow entity is always numbered after a Local
  entity. So the Local and Domain indices are equal for all "Local" indices.

  @*/
unsigned Mesh_DomainToGlobal( void* mesh, MeshTopology_Dim topodim, unsigned domain ) {
	Mesh*	self = (Mesh*)mesh;

	assert( self );
	assert( self->topo );

	return Sync_DomainToGlobal( IGraph_GetDomain( self->topo, topodim ), domain );
}
コード例 #2
0
void RSGenerator_CalcCurvilinearGeom( void* _self, Mesh* mesh, Sync* sync, Grid* grid, unsigned* inds, double* steps )
{
   /* function for creating a curvilinear mesh */
   RSGenerator* self = (RSGenerator*)_self;

   unsigned		n_i, d_i;
   double*         	vert;
   unsigned        	gNode;

   double dimRes[3];
   double theta;

   /*
    * grid->sizes[] ... an array containing the number of nodes in a direction
    * gNode         ... global node id
    * inds          ... an ijk index to the node
    * steps         ... an array containing the physics length in each dim
    */
   for( d_i = 0 ; d_i < mesh->topo->nDims ; d_i++ )
   {
      dimRes[d_i] = steps[d_i]/(double)(grid->sizes[d_i]-1);
   }
   memcpy( self->sph_res, dimRes, 3*sizeof(double) );

   double phi;
   double X,Y,r,d;

   /* Loop over domain nodes. */
   for( n_i = 0; n_i < Sync_GetNumDomains( sync ); n_i++ )
   {
      vert = Mesh_GetVertex( mesh, n_i );

      gNode = Sync_DomainToGlobal( sync, n_i );
      Grid_Lift( grid, gNode, inds );

      r = self->crdMin[0] + dimRes[0]*(double)inds[0];
      theta = (M_PI/180.0) * (self->crdMin[1]+dimRes[1]*(double)inds[1]); // longitude position discretization
      phi =   (M_PI/180.0) * (self->crdMin[2]+dimRes[2]*(double)inds[2]); // latitude position discretization

      X = tan(theta);
      Y = tan(phi);
      d = sqrt(1 + X*X + Y*Y);

      vert[0] = r/d * X;
      vert[1] = r/d * Y;
      vert[2] = r/d * 1;
   }
}