1 /******************************************************************************
2 * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other
3 * HYPRE Project Developers. See the top-level COPYRIGHT file for details.
4 *
5 * SPDX-License-Identifier: (Apache-2.0 OR MIT)
6 ******************************************************************************/
7
8 /******************************************************************************
9 *
10 * HYPRE_StructVector interface
11 *
12 *****************************************************************************/
13
14 #include "_hypre_struct_mv.h"
15 #include "fortran.h"
16
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20
21 /*--------------------------------------------------------------------------
22 * HYPRE_StructVectorCreate
23 *--------------------------------------------------------------------------*/
24
25 void
hypre_F90_IFACE(hypre_structvectorcreate,HYPRE_STRUCTVECTORCREATE)26 hypre_F90_IFACE(hypre_structvectorcreate, HYPRE_STRUCTVECTORCREATE)
27 ( hypre_F90_Comm *comm,
28 hypre_F90_Obj *grid,
29 hypre_F90_Obj *vector,
30 hypre_F90_Int *ierr )
31 {
32 *ierr = (hypre_F90_Int)
33 ( HYPRE_StructVectorCreate(
34 hypre_F90_PassComm (comm),
35 hypre_F90_PassObj (HYPRE_StructGrid, grid),
36 hypre_F90_PassObjRef (HYPRE_StructVector, vector) ) );
37 }
38
39 /*--------------------------------------------------------------------------
40 * HYPRE_StructVectorDestroy
41 *--------------------------------------------------------------------------*/
42
43 void
hypre_F90_IFACE(hypre_structvectordestroy,HYPRE_STRUCTVECTORDESTROY)44 hypre_F90_IFACE(hypre_structvectordestroy, HYPRE_STRUCTVECTORDESTROY)
45 ( hypre_F90_Obj *vector,
46 hypre_F90_Int *ierr )
47 {
48 *ierr = (hypre_F90_Int)
49 ( HYPRE_StructVectorDestroy(
50 hypre_F90_PassObj (HYPRE_StructVector, vector) ) );
51 }
52
53 /*--------------------------------------------------------------------------
54 * HYPRE_StructVectorInitialize
55 *--------------------------------------------------------------------------*/
56
57 void
hypre_F90_IFACE(hypre_structvectorinitialize,HYPRE_STRUCTVECTORINITIALIZE)58 hypre_F90_IFACE(hypre_structvectorinitialize, HYPRE_STRUCTVECTORINITIALIZE)
59 ( hypre_F90_Obj *vector,
60 hypre_F90_Int *ierr )
61 {
62 *ierr = (hypre_F90_Int)
63 ( HYPRE_StructVectorInitialize(
64 hypre_F90_PassObj (HYPRE_StructVector, vector) ) );
65 }
66
67 /*--------------------------------------------------------------------------
68 * HYPRE_StructVectorSetValues
69 *--------------------------------------------------------------------------*/
70
71 void
hypre_F90_IFACE(hypre_structvectorsetvalues,HYPRE_STRUCTVECTORSETVALUES)72 hypre_F90_IFACE(hypre_structvectorsetvalues, HYPRE_STRUCTVECTORSETVALUES)
73 ( hypre_F90_Obj *vector,
74 hypre_F90_IntArray *grid_index,
75 hypre_F90_Complex *values,
76 hypre_F90_Int *ierr )
77 {
78 *ierr = (hypre_F90_Int)
79 ( HYPRE_StructVectorSetValues(
80 hypre_F90_PassObj (HYPRE_StructVector, vector),
81 hypre_F90_PassIntArray (grid_index),
82 hypre_F90_PassComplex (values) ) );
83 }
84
85 /*--------------------------------------------------------------------------
86 * HYPRE_StructVectorSetBoxValues
87 *--------------------------------------------------------------------------*/
88
89 void
hypre_F90_IFACE(hypre_structvectorsetboxvalues,HYPRE_STRUCTVECTORSETBOXVALUES)90 hypre_F90_IFACE(hypre_structvectorsetboxvalues, HYPRE_STRUCTVECTORSETBOXVALUES)
91 ( hypre_F90_Obj *vector,
92 hypre_F90_IntArray *ilower,
93 hypre_F90_IntArray *iupper,
94 hypre_F90_ComplexArray *values,
95 hypre_F90_Int *ierr )
96 {
97 *ierr = (hypre_F90_Int)
98 ( HYPRE_StructVectorSetBoxValues(
99 hypre_F90_PassObj (HYPRE_StructVector, vector),
100 hypre_F90_PassIntArray (ilower),
101 hypre_F90_PassIntArray (iupper),
102 hypre_F90_PassComplexArray (values) ) );
103 }
104
105 /*--------------------------------------------------------------------------
106 * HYPRE_StructVectorAddToValues
107 *--------------------------------------------------------------------------*/
108
109 void
hypre_F90_IFACE(hypre_structvectoraddtovalues,HYPRE_STRUCTVECTORADDTOVALUES)110 hypre_F90_IFACE(hypre_structvectoraddtovalues, HYPRE_STRUCTVECTORADDTOVALUES)
111 ( hypre_F90_Obj *vector,
112 hypre_F90_IntArray *grid_index,
113 hypre_F90_Complex *values,
114 hypre_F90_Int *ierr )
115 {
116 *ierr = (hypre_F90_Int)
117 ( HYPRE_StructVectorAddToValues(
118 hypre_F90_PassObj (HYPRE_StructVector, vector),
119 hypre_F90_PassIntArray (grid_index),
120 hypre_F90_PassComplex (values) ) );
121 }
122
123 /*--------------------------------------------------------------------------
124 * HYPRE_StructVectorAddToBoxValues
125 *--------------------------------------------------------------------------*/
126
127 void
hypre_F90_IFACE(hypre_structvectoraddtoboxvalue,HYPRE_STRUCTVECTORADDTOBOXVALUE)128 hypre_F90_IFACE(hypre_structvectoraddtoboxvalue, HYPRE_STRUCTVECTORADDTOBOXVALUE)
129 ( hypre_F90_Obj *vector,
130 hypre_F90_IntArray *ilower,
131 hypre_F90_IntArray *iupper,
132 hypre_F90_ComplexArray *values,
133 hypre_F90_Int *ierr )
134 {
135 *ierr = (hypre_F90_Int)
136 ( HYPRE_StructVectorAddToBoxValues(
137 hypre_F90_PassObj (HYPRE_StructVector, vector),
138 hypre_F90_PassIntArray (ilower),
139 hypre_F90_PassIntArray (iupper),
140 hypre_F90_PassComplexArray (values) ) );
141 }
142
143 /*--------------------------------------------------------------------------
144 * HYPRE_StructVectorScaleValues
145 *--------------------------------------------------------------------------*/
146
147 void
hypre_F90_IFACE(hypre_structvectorscalevalues,HYPRE_STRUCTVECTORSCALEVALUES)148 hypre_F90_IFACE(hypre_structvectorscalevalues, HYPRE_STRUCTVECTORSCALEVALUES)
149 ( hypre_F90_Obj *vector,
150 hypre_F90_Complex *factor,
151 hypre_F90_Int *ierr )
152 {
153 *ierr = (hypre_F90_Int)
154 ( HYPRE_StructVectorScaleValues(
155 hypre_F90_PassObj (HYPRE_StructVector, vector),
156 hypre_F90_PassComplex (factor) ) );
157 }
158
159 /*--------------------------------------------------------------------------
160 * HYPRE_StructVectorGetValues
161 *--------------------------------------------------------------------------*/
162
163 void
hypre_F90_IFACE(hypre_structvectorgetvalues,HYPRE_STRUCTVECTORGETVALUES)164 hypre_F90_IFACE(hypre_structvectorgetvalues, HYPRE_STRUCTVECTORGETVALUES)
165 ( hypre_F90_Obj *vector,
166 hypre_F90_IntArray *grid_index,
167 hypre_F90_Complex *values_ptr,
168 hypre_F90_Int *ierr )
169 {
170 *ierr = (hypre_F90_Int)
171 ( HYPRE_StructVectorGetValues(
172 hypre_F90_PassObj (HYPRE_StructVector, vector),
173 hypre_F90_PassIntArray (grid_index),
174 hypre_F90_PassComplexRef (values_ptr) ) );
175 }
176
177 /*--------------------------------------------------------------------------
178 * HYPRE_StructVectorGetBoxValues
179 *--------------------------------------------------------------------------*/
180
181 void
hypre_F90_IFACE(hypre_structvectorgetboxvalues,HYPRE_STRUCTVECTORGETBOXVALUES)182 hypre_F90_IFACE(hypre_structvectorgetboxvalues, HYPRE_STRUCTVECTORGETBOXVALUES)
183 ( hypre_F90_Obj *vector,
184 hypre_F90_IntArray *ilower,
185 hypre_F90_IntArray *iupper,
186 hypre_F90_ComplexArray *values,
187 hypre_F90_Int *ierr )
188 {
189 *ierr = (hypre_F90_Int)
190 ( HYPRE_StructVectorGetBoxValues(
191 hypre_F90_PassObj (HYPRE_StructVector, vector),
192 hypre_F90_PassIntArray (ilower),
193 hypre_F90_PassIntArray (iupper),
194 hypre_F90_PassComplexArray (values) ) );
195 }
196
197 /*--------------------------------------------------------------------------
198 * HYPRE_StructVectorAssemble
199 *--------------------------------------------------------------------------*/
200
201 void
hypre_F90_IFACE(hypre_structvectorassemble,HYPRE_STRUCTVECTORASSEMBLE)202 hypre_F90_IFACE(hypre_structvectorassemble, HYPRE_STRUCTVECTORASSEMBLE)
203 ( hypre_F90_Obj *vector,
204 hypre_F90_Int *ierr )
205 {
206 *ierr = (hypre_F90_Int)
207 ( HYPRE_StructVectorAssemble(
208 hypre_F90_PassObj (HYPRE_StructVector, vector) ) );
209 }
210
211 /*--------------------------------------------------------------------------
212 * HYPRE_StructVectorSetNumGhost
213 *--------------------------------------------------------------------------*/
214
215 void
hypre_F90_IFACE(hypre_structvectorsetnumghost,HYPRE_STRUCTVECTORSETNUMGHOST)216 hypre_F90_IFACE(hypre_structvectorsetnumghost, HYPRE_STRUCTVECTORSETNUMGHOST)
217 ( hypre_F90_Obj *vector,
218 hypre_F90_IntArray *num_ghost,
219 hypre_F90_Int *ierr )
220 {
221 *ierr = (hypre_F90_Int)
222 ( HYPRE_StructVectorSetNumGhost(
223 hypre_F90_PassObj (HYPRE_StructVector, vector),
224 hypre_F90_PassIntArray (num_ghost) ) );
225 }
226
227 /*--------------------------------------------------------------------------
228 * HYPRE_StructVectorCopy
229 *--------------------------------------------------------------------------*/
230
231 void
hypre_F90_IFACE(hypre_structvectorcopy,HYPRE_STRUCTVECTORCOPY)232 hypre_F90_IFACE(hypre_structvectorcopy, HYPRE_STRUCTVECTORCOPY)
233 ( hypre_F90_Obj *x,
234 hypre_F90_Obj *y,
235 hypre_F90_Int *ierr )
236 {
237 *ierr = (hypre_F90_Int)
238 ( HYPRE_StructVectorCopy(
239 hypre_F90_PassObj (HYPRE_StructVector, x),
240 hypre_F90_PassObj (HYPRE_StructVector, y) ) );
241 }
242
243 /*--------------------------------------------------------------------------
244 * HYPRE_StructVectorSetConstantValues
245 *--------------------------------------------------------------------------*/
246
247 void
hypre_F90_IFACE(hypre_structvectorsetconstantva,HYPRE_STRUCTVECTORSETCONSTANTVA)248 hypre_F90_IFACE(hypre_structvectorsetconstantva, HYPRE_STRUCTVECTORSETCONSTANTVA)
249 ( hypre_F90_Obj *vector,
250 hypre_F90_Complex *values,
251 hypre_F90_Int *ierr )
252 {
253 *ierr = (hypre_F90_Int)
254 ( HYPRE_StructVectorSetConstantValues(
255 hypre_F90_PassObj (HYPRE_StructVector, vector),
256 hypre_F90_PassComplex (values) ) );
257 }
258
259 /*--------------------------------------------------------------------------
260 * HYPRE_StructVectorGetMigrateCommPkg
261 *--------------------------------------------------------------------------*/
262
263 void
hypre_F90_IFACE(hypre_structvectorgetmigratecom,HYPRE_STRUCTVECTORGETMIGRATECOM)264 hypre_F90_IFACE(hypre_structvectorgetmigratecom, HYPRE_STRUCTVECTORGETMIGRATECOM)
265 ( hypre_F90_Obj *from_vector,
266 hypre_F90_Obj *to_vector,
267 hypre_F90_Obj *comm_pkg,
268 hypre_F90_Int *ierr )
269 {
270 *ierr = (hypre_F90_Int)
271 ( HYPRE_StructVectorGetMigrateCommPkg(
272 hypre_F90_PassObj (HYPRE_StructVector, from_vector),
273 hypre_F90_PassObj (HYPRE_StructVector, to_vector),
274 hypre_F90_PassObjRef (HYPRE_CommPkg, comm_pkg) ) );
275 }
276
277 /*--------------------------------------------------------------------------
278 * HYPRE_StructVectorMigrate
279 *--------------------------------------------------------------------------*/
280
281 void
hypre_F90_IFACE(hypre_structvectormigrate,HYPRE_STRUCTVECTORMIGRATE)282 hypre_F90_IFACE(hypre_structvectormigrate, HYPRE_STRUCTVECTORMIGRATE)
283 ( hypre_F90_Obj *comm_pkg,
284 hypre_F90_Obj *from_vector,
285 hypre_F90_Obj *to_vector,
286 hypre_F90_Int *ierr )
287 {
288 *ierr = (hypre_F90_Int)
289 ( HYPRE_StructVectorMigrate(
290 hypre_F90_PassObj (HYPRE_CommPkg, comm_pkg),
291 hypre_F90_PassObj (HYPRE_StructVector, from_vector),
292 hypre_F90_PassObj (HYPRE_StructVector, to_vector) ) );
293 }
294
295 /*--------------------------------------------------------------------------
296 * HYPRE_CommPkgDestroy
297 *--------------------------------------------------------------------------*/
298
299 void
hypre_F90_IFACE(hypre_destroycommpkg,HYPRE_DESTROYCOMMPKG)300 hypre_F90_IFACE(hypre_destroycommpkg, HYPRE_DESTROYCOMMPKG)
301 ( hypre_F90_Obj *comm_pkg,
302 hypre_F90_Int *ierr )
303 {
304 *ierr = (hypre_F90_Int)
305 ( HYPRE_CommPkgDestroy(
306 hypre_F90_PassObj (HYPRE_CommPkg, comm_pkg) ) );
307 }
308
309 /*--------------------------------------------------------------------------
310 * HYPRE_StructVectorPrint
311 *--------------------------------------------------------------------------*/
312
313 void
hypre_F90_IFACE(hypre_structvectorprint,HYPRE_STRUCTVECTORPRINT)314 hypre_F90_IFACE(hypre_structvectorprint, HYPRE_STRUCTVECTORPRINT)
315 (
316 hypre_F90_Obj *vector,
317 hypre_F90_Int *all,
318 hypre_F90_Int *ierr )
319 {
320 *ierr = (hypre_F90_Int)
321 ( HYPRE_StructVectorPrint(
322 "HYPRE_StructVector.out",
323 hypre_F90_PassObj (HYPRE_StructVector, vector),
324 hypre_F90_PassInt (all)) );
325 }
326
327 #ifdef __cplusplus
328 }
329 #endif
330