Пример #1
0
  int
  relativeGlobalIndex(int const& dimension,
                      int const& offset) const {
    int index = globalIndex();
    index += offset * _indices[dimension].add();

    return index;
  }
Пример #2
0
  int
  relativeGlobalIndex(VectorDi const& offset) const {
    int index = globalIndex();

    for (int d = 0; d < Dimensions; ++d) {
      index += offset(d) * _indices[d].add();
    }

    return index;
  }
Пример #3
0
   bool ShockParaboloid::createNodes() {
      bool success = true;
      const Real du = maxHeight / (N_nodes_u - 1);
      const Real dv = 2.0*M_PI / N_nodes_v;
      
      for (uint32_t i=0; i<N_nodes_u; ++i) for (uint32_t j=0; j<N_nodes_v; ++j) {
	 // Write node coordinates:
	 const Real u = i*du + 0.01*maxHeight;
	 const Real v = j*dv;
	 nodeCoordinates.push_back( x0 - u ) ;
	 nodeCoordinates.push_back( radius0_y * sqrt(u/height0) * sin(v) );
	 nodeCoordinates.push_back( radius0_x * sqrt(u/height0) * cos(v) );
      }
      
      uint32_t counter = 0;
      for (uint32_t i=0; i<N_nodes_u-1; ++i) for (uint32_t j=0; j<N_nodes_v; ++j) {
	 cellConnectivity.push_back( vlsv::celltype::QUAD );
	 cellConnectivity.push_back( 4 );
	 cellConnectivity.push_back( globalIndex(i  ,j  ) );
	 
	 if (j < N_nodes_v-1) {
	    cellConnectivity.push_back( globalIndex(i  ,j+1) );
	    cellConnectivity.push_back( globalIndex(i+1,j+1) );
	 } else {
	    cellConnectivity.push_back( globalIndex(i  ,0  ) );
	    cellConnectivity.push_back( globalIndex(i+1,0  ) );
	 }
	 
	 cellConnectivity.push_back( globalIndex(i+1,j  ) );
	 
	 cellOffsets.push_back(counter*6);
	 ++counter;
      }
      cellOffsets.push_back(counter*6);
      
      return success;
   }