Actual source code: meshDraw.c
1: #ifdef PETSC_RCS_HEADER
2: static char vcid[] = "$Id: meshDraw.c,v 1.00 2001/09/25 06:48:57 knepley Exp $";
3: #endif
5: /*
6: Defines the interface to functions for drawing a mesh
7: */
9: #include src/mesh/meshimpl.h
11: /*@
12: MeshDrawLine - This function draws a line, taking into account the
13: periodicity of the mesh.
15: Collective on Mesh
17: Input Parameters:
18: + mesh - The mesh
19: . draw - The PetscDraw context
20: . xA,yA - The coordinates of an endpoint
21: . xB,yB - The coordinates of the other endpoint
22: - color - The line color
24: Level: intermediate
26: .keywords mesh, draw
27: .seealso MeshDrawTriangle()
28: @*/
29: int MeshDrawLine(Mesh mesh, PetscDraw draw, double xA, double yA, double xB, double yB, int color)
30: {
34: if (mesh->isPeriodic == PETSC_TRUE) {
35: PetscDrawLine(draw, xA, yA, MeshPeriodicRelativeX(mesh, xB, xA), MeshPeriodicRelativeY(mesh, yB, yA), color);
36:
37: } else {
38: PetscDrawLine(draw, xA, yA, xB, yB, color);
39: }
40: PetscFunctionReturn(ierr);
41: }
43: /*@
44: MeshDrawTriangle - This function draws a triangle, taking into account the
45: periodicity of the mesh.
47: Collective on Mesh
49: Input Parameters:
50: + mesh - The mesh
51: . draw - The PetscDraw context
52: . xA,yA - The coordinates of the first corner
53: . xB,yB - The coordinates of the second corner
54: . xC,yC - The coordinates of the third corner
55: . colorA, colorB, colorC - The colors of the corners
57: Level: intermediate
59: .keywords mesh, draw
60: .seealso MeshDrawLine()
61: @*/
62: int MeshDrawTriangle(Mesh mesh, PetscDraw draw, double xA, double yA, double xB, double yB, double xC, double yC, int colorA,
63: int colorB, int colorC)
64: {
68: if (mesh->isPeriodic == PETSC_TRUE) {
69: PetscDrawTriangle(draw, xA, yA, MeshPeriodicRelativeX(mesh, xB, xA), MeshPeriodicRelativeY(mesh, yB, yA),
70: MeshPeriodicRelativeX(mesh, xC, xA), MeshPeriodicRelativeY(mesh, yC, yA), colorA, colorB, colorC);
71:
72: } else {
73: PetscDrawTriangle(draw, xA, yA, xB, yB, xC, yC, colorA, colorB, colorC);
74: }
75: PetscFunctionReturn(ierr);
76: }
78: /*@C
79: MeshSetHighlightElement - This function highlights the given element when the mesh is displayed.
81: Collective on Mesh
83: Input Parameters:
84: + mesh - The mesh
85: - element - The local element index to highlight
87: Level: intermediate
89: Note: You can retrieve the local element index from the global element index using
90: the Partition function PartitionGlobalToLocalElementIndex()
92: .keywords mesh, element
93: .seealso MeshGetHighlightElement(), MeshView()
94: @*/
95: int MeshSetHighlightElement(Mesh mesh, int element)
96: {
99: mesh->highlightElement = element;
100: return(0);
101: }
103: /*@C
104: MeshGetHighlightElement - This function returns the element which is highlighted when the mesh is displayed.
106: Collective on Mesh
108: Input Parameter:
109: . mesh - The mesh
111: Output Parameter:
112: . element - The local element element to highlight, or -1 for no highlighting
114: Level: intermediate
116: Note: You can retrieve the global element index from the local element index using
117: the Partition function PartitionLocalToGlobalElementIndex()
119: .keywords mesh, element
120: .seealso MeshSetHighlightElement(), MeshView()
121: @*/
122: int MeshGetHighlightElement(Mesh mesh, int *element)
123: {
127: *element = mesh->highlightElement;
128: return(0);
129: }