xref: /petsc/src/dm/impls/plex/plexcgns.c (revision a1cb98fac0cdf0eb4d3e8a0c8b58f3fe8f800bc6)
1e1b39ce3SMatthew G. Knepley #define PETSCDM_DLL
2af0996ceSBarry Smith #include <petsc/private/dmpleximpl.h> /*I   "petscdmplex.h"   I*/
3e1b39ce3SMatthew G. Knepley 
444cd5272SMichael Lange /*@C
5*a1cb98faSBarry Smith   DMPlexCreateCGNS - Create a `DMPLEX` mesh from a CGNS file.
644cd5272SMichael Lange 
7d083f849SBarry Smith   Collective
844cd5272SMichael Lange 
944cd5272SMichael Lange   Input Parameters:
1044cd5272SMichael Lange + comm  - The MPI communicator
1144cd5272SMichael Lange . filename - The name of the CGNS file
1244cd5272SMichael Lange - interpolate - Create faces and edges in the mesh
1344cd5272SMichael Lange 
1444cd5272SMichael Lange   Output Parameter:
15*a1cb98faSBarry Smith . dm  - The `DM` object representing the mesh
1644cd5272SMichael Lange 
1744cd5272SMichael Lange   Level: beginner
1844cd5272SMichael Lange 
19*a1cb98faSBarry Smith   Note:
20*a1cb98faSBarry Smith   https://cgns.github.io
21*a1cb98faSBarry Smith 
22*a1cb98faSBarry Smith .seealso: [](chapter_unstructured), `DM`, `DMPLEX`, `DMPlexCreate()`, `DMPlexCreateCGNS()`, `DMPlexCreateExodus()`
2344cd5272SMichael Lange @*/
24d71ae5a4SJacob Faibussowitsch PetscErrorCode DMPlexCreateCGNSFromFile(MPI_Comm comm, const char filename[], PetscBool interpolate, DM *dm)
25d71ae5a4SJacob Faibussowitsch {
2644cd5272SMichael Lange   PetscFunctionBegin;
2744cd5272SMichael Lange   PetscValidCharPointer(filename, 2);
2844cd5272SMichael Lange #if defined(PETSC_HAVE_CGNS)
295f34f2dcSJed Brown   PetscCall(DMPlexCreateCGNSFromFile_Internal(comm, filename, interpolate, dm));
3044cd5272SMichael Lange #else
3144cd5272SMichael Lange   SETERRQ(comm, PETSC_ERR_SUP, "Loading meshes requires CGNS support. Reconfigure using --with-cgns-dir");
3244cd5272SMichael Lange #endif
335f34f2dcSJed Brown   PetscFunctionReturn(0);
3444cd5272SMichael Lange }
3544cd5272SMichael Lange 
36e1b39ce3SMatthew G. Knepley /*@
37*a1cb98faSBarry Smith   DMPlexCreateCGNS - Create a `DMPLEX` mesh from a CGNS file ID.
38e1b39ce3SMatthew G. Knepley 
39d083f849SBarry Smith   Collective
40e1b39ce3SMatthew G. Knepley 
41e1b39ce3SMatthew G. Knepley   Input Parameters:
42e1b39ce3SMatthew G. Knepley + comm  - The MPI communicator
43e1b39ce3SMatthew G. Knepley . cgid - The CG id associated with a file and obtained using cg_open
44e1b39ce3SMatthew G. Knepley - interpolate - Create faces and edges in the mesh
45e1b39ce3SMatthew G. Knepley 
46e1b39ce3SMatthew G. Knepley   Output Parameter:
47*a1cb98faSBarry Smith . dm  - The `DM` object representing the mesh
48e1b39ce3SMatthew G. Knepley 
49e1b39ce3SMatthew G. Knepley   Level: beginner
50e1b39ce3SMatthew G. Knepley 
51*a1cb98faSBarry Smith   Note:
52*a1cb98faSBarry Smith   https://cgns.github.io
53*a1cb98faSBarry Smith 
54*a1cb98faSBarry Smith .seealso: [](chapter_unstructured), `DM`, `DMPLEX`, `DMPlexCreate()`, `DMPlexCreateExodus()`
55e1b39ce3SMatthew G. Knepley @*/
56d71ae5a4SJacob Faibussowitsch PetscErrorCode DMPlexCreateCGNS(MPI_Comm comm, PetscInt cgid, PetscBool interpolate, DM *dm)
57d71ae5a4SJacob Faibussowitsch {
58e1b39ce3SMatthew G. Knepley   PetscFunctionBegin;
59e1b39ce3SMatthew G. Knepley #if defined(PETSC_HAVE_CGNS)
605f34f2dcSJed Brown   PetscCall(DMPlexCreateCGNS_Internal(comm, cgid, interpolate, dm));
61e1b39ce3SMatthew G. Knepley #else
625f34f2dcSJed Brown   SETERRQ(comm, PETSC_ERR_SUP, "Loading meshes requires CGNS support. Reconfigure using --download-cgns");
63e1b39ce3SMatthew G. Knepley #endif
645f34f2dcSJed Brown   PetscFunctionReturn(0);
65e1b39ce3SMatthew G. Knepley }
66