1 #define PETSCDM_DLL 2 #include <petsc/private/dmpleximpl.h> /*I "petscdmplex.h" I*/ 3 4 /*@C 5 DMPlexCreateCGNS - Create a DMPlex mesh from a CGNS file. 6 7 Collective 8 9 Input Parameters: 10 + comm - The MPI communicator 11 . filename - The name of the CGNS file 12 - interpolate - Create faces and edges in the mesh 13 14 Output Parameter: 15 . dm - The DM object representing the mesh 16 17 Note: https://cgns.github.io 18 19 Level: beginner 20 21 .seealso: `DMPlexCreate()`, `DMPlexCreateCGNS()`, `DMPlexCreateExodus()` 22 @*/ 23 PetscErrorCode DMPlexCreateCGNSFromFile(MPI_Comm comm, const char filename[], PetscBool interpolate, DM *dm) { 24 PetscFunctionBegin; 25 PetscValidCharPointer(filename, 2); 26 #if defined(PETSC_HAVE_CGNS) 27 PetscCall(DMPlexCreateCGNSFromFile_Internal(comm, filename, interpolate, dm)); 28 #else 29 SETERRQ(comm, PETSC_ERR_SUP, "Loading meshes requires CGNS support. Reconfigure using --with-cgns-dir"); 30 #endif 31 PetscFunctionReturn(0); 32 } 33 34 /*@ 35 DMPlexCreateCGNS - Create a DMPlex mesh from a CGNS file ID. 36 37 Collective 38 39 Input Parameters: 40 + comm - The MPI communicator 41 . cgid - The CG id associated with a file and obtained using cg_open 42 - interpolate - Create faces and edges in the mesh 43 44 Output Parameter: 45 . dm - The DM object representing the mesh 46 47 Note: https://cgns.github.io 48 49 Level: beginner 50 51 .seealso: `DMPlexCreate()`, `DMPlexCreateExodus()` 52 @*/ 53 PetscErrorCode DMPlexCreateCGNS(MPI_Comm comm, PetscInt cgid, PetscBool interpolate, DM *dm) { 54 PetscFunctionBegin; 55 #if defined(PETSC_HAVE_CGNS) 56 PetscCall(DMPlexCreateCGNS_Internal(comm, cgid, interpolate, dm)); 57 #else 58 SETERRQ(comm, PETSC_ERR_SUP, "Loading meshes requires CGNS support. Reconfigure using --download-cgns"); 59 #endif 60 PetscFunctionReturn(0); 61 } 62