File: VecLockWriteSet_Private.html

package info (click to toggle)
petsc 3.14.5%2Bdfsg1-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 266,472 kB
  • sloc: ansic: 680,898; python: 33,303; cpp: 16,324; makefile: 14,022; f90: 13,731; javascript: 10,713; fortran: 9,581; sh: 1,373; xml: 619; objc: 445; csh: 192; pascal: 148; java: 13
file content (54 lines) | stat: -rw-r--r-- 4,305 bytes parent folder | download
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML3.2 EN">
<HTML>
<HEAD> <link rel="canonical" href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecLockWriteSet_Private.html" />
<META NAME="GENERATOR" CONTENT="DOCTEXT">
<TITLE>VecLockWriteSet_Private</TITLE>
</HEAD>
<BODY BGCOLOR="FFFFFF">
   <div id="version" align=right><b>petsc-3.14.5 2021-03-03</b></div>
   <div id="bugreport" align=right><a href="mailto:petsc-maint@mcs.anl.gov?subject=Typo or Error in Documentation &body=Please describe the typo or error in the documentation: petsc-3.14.5 v3.14.5 docs/manualpages/Vec/VecLockWriteSet_Private.html "><small>Report Typos and Errors</small></a></div>
<A NAME="VecLockWriteSet_Private"><H1>VecLockWriteSet_Private</H1></A>
Lock or unlock a vector for exclusive read/write access 
<H3><FONT COLOR="#CC3333">Synopsis</FONT></H3>
<PRE>
#include "petscvec.h"   
<A HREF="../Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> <A HREF="../Vec/VecLockWriteSet_Private.html#VecLockWriteSet_Private">VecLockWriteSet_Private</A>(<A HREF="../Vec/Vec.html#Vec">Vec</A> x,<A HREF="../Sys/PetscBool.html#PetscBool">PetscBool</A> flg)
</PRE>
Logically Collective on <A HREF="../Vec/Vec.html#Vec">Vec</A>
<P>
<H3><FONT COLOR="#CC3333">Input Parameter</FONT></H3>
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>x   </B></TD><TD>- the vector
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>flg </B></TD><TD>- <A HREF="../Sys/PETSC_TRUE.html#PETSC_TRUE">PETSC_TRUE</A> to lock the vector for writing; <A HREF="../Sys/PETSC_FALSE.html#PETSC_FALSE">PETSC_FALSE</A> to unlock it.
</TD></TR></TABLE>
<P>
<H3><FONT COLOR="#CC3333">Notes</FONT></H3>
The function is usefull in split-phase computations, which usually have a begin phase and an end phase.
One can call <A HREF="../Vec/VecLockWriteSet_Private.html#VecLockWriteSet_Private">VecLockWriteSet_Private</A>(x,<A HREF="../Sys/PETSC_TRUE.html#PETSC_TRUE">PETSC_TRUE</A>) in the begin phase to lock a vector for exclusive
access, and call <A HREF="../Vec/VecLockWriteSet_Private.html#VecLockWriteSet_Private">VecLockWriteSet_Private</A>(x,<A HREF="../Sys/PETSC_FALSE.html#PETSC_FALSE">PETSC_FALSE</A>) in the end phase to unlock the vector from exclusive
access. In this way, one is ensured no other operations can access the vector in between. The code may like
<P>
<P>
<A HREF="../Vec/VecGetArray.html#VecGetArray">VecGetArray</A>(x,&amp;xdata); // begin phase
<A HREF="../Vec/VecLockWriteSet_Private.html#VecLockWriteSet_Private">VecLockWriteSet_Private</A>(v,<A HREF="../Sys/PETSC_TRUE.html#PETSC_TRUE">PETSC_TRUE</A>);
<P>
Other operations, which can not acceess x anymore (they can access xdata, of course)
<P>
<A HREF="../Vec/VecRestoreArray.html#VecRestoreArray">VecRestoreArray</A>(x,&amp;vdata); // end phase
<A HREF="../Vec/VecLockWriteSet_Private.html#VecLockWriteSet_Private">VecLockWriteSet_Private</A>(v,<A HREF="../Sys/PETSC_FALSE.html#PETSC_FALSE">PETSC_FALSE</A>);
<P>
The call can not be nested on the same vector, in other words, one can not call <A HREF="../Vec/VecLockWriteSet_Private.html#VecLockWriteSet_Private">VecLockWriteSet_Private</A>(x,<A HREF="../Sys/PETSC_TRUE.html#PETSC_TRUE">PETSC_TRUE</A>)
again before calling <A HREF="../Vec/VecLockWriteSet_Private.html#VecLockWriteSet_Private">VecLockWriteSet_Private</A>(v,<A HREF="../Sys/PETSC_FALSE.html#PETSC_FALSE">PETSC_FALSE</A>).
<P>

<P>
<H3><FONT COLOR="#CC3333">See Also</FONT></H3>
 <A HREF="../Vec/VecRestoreArray.html#VecRestoreArray">VecRestoreArray</A>(), <A HREF="../Vec/VecGetArrayRead.html#VecGetArrayRead">VecGetArrayRead</A>(), <A HREF="../Vec/VecLockReadPush.html#VecLockReadPush">VecLockReadPush</A>(), <A HREF="../Vec/VecLockReadPop.html#VecLockReadPop">VecLockReadPop</A>(), <A HREF="../Vec/VecLockGet.html#VecLockGet">VecLockGet</A>()
<BR><P><B></B><H3><FONT COLOR="#CC3333">Level</FONT></H3>beginner<BR>
<H3><FONT COLOR="#CC3333">Location</FONT></H3>
</B><A HREF="../../../src/vec/vec/interface/rvector.c.html#VecLockWriteSet_Private">src/vec/vec/interface/rvector.c</A>
<BR><A HREF="./index.html">Index of all Vec routines</A>
<BR><A HREF="../../index.html">Table of Contents for all manual pages</A>
<BR><A HREF="../singleindex.html">Index of all manual pages</A>
</BODY></HTML>