fegeom.c (f9c74781d55c1a75133c03f694d678c4d1968aae) fegeom.c (f13dfd9ea68e0ddeee984e65c377a1819eab8a8a)
1#include <petsc/private/petscfeimpl.h> /*I "petscfe.h" I*/
2
3/*@C
4 PetscFEGeomCreate - Create a `PetscFEGeom` object to manage geometry for a group of cells
5
6 Input Parameters:
7+ quad - A `PetscQuadrature` determining the tabulation
8. numCells - The number of cells in the group
9. dimEmbed - The coordinate dimension
10- faceData - Flag to construct geometry data for the faces
11
12 Output Parameter:
1#include <petsc/private/petscfeimpl.h> /*I "petscfe.h" I*/
2
3/*@C
4 PetscFEGeomCreate - Create a `PetscFEGeom` object to manage geometry for a group of cells
5
6 Input Parameters:
7+ quad - A `PetscQuadrature` determining the tabulation
8. numCells - The number of cells in the group
9. dimEmbed - The coordinate dimension
10- faceData - Flag to construct geometry data for the faces
11
12 Output Parameter:
13. geom - The `PetscFEGeom` object
13. geom - The `PetscFEGeom` object, which is a struct not a `PetscObject`
14
15 Level: beginner
16
17.seealso: `PetscFEGeom`, `PetscQuadrature`, `PetscFEGeomDestroy()`, `PetscFEGeomComplete()`
18@*/
19PetscErrorCode PetscFEGeomCreate(PetscQuadrature quad, PetscInt numCells, PetscInt dimEmbed, PetscBool faceData, PetscFEGeom **geom)
20{
21 PetscFEGeom *g;

--- 46 unchanged lines hidden (view full) ---

68 PetscFEGeomGetChunk - Get a chunk of cells in the group as a `PetscFEGeom`
69
70 Input Parameters:
71+ geom - `PetscFEGeom` object
72. cStart - The first cell in the chunk
73- cEnd - The first cell not in the chunk
74
75 Output Parameter:
14
15 Level: beginner
16
17.seealso: `PetscFEGeom`, `PetscQuadrature`, `PetscFEGeomDestroy()`, `PetscFEGeomComplete()`
18@*/
19PetscErrorCode PetscFEGeomCreate(PetscQuadrature quad, PetscInt numCells, PetscInt dimEmbed, PetscBool faceData, PetscFEGeom **geom)
20{
21 PetscFEGeom *g;

--- 46 unchanged lines hidden (view full) ---

68 PetscFEGeomGetChunk - Get a chunk of cells in the group as a `PetscFEGeom`
69
70 Input Parameters:
71+ geom - `PetscFEGeom` object
72. cStart - The first cell in the chunk
73- cEnd - The first cell not in the chunk
74
75 Output Parameter:
76. chunkGeom - The chunk of cells
76. chunkGeom - an array of cells of length `cEnd` - `cStart`
77
78 Level: intermediate
79
80 Note:
81 Use `PetscFEGeomRestoreChunk()` to return the result
82
83.seealso: `PetscFEGeom`, `PetscFEGeomRestoreChunk()`, `PetscFEGeomCreate()`
84@*/
77
78 Level: intermediate
79
80 Note:
81 Use `PetscFEGeomRestoreChunk()` to return the result
82
83.seealso: `PetscFEGeom`, `PetscFEGeomRestoreChunk()`, `PetscFEGeomCreate()`
84@*/
85PetscErrorCode PetscFEGeomGetChunk(PetscFEGeom *geom, PetscInt cStart, PetscInt cEnd, PetscFEGeom **chunkGeom)
85PetscErrorCode PetscFEGeomGetChunk(PetscFEGeom *geom, PetscInt cStart, PetscInt cEnd, PetscFEGeom *chunkGeom[])
86{
87 PetscInt Nq;
88 PetscInt dE;
89
90 PetscFunctionBegin;
91 PetscAssertPointer(geom, 1);
92 PetscAssertPointer(chunkGeom, 4);
93 if (!*chunkGeom) PetscCall(PetscNew(chunkGeom));

--- 36 unchanged lines hidden (view full) ---

130PetscErrorCode PetscFEGeomRestoreChunk(PetscFEGeom *geom, PetscInt cStart, PetscInt cEnd, PetscFEGeom **chunkGeom)
131{
132 PetscFunctionBegin;
133 PetscCall(PetscFree(*chunkGeom));
134 PetscFunctionReturn(PETSC_SUCCESS);
135}
136
137/*@C
86{
87 PetscInt Nq;
88 PetscInt dE;
89
90 PetscFunctionBegin;
91 PetscAssertPointer(geom, 1);
92 PetscAssertPointer(chunkGeom, 4);
93 if (!*chunkGeom) PetscCall(PetscNew(chunkGeom));

--- 36 unchanged lines hidden (view full) ---

130PetscErrorCode PetscFEGeomRestoreChunk(PetscFEGeom *geom, PetscInt cStart, PetscInt cEnd, PetscFEGeom **chunkGeom)
131{
132 PetscFunctionBegin;
133 PetscCall(PetscFree(*chunkGeom));
134 PetscFunctionReturn(PETSC_SUCCESS);
135}
136
137/*@C
138 PetscFEGeomGetPoint - Get the geometry for cell c at point p as a `PetscFEGeom`
138 PetscFEGeomGetPoint - Get the geometry for cell `c` at point `p` as a `PetscFEGeom`
139
140 Input Parameters:
141+ geom - `PetscFEGeom` object
142. c - The cell
143. p - The point
139
140 Input Parameters:
141+ geom - `PetscFEGeom` object
142. c - The cell
143. p - The point
144- pcoords - The reference coordinates of point p, or NULL
144- pcoords - The reference coordinates of point `p`, or `NULL`
145
146 Output Parameter:
145
146 Output Parameter:
147. pgeom - The geometry of cell c at point p
147. pgeom - The geometry of cell `c` at point `p`
148
149 Level: intermediate
150
151 Notes:
148
149 Level: intermediate
150
151 Notes:
152 For affine geometries, this only copies to pgeom at point 0. Since we copy pointers into pgeom,
152 For affine geometries, this only copies to `pgeom` at point 0. Since we copy pointers into `pgeom`,
153 nothing needs to be done with it afterwards.
154
153 nothing needs to be done with it afterwards.
154
155 In the affine case, pgeom must have storage for the integration point coordinates in pgeom->v if pcoords is passed in.
155 In the affine case, `pgeom` must have storage for the integration point coordinates in pgeom->v if `pcoords` is passed in.
156
157.seealso: `PetscFEGeom`, `PetscFEGeomRestoreChunk()`, `PetscFEGeomCreate()`
158@*/
159PetscErrorCode PetscFEGeomGetPoint(PetscFEGeom *geom, PetscInt c, PetscInt p, const PetscReal pcoords[], PetscFEGeom *pgeom)
160{
161 const PetscInt dim = geom->dim;
162 const PetscInt dE = geom->dimEmbed;
163 const PetscInt Np = geom->numPoints;

--- 17 unchanged lines hidden (view full) ---

181 pgeom->invJ = &geom->invJ[(c * Np + p) * dE * dE];
182 pgeom->detJ = &geom->detJ[c * Np + p];
183 pgeom->n = PetscSafePointerPlusOffset(geom->n, (c * Np + p) * dE);
184 }
185 PetscFunctionReturn(PETSC_SUCCESS);
186}
187
188/*@C
156
157.seealso: `PetscFEGeom`, `PetscFEGeomRestoreChunk()`, `PetscFEGeomCreate()`
158@*/
159PetscErrorCode PetscFEGeomGetPoint(PetscFEGeom *geom, PetscInt c, PetscInt p, const PetscReal pcoords[], PetscFEGeom *pgeom)
160{
161 const PetscInt dim = geom->dim;
162 const PetscInt dE = geom->dimEmbed;
163 const PetscInt Np = geom->numPoints;

--- 17 unchanged lines hidden (view full) ---

181 pgeom->invJ = &geom->invJ[(c * Np + p) * dE * dE];
182 pgeom->detJ = &geom->detJ[c * Np + p];
183 pgeom->n = PetscSafePointerPlusOffset(geom->n, (c * Np + p) * dE);
184 }
185 PetscFunctionReturn(PETSC_SUCCESS);
186}
187
188/*@C
189 PetscFEGeomGetCellPoint - Get the cell geometry for face f at point p as a `PetscFEGeom`
189 PetscFEGeomGetCellPoint - Get the cell geometry for face `c` at point `p` as a `PetscFEGeom`
190
191 Input Parameters:
192+ geom - `PetscFEGeom` object
193. c - The face
194- p - The point
195
196 Output Parameter:
190
191 Input Parameters:
192+ geom - `PetscFEGeom` object
193. c - The face
194- p - The point
195
196 Output Parameter:
197. pgeom - The cell geometry of face f at point p
197. pgeom - The cell geometry of face `c` at point `p`
198
199 Level: intermediate
200
201 Note:
198
199 Level: intermediate
200
201 Note:
202 For affine geometries, this only copies to pgeom at point 0. Since we copy pointers into pgeom,
202 For affine geometries, this only copies to pgeom at point 0. Since we copy pointers into `pgeom`,
203 nothing needs to be done with it afterwards.
204
205.seealso: `PetscFEGeom()`, `PetscFEGeomRestoreChunk()`, `PetscFEGeomCreate()`
206@*/
207PetscErrorCode PetscFEGeomGetCellPoint(PetscFEGeom *geom, PetscInt c, PetscInt p, PetscFEGeom *pgeom)
208{
209 const PetscBool bd = geom->dimEmbed > geom->dim && !geom->isCohesive ? PETSC_TRUE : PETSC_FALSE;
210 const PetscInt dim = bd ? geom->dimEmbed : geom->dim;

--- 26 unchanged lines hidden (view full) ---

237 pgeom->invJ = &geom->invJ[(c * Np + p) * dE * dE];
238 pgeom->detJ = &geom->detJ[c * Np + p];
239 }
240 }
241 PetscFunctionReturn(PETSC_SUCCESS);
242}
243
244/*@C
203 nothing needs to be done with it afterwards.
204
205.seealso: `PetscFEGeom()`, `PetscFEGeomRestoreChunk()`, `PetscFEGeomCreate()`
206@*/
207PetscErrorCode PetscFEGeomGetCellPoint(PetscFEGeom *geom, PetscInt c, PetscInt p, PetscFEGeom *pgeom)
208{
209 const PetscBool bd = geom->dimEmbed > geom->dim && !geom->isCohesive ? PETSC_TRUE : PETSC_FALSE;
210 const PetscInt dim = bd ? geom->dimEmbed : geom->dim;

--- 26 unchanged lines hidden (view full) ---

237 pgeom->invJ = &geom->invJ[(c * Np + p) * dE * dE];
238 pgeom->detJ = &geom->detJ[c * Np + p];
239 }
240 }
241 PetscFunctionReturn(PETSC_SUCCESS);
242}
243
244/*@C
245 PetscFEGeomComplete - Calculate derived quantities from base geometry specification
245 PetscFEGeomComplete - Calculate derived quantities from a base geometry specification
246
247 Input Parameter:
248. geom - `PetscFEGeom` object
249
250 Level: intermediate
251
252.seealso: `PetscFEGeom`, `PetscFEGeomCreate()`
253@*/

--- 34 unchanged lines hidden ---
246
247 Input Parameter:
248. geom - `PetscFEGeom` object
249
250 Level: intermediate
251
252.seealso: `PetscFEGeom`, `PetscFEGeomCreate()`
253@*/

--- 34 unchanged lines hidden ---