当前位置: 首页>>代码示例>>C++>>正文


C++ CGeometry::SetColorGrid方法代码示例

本文整理汇总了C++中CGeometry::SetColorGrid方法的典型用法代码示例。如果您正苦于以下问题:C++ CGeometry::SetColorGrid方法的具体用法?C++ CGeometry::SetColorGrid怎么用?C++ CGeometry::SetColorGrid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CGeometry的用法示例。


在下文中一共展示了CGeometry::SetColorGrid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char *argv[]) {
	
	unsigned short nZone = 1;
	char buffer_su2[8], buffer_vtk[8], buffer_plt[8], file_name[200];
	string MeshFile;
  
  int rank = MASTER_NODE;
  int size = 1;
  
#ifndef NO_MPI
	/*--- MPI initialization, and buffer setting ---*/
  static char buffer[MAX_MPI_BUFFER]; // buffer size in bytes
  
  void *ptr;
	MPI::Init(argc, argv);
	MPI::Attach_buffer(buffer, MAX_MPI_BUFFER);
  
	rank = MPI::COMM_WORLD.Get_rank();
	size = MPI::COMM_WORLD.Get_size();
#endif
	
	/*--- Definition of some important class ---*/
	CConfig *config = NULL;
  CGeometry *geometry = NULL;
	CSurfaceMovement *surface_mov = NULL;
	CFreeFormDefBox** FFDBox = NULL;
  
	/*--- Definition of the config problem ---*/
	if (argc == 2) { config = new CConfig(argv[1], SU2_DDC, ZONE_0, nZone, VERB_HIGH); }
	else { strcpy (file_name, "default.cfg"); config = new CConfig(file_name, SU2_DDC, ZONE_0, nZone, VERB_HIGH); }
  
  if (rank == MASTER_NODE) {
    
    /*--- Definition of the Class for the geometry ---*/
    geometry = new CPhysicalGeometry(config, ZONE_0, nZone);
    
  }
  
#ifndef NO_MPI
  MPI::COMM_WORLD.Barrier();
#endif
  
	/*--- Set domains for parallel computation (if any) ---*/
	if (size > 1) {
		
    /*--- Write the new subgrid, and remove the extension ---*/
    MeshFile = config->GetMesh_FileName();
    unsigned short lastindex = MeshFile.find_last_of(".");
    MeshFile = MeshFile.substr(0, lastindex);

    if (rank == MASTER_NODE) {
      
      cout << endl <<"------------------------ Divide the numerical grid ----------------------" << endl;
      
      /*--- Color the initial grid and set the send-receive domains ---*/
      geometry->SetColorGrid(config);
      
    }
    
#ifndef NO_MPI
    MPI::COMM_WORLD.Barrier();
#endif
    
    /*--- Allocate the memory of the current domain, and
     divide the grid between the nodes ---*/
    CDomainGeometry *domain = new CDomainGeometry(geometry, config);
    
    /*--- Add the Send/Receive boundaries ---*/
    domain->SetSendReceive(config);
    
#ifndef NO_MPI
    MPI::COMM_WORLD.Barrier();
#endif
    
    if (rank == MASTER_NODE)
      cout << endl <<"----------------------------- Write mesh files --------------------------" << endl;
    
#ifndef NO_MPI
    MPI::COMM_WORLD.Barrier();
#endif
    
    /*--- Write tecplot files ---*/
    if (config->GetVisualize_Partition()) {
      sprintf (buffer_plt, "_%d.dat", int(rank+1));
      string MeshFile_plt = MeshFile + buffer_plt;
      char *cstr_plt = strdup(MeshFile_plt.c_str());
      domain->SetTecPlot(cstr_plt);
    }
    
    /*--- Write .su2 file ---*/
    sprintf (buffer_su2, "_%d.su2", int(rank+1));
    string MeshFile_su2 = MeshFile + buffer_su2;
    char *cstr_su2 = strdup(MeshFile_su2.c_str());
    domain->SetMeshFile(config, cstr_su2);
    
#ifndef NO_MPI
    MPI::COMM_WORLD.Barrier();
#endif
    
    cout << "Domain " << rank <<": Mesh writing done (" << MeshFile_su2 <<")." << endl;
//.........这里部分代码省略.........
开发者ID:dengxbskla,项目名称:SU2,代码行数:101,代码来源:SU2_DDC.cpp


注:本文中的CGeometry::SetColorGrid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。