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:   Level: beginner

 19:   Note:
 20:   https://cgns.github.io

 22: .seealso: [](chapter_unstructured), `DM`, `DMPLEX`, `DMPlexCreate()`, `DMPlexCreateCGNS()`, `DMPlexCreateExodus()`
 23: @*/
 24: PetscErrorCode DMPlexCreateCGNSFromFile(MPI_Comm comm, const char filename[], PetscBool interpolate, DM *dm)
 25: {
 27: #if defined(PETSC_HAVE_CGNS)
 28:   DMPlexCreateCGNSFromFile_Internal(comm, filename, interpolate, dm);
 29: #else
 30:   SETERRQ(comm, PETSC_ERR_SUP, "Loading meshes requires CGNS support. Reconfigure using --with-cgns-dir");
 31: #endif
 32:   return 0;
 33: }

 35: /*@
 36:   DMPlexCreateCGNS - Create a `DMPLEX` mesh from a CGNS file ID.

 38:   Collective

 40:   Input Parameters:
 41: + comm  - The MPI communicator
 42: . cgid - The CG id associated with a file and obtained using cg_open
 43: - interpolate - Create faces and edges in the mesh

 45:   Output Parameter:
 46: . dm  - The `DM` object representing the mesh

 48:   Level: beginner

 50:   Note:
 51:   https://cgns.github.io

 53: .seealso: [](chapter_unstructured), `DM`, `DMPLEX`, `DMPlexCreate()`, `DMPlexCreateExodus()`
 54: @*/
 55: PetscErrorCode DMPlexCreateCGNS(MPI_Comm comm, PetscInt cgid, PetscBool interpolate, DM *dm)
 56: {
 57: #if defined(PETSC_HAVE_CGNS)
 58:   DMPlexCreateCGNS_Internal(comm, cgid, interpolate, dm);
 59: #else
 60:   SETERRQ(comm, PETSC_ERR_SUP, "Loading meshes requires CGNS support. Reconfigure using --download-cgns");
 61: #endif
 62:   return 0;
 63: }