Actual source code: plexcgns.c
1: #define PETSCDM_DLL
2: #include <petsc/private/dmpleximpl.h>
4: /*@C
5: DMPlexCreateCGNS - Create a DMPlex mesh from a CGNS file.
7: Collective
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
14: Output Parameter:
15: . dm - The DM object representing the mesh
17: Note: https://cgns.github.io
19: Level: beginner
21: .seealso: `DMPlexCreate()`, `DMPlexCreateCGNS()`, `DMPlexCreateExodus()`
22: @*/
23: PetscErrorCode DMPlexCreateCGNSFromFile(MPI_Comm comm, const char filename[], PetscBool interpolate, DM *dm)
24: {
26: #if defined(PETSC_HAVE_CGNS)
27: 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: return 0;
32: }
34: /*@
35: DMPlexCreateCGNS - Create a DMPlex mesh from a CGNS file ID.
37: Collective
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
44: Output Parameter:
45: . dm - The DM object representing the mesh
47: Note: https://cgns.github.io
49: Level: beginner
51: .seealso: `DMPlexCreate()`, `DMPlexCreateExodus()`
52: @*/
53: PetscErrorCode DMPlexCreateCGNS(MPI_Comm comm, PetscInt cgid, PetscBool interpolate, DM *dm)
54: {
55: #if defined(PETSC_HAVE_CGNS)
56: 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: return 0;
61: }