Actual source code: plexcgns.c

  1: #define PETSCDM_DLL
  2: #include <petsc/private/dmpleximpl.h>

  4: /*@C
  5:   DMPlexCreateCGNSFromFile - 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: [](ch_unstructured), `DM`, `DMPLEX`, `DMPlexCreate()`, `DMPlexCreateCGNS()`, `DMPlexCreateExodus()`
 23: @*/
 24: PetscErrorCode DMPlexCreateCGNSFromFile(MPI_Comm comm, const char filename[], PetscBool interpolate, DM *dm)
 25: {
 26:   PetscFunctionBegin;
 27:   PetscAssertPointer(filename, 2);
 28: #if defined(PETSC_HAVE_CGNS)
 29:   PetscCall(DMPlexCreateCGNSFromFile_Internal(comm, filename, interpolate, dm));
 30: #else
 31:   SETERRQ(comm, PETSC_ERR_SUP, "Loading meshes requires CGNS support. Reconfigure using --with-cgns-dir");
 32: #endif
 33:   PetscFunctionReturn(PETSC_SUCCESS);
 34: }

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

 39:   Collective

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

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

 49:   Level: beginner

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

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