1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346
|
<center><a href="vecimpl.h">Actual source code: vecimpl.h</a></center><br>
<html>
<head>
<title></title>
<meta name="generator" content="c2html 0.9.5">
<meta name="date" content="2010-06-04T20:44:07+00:00">
</head>
<body bgcolor="#FFFFFF">
<pre width="80">
<a name="line2"> 2: </a><font color="#B22222">/* </font>
<a name="line3"> 3: </a><font color="#B22222"> This private file should not be included in users' code.</font>
<a name="line4"> 4: </a><font color="#B22222"> Defines the fields shared by all vector implementations.</font>
<a name="line6"> 6: </a><font color="#B22222">*/</font>
<a name="line8"> 8: </a><font color="#A020F0">#ifndef __VECIMPL_H</font>
<a name="line11"> 11: </a> #include <A href="../../../include/petscvec.h.html">petscvec.h</A>
<a name="line14"> 14: </a><font color="#B22222">/*S</font>
<a name="line15"> 15: </a><font color="#B22222"> <A href="../docs/manualpages/Vec/PetscLayout.html#PetscLayout">PetscLayout</A> - defines layout of vectors and matrices across processes (which rows are owned by which processes)</font>
<a name="line17"> 17: </a><font color="#B22222"> Level: developer</font>
<a name="line20"> 20: </a><font color="#B22222">.seealso: <A href="../docs/manualpages/Vec/PetscLayoutCreate.html#PetscLayoutCreate">PetscLayoutCreate</A>(), <A href="../docs/manualpages/Vec/PetscLayoutDestroy.html#PetscLayoutDestroy">PetscLayoutDestroy</A>()</font>
<a name="line21"> 21: </a><font color="#B22222">S*/</font>
<a name="line22"> 22: </a><font color="#4169E1">typedef struct _p_PetscLayout* <A href="../docs/manualpages/Vec/PetscLayout.html#PetscLayout">PetscLayout</A>;</font>
<a name="line23"> 23: </a><font color="#4169E1"><a name="_p_PetscLayout"></a>struct _p_PetscLayout</font>{
<a name="line24"> 24: </a> <A href="../docs/manualpages/Sys/MPI_Comm.html#MPI_Comm">MPI_Comm</A> comm;
<a name="line25"> 25: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> n,N; <font color="#B22222">/* local, global vector size */</font>
<a name="line26"> 26: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> rstart,rend; <font color="#B22222">/* local start, local end + 1 */</font>
<a name="line27"> 27: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> *range; <font color="#B22222">/* the offset of each processor */</font>
<a name="line28"> 28: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> bs; <font color="#B22222">/* number of elements in each block (generally for multi-component problems) Do NOT multiply above numbers by bs */</font>
<a name="line29"> 29: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> refcnt; <font color="#B22222">/* MPI <A href="../docs/manualpages/Vec/Vecs.html#Vecs">Vecs</A> obtained with <A href="../docs/manualpages/Vec/VecDuplicate.html#VecDuplicate">VecDuplicate</A>() and from <A href="../docs/manualpages/Mat/MatGetVecs.html#MatGetVecs">MatGetVecs</A>() reuse map of input object */</font>
<a name="line30"> 30: </a>};
<a name="line32"> 32: </a><strong><font color="#4169E1">EXTERN <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> <A href="../docs/manualpages/Vec/PetscLayoutCreate.html#PetscLayoutCreate">PetscLayoutCreate</A>(<A href="../docs/manualpages/Sys/MPI_Comm.html#MPI_Comm">MPI_Comm</A>,<A href="../docs/manualpages/Vec/PetscLayout.html#PetscLayout">PetscLayout</A>*)</font></strong>;
<a name="line33"> 33: </a><strong><font color="#4169E1">EXTERN <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> <A href="../docs/manualpages/Vec/PetscLayoutSetUp.html#PetscLayoutSetUp">PetscLayoutSetUp</A>(<A href="../docs/manualpages/Vec/PetscLayout.html#PetscLayout">PetscLayout</A>)</font></strong>;
<a name="line34"> 34: </a><strong><font color="#4169E1">EXTERN <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> <A href="../docs/manualpages/Vec/PetscLayoutDestroy.html#PetscLayoutDestroy">PetscLayoutDestroy</A>(<A href="../docs/manualpages/Vec/PetscLayout.html#PetscLayout">PetscLayout</A>)</font></strong>;
<a name="line35"> 35: </a><strong><font color="#4169E1">EXTERN <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> <A href="../docs/manualpages/Vec/PetscLayoutCopy.html#PetscLayoutCopy">PetscLayoutCopy</A>(<A href="../docs/manualpages/Vec/PetscLayout.html#PetscLayout">PetscLayout</A>,<A href="../docs/manualpages/Vec/PetscLayout.html#PetscLayout">PetscLayout</A>*)</font></strong>;
<a name="line36"> 36: </a><strong><font color="#4169E1">EXTERN <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> <A href="../docs/manualpages/Vec/PetscLayoutSetLocalSize.html#PetscLayoutSetLocalSize">PetscLayoutSetLocalSize</A>(<A href="../docs/manualpages/Vec/PetscLayout.html#PetscLayout">PetscLayout</A>,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>)</font></strong>;
<a name="line37"> 37: </a><strong><font color="#4169E1">EXTERN <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> <A href="../docs/manualpages/Vec/PetscLayoutGetLocalSize.html#PetscLayoutGetLocalSize">PetscLayoutGetLocalSize</A>(<A href="../docs/manualpages/Vec/PetscLayout.html#PetscLayout">PetscLayout</A>,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> *)</font></strong>;
<a name="line38"> 38: </a><strong><font color="#4169E1"><a name="etscPolymorphicFunction"></a><A href="../docs/manualpages/Sys/PetscPolymorphicFunction.html#PetscPolymorphicFunction">PetscPolymorphicFunction</A>(<A href="../docs/manualpages/Vec/PetscLayoutGetLocalSize.html#PetscLayoutGetLocalSize">PetscLayoutGetLocalSize</A>,(<A href="../docs/manualpages/Vec/PetscLayout.html#PetscLayout">PetscLayout</A> m)</font></strong>,(m,&s),<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>,s)
<a name="line39"> 39: </a><strong><font color="#4169E1">EXTERN <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> <A href="../docs/manualpages/Vec/PetscLayoutSetSize.html#PetscLayoutSetSize">PetscLayoutSetSize</A>(<A href="../docs/manualpages/Vec/PetscLayout.html#PetscLayout">PetscLayout</A>,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>)</font></strong>;
<a name="line40"> 40: </a><strong><font color="#4169E1">EXTERN <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> <A href="../docs/manualpages/Vec/PetscLayoutGetSize.html#PetscLayoutGetSize">PetscLayoutGetSize</A>(<A href="../docs/manualpages/Vec/PetscLayout.html#PetscLayout">PetscLayout</A>,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> *)</font></strong>;
<a name="line41"> 41: </a><strong><font color="#4169E1"><a name="etscPolymorphicFunction"></a><A href="../docs/manualpages/Sys/PetscPolymorphicFunction.html#PetscPolymorphicFunction">PetscPolymorphicFunction</A>(<A href="../docs/manualpages/Vec/PetscLayoutGetSize.html#PetscLayoutGetSize">PetscLayoutGetSize</A>,(<A href="../docs/manualpages/Vec/PetscLayout.html#PetscLayout">PetscLayout</A> m)</font></strong>,(m,&s),<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>,s)
<a name="line42"> 42: </a><strong><font color="#4169E1">EXTERN <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> <A href="../docs/manualpages/Vec/PetscLayoutSetBlockSize.html#PetscLayoutSetBlockSize">PetscLayoutSetBlockSize</A>(<A href="../docs/manualpages/Vec/PetscLayout.html#PetscLayout">PetscLayout</A>,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>)</font></strong>;
<a name="line43"> 43: </a><strong><font color="#4169E1">EXTERN <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> <A href="../docs/manualpages/Vec/PetscLayoutGetBlockSize.html#PetscLayoutGetBlockSize">PetscLayoutGetBlockSize</A>(<A href="../docs/manualpages/Vec/PetscLayout.html#PetscLayout">PetscLayout</A>,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>*)</font></strong>;
<a name="line44"> 44: </a><strong><font color="#4169E1">EXTERN <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> <A href="../docs/manualpages/Vec/PetscLayoutGetRange.html#PetscLayoutGetRange">PetscLayoutGetRange</A>(<A href="../docs/manualpages/Vec/PetscLayout.html#PetscLayout">PetscLayout</A>,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> *,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> *)</font></strong>;
<a name="line45"> 45: </a><strong><font color="#4169E1">EXTERN <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> <A href="../docs/manualpages/Vec/PetscLayoutGetRanges.html#PetscLayoutGetRanges">PetscLayoutGetRanges</A>(<A href="../docs/manualpages/Vec/PetscLayout.html#PetscLayout">PetscLayout</A>,const <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> *[])</font></strong>;
<a name="line47"> 47: </a><font color="#B22222">/* ----------------------------------------------------------------------------*/</font>
<a name="line49"> 49: </a><font color="#4169E1">typedef struct _VecOps *VecOps;</font>
<a name="line50"> 50: </a><font color="#4169E1"><a name="_VecOps"></a>struct _VecOps </font>{
<a name="line51"> 51: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*duplicate)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>*); <font color="#B22222">/* get single vector */</font>
<a name="line52"> 52: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*duplicatevecs)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>**); <font color="#B22222">/* get array of vectors */</font>
<a name="line53"> 53: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*destroyvecs)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>[],<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>); <font color="#B22222">/* free array of vectors */</font>
<a name="line54"> 54: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*dot)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A>*); <font color="#B22222">/* z = x^H * y */</font>
<a name="line55"> 55: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*mdot)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>,const <A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>[],<A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A>*); <font color="#B22222">/* z[j] = x dot y[j] */</font>
<a name="line56"> 56: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*norm)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Vec/NormType.html#NormType">NormType</A>,<A href="../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A>*); <font color="#B22222">/* z = sqrt(x^H * x) */</font>
<a name="line57"> 57: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*tdot)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A>*); <font color="#B22222">/* x'*y */</font>
<a name="line58"> 58: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*mtdot)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>,const <A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>[],<A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A>*);<font color="#B22222">/* z[j] = x dot y[j] */</font>
<a name="line59"> 59: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*scale)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A>); <font color="#B22222">/* x = alpha * x */</font>
<a name="line60"> 60: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*copy)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>); <font color="#B22222">/* y = x */</font>
<a name="line61"> 61: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*set)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A>); <font color="#B22222">/* y = alpha */</font>
<a name="line62"> 62: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*swap)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>); <font color="#B22222">/* exchange x and y */</font>
<a name="line63"> 63: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*axpy)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>); <font color="#B22222">/* y = y + alpha * x */</font>
<a name="line64"> 64: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*axpby)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A>,<A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>); <font color="#B22222">/* y = alpha * x + beta * y*/</font>
<a name="line65"> 65: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*maxpy)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>,const <A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A>*,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>*); <font color="#B22222">/* y = y + alpha[j] x[j] */</font>
<a name="line66"> 66: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*aypx)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>); <font color="#B22222">/* y = x + alpha * y */</font>
<a name="line67"> 67: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*waxpy)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>); <font color="#B22222">/* w = y + alpha * x */</font>
<a name="line68"> 68: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*axpbypcz)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A>,<A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A>,<A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>); <font color="#B22222">/* z = alpha * x + beta *y + gamma *z*/</font>
<a name="line69"> 69: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*pointwisemult)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>); <font color="#B22222">/* w = x .* y */</font>
<a name="line70"> 70: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*pointwisedivide)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>); <font color="#B22222">/* w = x ./ y */</font>
<a name="line71"> 71: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*setvalues)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>,const <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>[],const <A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A>[],<A href="../docs/manualpages/Sys/InsertMode.html#InsertMode">InsertMode</A>);
<a name="line72"> 72: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*assemblybegin)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>); <font color="#B22222">/* start global assembly */</font>
<a name="line73"> 73: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*assemblyend)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>); <font color="#B22222">/* end global assembly */</font>
<a name="line74"> 74: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*getarray)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A>**); <font color="#B22222">/* get data array */</font>
<a name="line75"> 75: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*getsize)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>*);
<a name="line76"> 76: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*getlocalsize)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>*);
<a name="line77"> 77: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*restorearray)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A>**); <font color="#B22222">/* restore data array */</font>
<a name="line78"> 78: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*max)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>*,<A href="../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A>*); <font color="#B22222">/* z = max(x); idx=index of max(x) */</font>
<a name="line79"> 79: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*min)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>*,<A href="../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A>*); <font color="#B22222">/* z = min(x); idx=index of min(x) */</font>
<a name="line80"> 80: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*setrandom)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/PetscRandom.html#PetscRandom">PetscRandom</A>); <font color="#B22222">/* set y[j] = random numbers */</font>
<a name="line81"> 81: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*setoption)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,VecOption,<A href="../docs/manualpages/Sys/PetscTruth.html#PetscTruth">PetscTruth</A>);
<a name="line82"> 82: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*setvaluesblocked)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>,const <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>[],const <A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A>[],<A href="../docs/manualpages/Sys/InsertMode.html#InsertMode">InsertMode</A>);
<a name="line83"> 83: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*destroy)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>);
<a name="line84"> 84: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*view)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Viewer/PetscViewer.html#PetscViewer">PetscViewer</A>);
<a name="line85"> 85: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*placearray)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,const <A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A>*); <font color="#B22222">/* place data array */</font>
<a name="line86"> 86: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*replacearray)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,const <A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A>*); <font color="#B22222">/* replace data array */</font>
<a name="line87"> 87: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*dot_local)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A>*);
<a name="line88"> 88: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*tdot_local)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A>*);
<a name="line89"> 89: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*norm_local)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Vec/NormType.html#NormType">NormType</A>,<A href="../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A>*);
<a name="line90"> 90: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*mdot_local)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>,const <A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>[],<A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A>*);
<a name="line91"> 91: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*mtdot_local)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>,const <A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>[],<A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A>*);
<a name="line92"> 92: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*loadintovector)(<A href="../docs/manualpages/Viewer/PetscViewer.html#PetscViewer">PetscViewer</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>);
<a name="line93"> 93: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*loadintovectornative)(<A href="../docs/manualpages/Viewer/PetscViewer.html#PetscViewer">PetscViewer</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>);
<a name="line94"> 94: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*reciprocal)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>);
<a name="line95"> 95: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*viewnative)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Viewer/PetscViewer.html#PetscViewer">PetscViewer</A>);
<a name="line96"> 96: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*conjugate)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>);
<a name="line97"> 97: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*setlocaltoglobalmapping)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/IS/ISLocalToGlobalMapping.html#ISLocalToGlobalMapping">ISLocalToGlobalMapping</A>);
<a name="line98"> 98: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*setvalueslocal)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>,const <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> *,const <A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A> *,<A href="../docs/manualpages/Sys/InsertMode.html#InsertMode">InsertMode</A>);
<a name="line99"> 99: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*resetarray)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>); <font color="#B22222">/* vector points to its original array, i.e. undoes any <A href="../docs/manualpages/Vec/VecPlaceArray.html#VecPlaceArray">VecPlaceArray</A>() */</font>
<a name="line100">100: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*setfromoptions)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>);
<a name="line101">101: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*maxpointwisedivide)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/PetscReal.html#PetscReal">PetscReal</A>*); <font color="#B22222">/* m = max abs(x ./ y) */</font>
<a name="line102">102: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*load)(<A href="../docs/manualpages/Viewer/PetscViewer.html#PetscViewer">PetscViewer</A>,const <A href="../docs/manualpages/Vec/VecType.html#VecType">VecType</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>*);
<a name="line103">103: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*pointwisemax)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>);
<a name="line104">104: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*pointwisemaxabs)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>);
<a name="line105">105: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*pointwisemin)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>);
<a name="line106">106: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*getvalues)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>,const <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>[],<A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A>[]);
<a name="line107">107: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*sqrt)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>);
<a name="line108">108: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*abs)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>);
<a name="line109">109: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*exp)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>);
<a name="line110">110: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*log)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>);
<a name="line111">111: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*shift)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>);
<a name="line112">112: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*create)(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>);
<a name="line113">113: </a>};
<a name="line115">115: </a><font color="#B22222">/* </font>
<a name="line116">116: </a><font color="#B22222"> The stash is used to temporarily store inserted vec values that </font>
<a name="line117">117: </a><font color="#B22222"> belong to another processor. During the assembly phase the stashed </font>
<a name="line118">118: </a><font color="#B22222"> values are moved to the correct processor and </font>
<a name="line119">119: </a><font color="#B22222">*/</font>
<a name="line121">121: </a><font color="#4169E1">typedef</font> <font color="#4169E1">struct</font> {
<a name="line122">122: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> nmax; <font color="#B22222">/* maximum stash size */</font>
<a name="line123">123: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> umax; <font color="#B22222">/* max stash size user wants */</font>
<a name="line124">124: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> oldnmax; <font color="#B22222">/* the nmax value used previously */</font>
<a name="line125">125: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> n; <font color="#B22222">/* stash size */</font>
<a name="line126">126: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> bs; <font color="#B22222">/* block size of the stash */</font>
<a name="line127">127: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> reallocs; <font color="#B22222">/* preserve the no of mallocs invoked */</font>
<a name="line128">128: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> *idx; <font color="#B22222">/* global row numbers in stash */</font>
<a name="line129">129: </a> <A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A> *array; <font color="#B22222">/* array to hold stashed values */</font>
<a name="line130">130: </a> <font color="#B22222">/* The following variables are used for communication */</font>
<a name="line131">131: </a> <A href="../docs/manualpages/Sys/MPI_Comm.html#MPI_Comm">MPI_Comm</A> comm;
<a name="line132">132: </a> <A href="../docs/manualpages/Sys/PetscMPIInt.html#PetscMPIInt">PetscMPIInt</A> size,rank;
<a name="line133">133: </a> <A href="../docs/manualpages/Sys/PetscMPIInt.html#PetscMPIInt">PetscMPIInt</A> tag1,tag2;
<a name="line134">134: </a> MPI_Request *send_waits; <font color="#B22222">/* array of send requests */</font>
<a name="line135">135: </a> MPI_Request *recv_waits; <font color="#B22222">/* array of receive requests */</font>
<a name="line136">136: </a> MPI_Status *send_status; <font color="#B22222">/* array of send status */</font>
<a name="line137">137: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> nsends,nrecvs; <font color="#B22222">/* numbers of sends and receives */</font>
<a name="line138">138: </a> <A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A> *svalues,*rvalues; <font color="#B22222">/* sending and receiving data */</font>
<a name="line139">139: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> *sindices,*rindices;
<a name="line140">140: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> rmax; <font color="#B22222">/* maximum message length */</font>
<a name="line141">141: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> *nprocs; <font color="#B22222">/* tmp data used both during scatterbegin and end */</font>
<a name="line142">142: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> nprocessed; <font color="#B22222">/* number of messages already processed */</font>
<a name="line143">143: </a> <A href="../docs/manualpages/Sys/PetscTruth.html#PetscTruth">PetscTruth</A> donotstash;
<a name="line144">144: </a> <A href="../docs/manualpages/Sys/PetscTruth.html#PetscTruth">PetscTruth</A> ignorenegidx; <font color="#B22222">/* ignore negative indices passed into <A href="../docs/manualpages/Vec/VecSetValues.html#VecSetValues">VecSetValues</A>/VetGetValues */</font>
<a name="line145">145: </a> <A href="../docs/manualpages/Sys/InsertMode.html#InsertMode">InsertMode</A> insertmode;
<a name="line146">146: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> *bowners;
<a name="line147">147: </a>} VecStash;
<a name="line149">149: </a><font color="#4169E1"><a name="_p_Vec"></a>struct _p_Vec </font>{
<a name="line150">150: </a> PETSCHEADER(<font color="#4169E1">struct _VecOps</font>);
<a name="line151">151: </a> <A href="../docs/manualpages/Vec/PetscLayout.html#PetscLayout">PetscLayout</A> map;
<a name="line152">152: </a> void *data; <font color="#B22222">/* implementation-specific data */</font>
<a name="line153">153: </a> <A href="../docs/manualpages/IS/ISLocalToGlobalMapping.html#ISLocalToGlobalMapping">ISLocalToGlobalMapping</A> mapping; <font color="#B22222">/* mapping used in <A href="../docs/manualpages/Vec/VecSetValuesLocal.html#VecSetValuesLocal">VecSetValuesLocal</A>() */</font>
<a name="line154">154: </a> <A href="../docs/manualpages/IS/ISLocalToGlobalMapping.html#ISLocalToGlobalMapping">ISLocalToGlobalMapping</A> bmapping; <font color="#B22222">/* mapping used in <A href="../docs/manualpages/Vec/VecSetValuesBlockedLocal.html#VecSetValuesBlockedLocal">VecSetValuesBlockedLocal</A>() */</font>
<a name="line155">155: </a> <A href="../docs/manualpages/Sys/PetscTruth.html#PetscTruth">PetscTruth</A> array_gotten;
<a name="line156">156: </a> VecStash stash,bstash; <font color="#B22222">/* used for storing off-proc values during assembly */</font>
<a name="line157">157: </a> <A href="../docs/manualpages/Sys/PetscTruth.html#PetscTruth">PetscTruth</A> petscnative; <font color="#B22222">/* means the ->data starts with VECHEADER and can use VecGetArrayFast()*/</font>
<a name="line158">158: </a>};
<a name="line160">160: </a><strong><font color="#228B22">#define <A href="../docs/manualpages/Vec/VecGetArray.html#VecGetArray">VecGetArray</A>(x,a) ((x)->petscnative ? (*(a) = *((<A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A> **)(x)->data),0) : VecGetArray_Private((x),(a)))</font></strong>
<a name="line161">161: </a><strong><font color="#228B22">#define <A href="../docs/manualpages/Vec/VecRestoreArray.html#VecRestoreArray">VecRestoreArray</A>(x,a) ((x)->petscnative ? <A href="../docs/manualpages/Sys/PetscObjectStateIncrease.html#PetscObjectStateIncrease">PetscObjectStateIncrease</A>((<A href="../docs/manualpages/Sys/PetscObject.html#PetscObject">PetscObject</A>)x) : VecRestoreArray_Private((x),(a)))</font></strong>
<a name="line163">163: </a><font color="#B22222">/*</font>
<a name="line164">164: </a><font color="#B22222"> Common header shared by array based vectors, </font>
<a name="line165">165: </a><font color="#B22222"> currently Vec_Seq and Vec_MPI</font>
<a name="line166">166: </a><font color="#B22222">*/</font>
<a name="line167">167: </a><strong><font color="#228B22">#define VECHEADER \</font></strong>
<a name="line168">168: </a><strong><font color="#228B22"> <A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A> *array; \</font></strong>
<a name="line169">169: </a><strong><font color="#228B22"> <A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A> *array_allocated; </font><font color="#B22222">/* if the array was allocated by PETSc this is its pointer */</font><font color="#228B22"> \</font></strong>
<a name="line170">170: </a><strong><font color="#228B22"> <A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A> *unplacedarray; </font><font color="#B22222">/* if one called <A href="../docs/manualpages/Vec/VecPlaceArray.html#VecPlaceArray">VecPlaceArray</A>(), this is where it stashed the original */</font><font color="#228B22"></font></strong>
<a name="line172">172: </a><font color="#B22222">/* Default obtain and release vectors; can be used by any implementation */</font>
<a name="line173">173: </a><strong><font color="#4169E1">EXTERN <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> VecDuplicateVecs_Default(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A> *[])</font></strong>;
<a name="line174">174: </a><strong><font color="#4169E1">EXTERN <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> VecDestroyVecs_Default(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A> [],<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>)</font></strong>;
<a name="line175">175: </a><strong><font color="#4169E1">EXTERN <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> VecLoadIntoVector_Default(<A href="../docs/manualpages/Viewer/PetscViewer.html#PetscViewer">PetscViewer</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>)</font></strong>;
<a name="line179">179: </a><font color="#B22222">/* --------------------------------------------------------------------*/</font>
<a name="line180">180: </a><font color="#B22222">/* */</font>
<a name="line181">181: </a><font color="#B22222">/* Defines the data structures used in the <A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A> Scatter operations */</font>
<a name="line183">183: </a><font color="#4169E1">typedef</font> <font color="#4169E1">enum</font> { VEC_SCATTER_SEQ_GENERAL,VEC_SCATTER_SEQ_STRIDE,
<a name="line184">184: </a> VEC_SCATTER_MPI_GENERAL,VEC_SCATTER_MPI_TOALL,
<a name="line185">185: </a> VEC_SCATTER_MPI_TOONE} VecScatterType;
<a name="line187">187: </a><font color="#B22222">/* </font>
<a name="line188">188: </a><font color="#B22222"> These scatters are for the purely local case.</font>
<a name="line189">189: </a><font color="#B22222">*/</font>
<a name="line190">190: </a><font color="#4169E1">typedef</font> <font color="#4169E1">struct</font> {
<a name="line191">191: </a> VecScatterType type;
<a name="line192">192: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> n; <font color="#B22222">/* number of components to scatter */</font>
<a name="line193">193: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> *vslots; <font color="#B22222">/* locations of components */</font>
<a name="line194">194: </a> <font color="#B22222">/*</font>
<a name="line195">195: </a><font color="#B22222"> The next three fields are used in parallel scatters, they contain </font>
<a name="line196">196: </a><font color="#B22222"> optimization in the special case that the "to" vector and the "from" </font>
<a name="line197">197: </a><font color="#B22222"> vector are the same, so one only needs copy components that truly </font>
<a name="line198">198: </a><font color="#B22222"> copies instead of just y[idx[i]] = y[jdx[i]] where idx[i] == jdx[i].</font>
<a name="line199">199: </a><font color="#B22222"> */</font>
<a name="line200">200: </a> <A href="../docs/manualpages/Sys/PetscTruth.html#PetscTruth">PetscTruth</A> nonmatching_computed;
<a name="line201">201: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> n_nonmatching; <font color="#B22222">/* number of "from"s != "to"s */</font>
<a name="line202">202: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> *slots_nonmatching; <font color="#B22222">/* locations of "from"s != "to"s */</font>
<a name="line203">203: </a> <A href="../docs/manualpages/Sys/PetscTruth.html#PetscTruth">PetscTruth</A> is_copy;
<a name="line204">204: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> copy_start; <font color="#B22222">/* local scatter is a copy starting at copy_start */</font>
<a name="line205">205: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> copy_length;
<a name="line206">206: </a>} VecScatter_Seq_General;
<a name="line208">208: </a><font color="#4169E1">typedef</font> <font color="#4169E1">struct</font> {
<a name="line209">209: </a> VecScatterType type;
<a name="line210">210: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> n;
<a name="line211">211: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> first;
<a name="line212">212: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> step;
<a name="line213">213: </a>} VecScatter_Seq_Stride;
<a name="line215">215: </a><font color="#B22222">/*</font>
<a name="line216">216: </a><font color="#B22222"> This scatter is for a global vector copied (completely) to each processor (or all to one)</font>
<a name="line217">217: </a><font color="#B22222">*/</font>
<a name="line218">218: </a><font color="#4169E1">typedef</font> <font color="#4169E1">struct</font> {
<a name="line219">219: </a> VecScatterType type;
<a name="line220">220: </a> <A href="../docs/manualpages/Sys/PetscMPIInt.html#PetscMPIInt">PetscMPIInt</A> *count; <font color="#B22222">/* elements of vector on each processor */</font>
<a name="line221">221: </a> <A href="../docs/manualpages/Sys/PetscMPIInt.html#PetscMPIInt">PetscMPIInt</A> *displx;
<a name="line222">222: </a> <A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A> *work1;
<a name="line223">223: </a> <A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A> *work2;
<a name="line224">224: </a>} VecScatter_MPI_ToAll;
<a name="line226">226: </a><font color="#B22222">/*</font>
<a name="line227">227: </a><font color="#B22222"> This is the general parallel scatter</font>
<a name="line228">228: </a><font color="#B22222">*/</font>
<a name="line229">229: </a><font color="#4169E1">typedef</font> <font color="#4169E1">struct</font> {
<a name="line230">230: </a> VecScatterType type;
<a name="line231">231: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> n; <font color="#B22222">/* number of processors to send/receive */</font>
<a name="line232">232: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> *starts; <font color="#B22222">/* starting point in indices and values for each proc*/</font>
<a name="line233">233: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> *indices; <font color="#B22222">/* list of all components sent or received */</font>
<a name="line234">234: </a> <A href="../docs/manualpages/Sys/PetscMPIInt.html#PetscMPIInt">PetscMPIInt</A> *procs; <font color="#B22222">/* processors we are communicating with in scatter */</font>
<a name="line235">235: </a> MPI_Request *requests,*rev_requests;
<a name="line236">236: </a> <A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A> *values; <font color="#B22222">/* buffer for all sends or receives */</font>
<a name="line237">237: </a> VecScatter_Seq_General local; <font color="#B22222">/* any part that happens to be local */</font>
<a name="line238">238: </a> MPI_Status *sstatus,*rstatus;
<a name="line239">239: </a> <A href="../docs/manualpages/Sys/PetscTruth.html#PetscTruth">PetscTruth</A> use_readyreceiver;
<a name="line240">240: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> bs;
<a name="line241">241: </a> <A href="../docs/manualpages/Sys/PetscTruth.html#PetscTruth">PetscTruth</A> sendfirst;
<a name="line242">242: </a> <A href="../docs/manualpages/Sys/PetscTruth.html#PetscTruth">PetscTruth</A> contiq;
<a name="line243">243: </a> <font color="#B22222">/* for <A href="http://www.mcs.anl.gov/mpi/www/www3/MPI_Alltoallv.html#MPI_Alltoallv">MPI_Alltoallv</A>() approach */</font>
<a name="line244">244: </a> <A href="../docs/manualpages/Sys/PetscTruth.html#PetscTruth">PetscTruth</A> use_alltoallv;
<a name="line245">245: </a> <A href="../docs/manualpages/Sys/PetscMPIInt.html#PetscMPIInt">PetscMPIInt</A> *counts,*displs;
<a name="line246">246: </a> <font color="#B22222">/* for MPI_Alltoallw() approach */</font>
<a name="line247">247: </a> <A href="../docs/manualpages/Sys/PetscTruth.html#PetscTruth">PetscTruth</A> use_alltoallw;
<a name="line248">248: </a><font color="#A020F0">#if defined(PETSC_HAVE_MPI_ALLTOALLW)</font>
<a name="line249">249: </a> <A href="../docs/manualpages/Sys/PetscMPIInt.html#PetscMPIInt">PetscMPIInt</A> *wcounts,*wdispls;
<a name="line250">250: </a> MPI_Datatype *types;
<a name="line251">251: </a><font color="#A020F0">#endif</font>
<a name="line252">252: </a> <A href="../docs/manualpages/Sys/PetscTruth.html#PetscTruth">PetscTruth</A> use_window;
<a name="line253">253: </a><font color="#A020F0">#if defined(PETSC_HAVE_MPI_WIN_CREATE)</font>
<a name="line254">254: </a> MPI_Win window;
<a name="line255">255: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> *winstarts; <font color="#B22222">/* displacements in the processes I am putting to */</font>
<a name="line256">256: </a><font color="#A020F0">#endif</font>
<a name="line257">257: </a>} VecScatter_MPI_General;
<a name="line259">259: </a><font color="#4169E1"><a name="_p_VecScatter"></a>struct _p_VecScatter </font>{
<a name="line260">260: </a> PETSCHEADER(int);
<a name="line261">261: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> to_n,from_n;
<a name="line262">262: </a> <A href="../docs/manualpages/Sys/PetscTruth.html#PetscTruth">PetscTruth</A> inuse; <font color="#B22222">/* prevents corruption from mixing two scatters */</font>
<a name="line263">263: </a> <A href="../docs/manualpages/Sys/PetscTruth.html#PetscTruth">PetscTruth</A> beginandendtogether; <font color="#B22222">/* indicates that the scatter begin and end function are called together, <A href="../docs/manualpages/Vec/VecScatterEnd.html#VecScatterEnd">VecScatterEnd</A>()</font>
<a name="line264">264: </a><font color="#B22222"> is then treated as a nop */</font>
<a name="line265">265: </a> <A href="../docs/manualpages/Sys/PetscTruth.html#PetscTruth">PetscTruth</A> packtogether; <font color="#B22222">/* packs all the messages before sending, same with receive */</font>
<a name="line266">266: </a> <A href="../docs/manualpages/Sys/PetscTruth.html#PetscTruth">PetscTruth</A> reproduce; <font color="#B22222">/* always receive the ghost points in the same order of processes */</font>
<a name="line267">267: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*begin)(<A href="../docs/manualpages/Vec/VecScatter.html#VecScatter">VecScatter</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/InsertMode.html#InsertMode">InsertMode</A>,<A href="../docs/manualpages/Sys/ScatterMode.html#ScatterMode">ScatterMode</A>);
<a name="line268">268: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*end)(<A href="../docs/manualpages/Vec/VecScatter.html#VecScatter">VecScatter</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>,<A href="../docs/manualpages/Sys/InsertMode.html#InsertMode">InsertMode</A>,<A href="../docs/manualpages/Sys/ScatterMode.html#ScatterMode">ScatterMode</A>);
<a name="line269">269: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*copy)(<A href="../docs/manualpages/Vec/VecScatter.html#VecScatter">VecScatter</A>,<A href="../docs/manualpages/Vec/VecScatter.html#VecScatter">VecScatter</A>);
<a name="line270">270: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*destroy)(<A href="../docs/manualpages/Vec/VecScatter.html#VecScatter">VecScatter</A>);
<a name="line271">271: </a> <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> (*view)(<A href="../docs/manualpages/Vec/VecScatter.html#VecScatter">VecScatter</A>,<A href="../docs/manualpages/Viewer/PetscViewer.html#PetscViewer">PetscViewer</A>);
<a name="line272">272: </a> void *fromdata,*todata;
<a name="line273">273: </a>};
<a name="line275">275: </a><strong><font color="#4169E1">EXTERN <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> VecStashCreate_Private(<A href="../docs/manualpages/Sys/MPI_Comm.html#MPI_Comm">MPI_Comm</A>,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>,VecStash*)</font></strong>;
<a name="line276">276: </a><strong><font color="#4169E1">EXTERN <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> VecStashDestroy_Private(VecStash*)</font></strong>;
<a name="line277">277: </a><strong><font color="#4169E1">EXTERN <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> VecStashExpand_Private(VecStash*,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>)</font></strong>;
<a name="line278">278: </a><strong><font color="#4169E1">EXTERN <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> VecStashScatterEnd_Private(VecStash*)</font></strong>;
<a name="line279">279: </a><strong><font color="#4169E1">EXTERN <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> VecStashSetInitialSize_Private(VecStash*,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>)</font></strong>;
<a name="line280">280: </a><strong><font color="#4169E1">EXTERN <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> VecStashGetInfo_Private(VecStash*,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>*,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>*)</font></strong>;
<a name="line281">281: </a><strong><font color="#4169E1">EXTERN <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> VecStashScatterBegin_Private(VecStash*,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>*)</font></strong>;
<a name="line282">282: </a><strong><font color="#4169E1">EXTERN <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> VecStashScatterGetMesg_Private(VecStash*,<A href="../docs/manualpages/Sys/PetscMPIInt.html#PetscMPIInt">PetscMPIInt</A>*,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>**,<A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A>**,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A>*)</font></strong>;
<a name="line284">284: </a><font color="#B22222">/*</font>
<a name="line285">285: </a><font color="#B22222"> VecStashValue_Private - inserts a single value into the stash.</font>
<a name="line287">287: </a><font color="#B22222"> Input Parameters:</font>
<a name="line288">288: </a><font color="#B22222"> stash - the stash</font>
<a name="line289">289: </a><font color="#B22222"> idx - the global of the inserted value</font>
<a name="line290">290: </a><font color="#B22222"> values - the value inserted</font>
<a name="line291">291: </a><font color="#B22222">*/</font>
<a name="line292">292: </a><strong><font color="#4169E1"><a name="VecStashValue_Private"></a>PETSC_STATIC_INLINE <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> VecStashValue_Private(VecStash *stash,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> row,<A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A> value)</font></strong>
<a name="line293">293: </a>{
<a name="line295">295: </a> <font color="#B22222">/* Check and see if we have sufficient memory */</font>
<a name="line296">296: </a> <font color="#4169E1">if</font> (((stash)->n + 1) > (stash)->nmax) {
<a name="line297">297: </a> VecStashExpand_Private(stash,1);
<a name="line298">298: </a> }
<a name="line299">299: </a> (stash)->idx[(stash)->n] = row;
<a name="line300">300: </a> (stash)->array[(stash)->n] = value;
<a name="line301">301: </a> (stash)->n++;
<a name="line302">302: </a> <font color="#4169E1">return</font> 0;
<a name="line303">303: </a>}
<a name="line305">305: </a><font color="#B22222">/*</font>
<a name="line306">306: </a><font color="#B22222"> VecStashValuesBlocked_Private - inserts 1 block of values into the stash. </font>
<a name="line308">308: </a><font color="#B22222"> Input Parameters:</font>
<a name="line309">309: </a><font color="#B22222"> stash - the stash</font>
<a name="line310">310: </a><font color="#B22222"> idx - the global block index</font>
<a name="line311">311: </a><font color="#B22222"> values - the values inserted</font>
<a name="line312">312: </a><font color="#B22222">*/</font>
<a name="line313">313: </a><strong><font color="#4169E1"><a name="VecStashValuesBlocked_Private"></a>PETSC_STATIC_INLINE <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> VecStashValuesBlocked_Private(VecStash *stash,<A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> row,<A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A> *values)</font></strong>
<a name="line314">314: </a>{
<a name="line315">315: </a> <A href="../docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</A> jj,stash_bs=(stash)->bs;
<a name="line316">316: </a> <A href="../docs/manualpages/Sys/PetscScalar.html#PetscScalar">PetscScalar</A> *array;
<a name="line318">318: </a> <font color="#4169E1">if</font> (((stash)->n+1) > (stash)->nmax) {
<a name="line319">319: </a> VecStashExpand_Private(stash,1);
<a name="line320">320: </a> }
<a name="line321">321: </a> array = (stash)->array + stash_bs*(stash)->n;
<a name="line322">322: </a> (stash)->idx[(stash)->n] = row;
<a name="line323">323: </a> <font color="#4169E1">for</font> (jj=0; jj<stash_bs; jj++) { array[jj] = values[jj];}
<a name="line324">324: </a> (stash)->n++;
<a name="line325">325: </a> <font color="#4169E1">return</font> 0;
<a name="line326">326: </a>}
<a name="line328">328: </a><strong><font color="#4169E1">EXTERN <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> VecReciprocal_Default(<A href="../docs/manualpages/Vec/Vec.html#Vec">Vec</A>)</font></strong>;
<a name="line336">336: </a><font color="#A020F0">#if defined(PETSC_HAVE_MATLAB_ENGINE)</font>
<a name="line338">338: </a><strong><font color="#4169E1">EXTERN <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> VecMatlabEnginePut_Default(<A href="../docs/manualpages/Sys/PetscObject.html#PetscObject">PetscObject</A>,void*)</font></strong>;
<a name="line339">339: </a><strong><font color="#4169E1">EXTERN <A href="../docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> VecMatlabEngineGet_Default(<A href="../docs/manualpages/Sys/PetscObject.html#PetscObject">PetscObject</A>,void*)</font></strong>;
<a name="line341">341: </a><font color="#A020F0">#endif</font>
<a name="line344">344: </a><font color="#A020F0">#endif</font>
</pre>
</body>
</html>
|