本文整理汇总了C++中CGeometry::SetMeshFile方法的典型用法代码示例。如果您正苦于以下问题:C++ CGeometry::SetMeshFile方法的具体用法?C++ CGeometry::SetMeshFile怎么用?C++ CGeometry::SetMeshFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGeometry
的用法示例。
在下文中一共展示了CGeometry::SetMeshFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[]) {
char buffer_vtk[100], buffer_plt[100];
string MeshFile;
unsigned short nZone = 1;
#ifndef NO_MPI
#ifdef WINDOWS
MPI_Init(&argc,&argv);
#else
MPI::Init(argc, argv);
#endif
#endif
/*--- Definition of the class for the definition of the problem ---*/
CConfig *config;
if (argc == 2) config = new CConfig(argv[1], SU2_PBC, ZONE_0, nZone, 0, VERB_HIGH);
else {
char grid_file[200];
strcpy (grid_file, "default.cfg");
config = new CConfig(grid_file, SU2_PBC, ZONE_0, nZone, 0, VERB_HIGH);
}
/*--- Definition of the class for the geometry ---*/
CGeometry *geometry; geometry = new CGeometry;
geometry = new CPhysicalGeometry(config, ZONE_0, nZone);
/*--- Perform the non-dimensionalization, in case any values are needed ---*/
config->SetNondimensionalization(geometry->GetnDim(), ZONE_0);
cout << endl <<"----------------------- Preprocessing computations ----------------------" << endl;
/*--- Compute elements surrounding points, points surrounding points, and elements surrounding elements ---*/
cout << "Setting local point and element connectivity." <<endl;
geometry->SetEsuP(); geometry->SetPsuP(); geometry->SetEsuE();
/*--- Check the orientation before computing geometrical quantities ---*/
cout << "Checking the numerical grid orientation." <<endl;
geometry->SetBoundVolume(); geometry->Check_Orientation(config);
/*--- Create the edge structure ---*/
cout << "Identifying edges and vertices." <<endl;
geometry->SetEdges(); geometry->SetVertex(config);
/*--- Compute center of gravity ---*/
cout << "Computing centers of gravity." << endl;
geometry->SetCG();
/*--- Create the control volume structures ---*/
cout << "Setting the control volume structure." << endl;
geometry->SetControlVolume(config, ALLOCATE);
geometry->SetBoundControlVolume(config, ALLOCATE);
cout << endl <<"-------------------- Setting the periodic boundaries --------------------" << endl;
/*--- Set periodic boundary conditions ---*/
geometry->SetPeriodicBoundary(config);
/*--- Original grid for debugging purposes ---*/
strcpy (buffer_plt, "periodic_original.plt"); geometry->SetTecPlot(buffer_plt);
/*--- Create a new grid with the right periodic boundary ---*/
CGeometry *periodic; periodic = new CPeriodicGeometry(geometry, config);
periodic->SetPeriodicBoundary(geometry, config);
periodic->SetMeshFile(geometry, config, config->GetMesh_Out_FileName());
/*--- Output of the grid for debuging purposes ---*/
strcpy (buffer_plt, "periodic_halo.plt"); periodic->SetTecPlot(buffer_plt);
#ifndef NO_MPI
#ifdef WINDOWS
MPI_Finalize();
#else
MPI::Finalize();
#endif
#endif
/*--- End solver ---*/
cout << endl <<"------------------------- Exit Success (SU2_PBC) ------------------------" << endl << endl;
return EXIT_SUCCESS;
}
示例2: main
//.........这里部分代码省略.........
grid_adaptation->GetAdjSolution(geometry, config);
grid_adaptation->SetIndicator_Adj(geometry, config, 1);
break;
case GRAD_FLOW_ADJ:
grid_adaptation->GetAdjSolution(geometry, config);
grid_adaptation->SetIndicator_FlowAdj(geometry, config);
break;
case COMPUTABLE:
grid_adaptation->GetAdjSolution(geometry, config);
grid_adaptation->GetFlowResidual(geometry, config);
grid_adaptation->SetIndicator_Computable(geometry, config);
break;
case REMAINING:
cout << "Adaptation method not implemented."<< endl;
cout << "Press any key to exit..." << endl;
cin.get();
exit(1);
break;
case ROBUST:
grid_adaptation->GetFlowResidual(geometry, config);
grid_adaptation->GetAdjResidual(geometry, config);
grid_adaptation->SetIndicator_Robust(geometry, config);
break;
case COMPUTABLE_ROBUST:
grid_adaptation->GetAdjSolution(geometry, config);
grid_adaptation->GetLinResidual(geometry, config);
grid_adaptation->SetIndicator_Computable_Robust(geometry, config);
break;
default :
cout << "The adaptation is not defined" << endl;
}
/*--- Perform an homothetic adaptation of the grid ---*/
CPhysicalGeometry *geo_adapt; geo_adapt = new CPhysicalGeometry;
cout << "Homothetic grid adaptation" << endl;
if (geometry->GetnDim() == 2) grid_adaptation->SetHomothetic_Adaptation2D(geometry, geo_adapt, config);
if (geometry->GetnDim() == 3) grid_adaptation->SetHomothetic_Adaptation3D(geometry, geo_adapt, config);
/*--- Smooth the numerical grid coordinates ---*/
if (config->GetSmoothNumGrid()) {
cout << "Preprocessing for doing the implicit smoothing." << endl;
geo_adapt->SetEsuP(); geo_adapt->SetPsuP(); geo_adapt->SetEsuE();
geo_adapt->SetBoundVolume(); geo_adapt->Check_Orientation(config);
geo_adapt->SetEdges(); geo_adapt->SetVertex(config);
cout << "Implicit smoothing of the numerical grid coordinates." << endl;
geo_adapt->SetCoord_Smoothing(5, 1.5, config);
}
/*--- Original and adapted grid ---*/
strcpy (file_name, "original_grid.plt");
geometry->SetTecPlot(file_name);
/*--- Write the adaptation sensor ---*/
grid_adaptation->WriteAdaptSensor(geometry, file_name);
strcpy (file_name, "adapted_grid.plt");
geo_adapt->SetTecPlot(file_name);
strcpy (file_name, "adapted_surface.plt");
geo_adapt->SetBoundTecPlot(config,file_name);
/*--- Write the new adapted grid, including the modified boundaries surfaces ---*/
geo_adapt->SetMeshFile(config, config->GetMesh_Out_FileName());
/*--- Write the restart file ---*/
if ((config->GetKind_Adaptation() != SMOOTHING) && (config->GetKind_Adaptation() != FULL) &&
(config->GetKind_Adaptation() != WAKE) && (config->GetKind_Adaptation() != TWOPHASE) &&
(config->GetKind_Adaptation() != SUPERSONIC_SHOCK))
grid_adaptation->SetRestart_FlowSolution(config, geo_adapt, config->GetRestart_FlowFileName());
if ((config->GetKind_Adaptation() == GRAD_FLOW_ADJ) || (config->GetKind_Adaptation() == GRAD_ADJOINT)
|| (config->GetKind_Adaptation() == FULL_ADJOINT) || (config->GetKind_Adaptation() == ROBUST)
|| (config->GetKind_Adaptation() == COMPUTABLE) || (config->GetKind_Adaptation() == COMPUTABLE_ROBUST) ||
(config->GetKind_Adaptation() == REMAINING))
grid_adaptation->SetRestart_AdjSolution(config, geo_adapt, config->GetRestart_AdjFileName());
if ((config->GetKind_Adaptation() == FULL_LINEAR) || (config->GetKind_Adaptation() == COMPUTABLE_ROBUST)) {
grid_adaptation->SetRestart_LinSolution(config, geo_adapt, config->GetRestart_LinFileName());
}
}
else {
strcpy (file_name, "original_grid.plt");
geometry->SetTecPlot(file_name);
geometry->SetMeshFile (config, config->GetMesh_Out_FileName());
}
#ifndef NO_MPI
#ifdef WINDOWS
MPI_Finalize();
#else
MPI::Finalize();
#endif
#endif
/*--- End solver ---*/
cout << endl <<"------------------------- Exit Success (SU2_MAC) ------------------------" << endl << endl;
return EXIT_SUCCESS;
}
示例3: main
//.........这里部分代码省略.........
cout << "Homothetic grid adaptation" << endl;
if (geometry_container[ZONE_0]->GetnDim() == 2) grid_adaptation->SetHomothetic_Adaptation2D(geometry_container[ZONE_0], geo_adapt, config_container[ZONE_0]);
if (geometry_container[ZONE_0]->GetnDim() == 3) grid_adaptation->SetHomothetic_Adaptation3D(geometry_container[ZONE_0], geo_adapt, config_container[ZONE_0]);
/*--- Smooth the numerical grid coordinates ---*/
if (config_container[ZONE_0]->GetSmoothNumGrid()) {
cout << "Preprocessing for doing the implicit smoothing." << endl;
geo_adapt->SetPoint_Connectivity(); geo_adapt->SetElement_Connectivity();
geo_adapt->SetBoundVolume();
if (config_container[ZONE_0]->GetReorientElements()) {
geo_adapt->Check_IntElem_Orientation(config_container[ZONE_0]); geo_adapt->Check_BoundElem_Orientation(config_container[ZONE_0]);
}
geo_adapt->SetEdges(); geo_adapt->SetVertex(config_container[ZONE_0]);
cout << "Implicit smoothing of the numerical grid coordinates." << endl;
geo_adapt->SetCoord_Smoothing(5, 1.5, config_container[ZONE_0]);
}
/*--- Original and adapted grid ---*/
strcpy (file_name, "original_grid.dat");
geometry_container[ZONE_0]->SetTecPlot(file_name, true);
strcpy (file_name, "original_surface.dat");
geometry_container[ZONE_0]->SetBoundTecPlot(file_name, true, config_container[ZONE_0]);
/*--- Write the adapted grid sensor ---*/
strcpy (file_name, "adapted_grid.dat");
geo_adapt->SetTecPlot(file_name, true);
strcpy (file_name, "adapted_surface.dat");
geo_adapt->SetBoundTecPlot(file_name, true, config_container[ZONE_0]);
/*--- Write the new adapted grid, including the modified boundaries surfaces ---*/
geo_adapt->SetMeshFile(config_container[ZONE_0], config_container[ZONE_0]->GetMesh_Out_FileName());
/*--- Write the restart file ---*/
if ((config_container[ZONE_0]->GetKind_Adaptation() != SMOOTHING) && (config_container[ZONE_0]->GetKind_Adaptation() != FULL) &&
(config_container[ZONE_0]->GetKind_Adaptation() != WAKE) &&
(config_container[ZONE_0]->GetKind_Adaptation() != SUPERSONIC_SHOCK))
grid_adaptation->SetRestart_FlowSolution(config_container[ZONE_0], geo_adapt, config_container[ZONE_0]->GetRestart_FlowFileName());
if ((config_container[ZONE_0]->GetKind_Adaptation() == GRAD_FLOW_ADJ) || (config_container[ZONE_0]->GetKind_Adaptation() == GRAD_ADJOINT)
|| (config_container[ZONE_0]->GetKind_Adaptation() == FULL_ADJOINT) || (config_container[ZONE_0]->GetKind_Adaptation() == COMPUTABLE) ||
(config_container[ZONE_0]->GetKind_Adaptation() == REMAINING))
grid_adaptation->SetRestart_AdjSolution(config_container[ZONE_0], geo_adapt, config_container[ZONE_0]->GetRestart_AdjFileName());
}
else {
if (config_container[ZONE_0]->GetKind_Adaptation() == PERIODIC) {
cout << endl <<"-------------------- Setting the periodic boundaries --------------------" << endl;
/*--- Set periodic boundary conditions ---*/
geometry_container[ZONE_0]->SetPeriodicBoundary(config_container[ZONE_0]);
/*--- Original grid for debugging purposes ---*/
strcpy (file_name, "periodic_original.dat"); geometry_container[ZONE_0]->SetTecPlot(file_name, true);
/*--- Create a new grid with the right periodic boundary ---*/
CGeometry *periodic; periodic = new CPeriodicGeometry(geometry_container[ZONE_0], config_container[ZONE_0]);