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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML3.2 EN">
<HTML>
<HEAD> <link rel="canonical" href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscCopyMode.html" />
<META NAME="GENERATOR" CONTENT="DOCTEXT">
<TITLE>PetscCopyMode</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/Sys/PetscCopyMode.html "><small>Report Typos and Errors</small></a></div>
<A NAME="PetscCopyMode"><H1>PetscCopyMode</H1></A>
Determines how an array or <A HREF="../Sys/PetscObject.html#PetscObject">PetscObject</A> passed to certain functions is copied or retained by the aggregate <A HREF="../Sys/PetscObject.html#PetscObject">PetscObject</A>
<H3><FONT COLOR="#CC3333">Synopsis</FONT></H3>
<PRE>
typedef enum {<A HREF="../Sys/PetscCopyMode.html#PetscCopyMode">PETSC_COPY_VALUES</A>, <A HREF="../Sys/PetscCopyMode.html#PetscCopyMode">PETSC_OWN_POINTER</A>, <A HREF="../Sys/PetscCopyMode.html#PetscCopyMode">PETSC_USE_POINTER</A>} <A HREF="../Sys/PetscCopyMode.html#PetscCopyMode">PetscCopyMode</A>;
</PRE>
<P>
<H3><FONT COLOR="#CC3333">For the array input</FONT></H3>
<pre>
<A HREF="../Sys/PetscCopyMode.html#PetscCopyMode">PETSC_COPY_VALUES</A> - the array values are copied into new space, the user is free to reuse or delete the passed in array
</pre>
<pre>
<A HREF="../Sys/PetscCopyMode.html#PetscCopyMode">PETSC_OWN_POINTER</A> - the array values are NOT copied, the object takes ownership of the array and will free it later, the user cannot change or
</pre>
<pre>
delete the array. The array MUST have been obtained with <A HREF="../Sys/PetscMalloc.html#PetscMalloc">PetscMalloc</A>(). Hence this mode cannot be used in Fortran.
</pre>
<pre>
<A HREF="../Sys/PetscCopyMode.html#PetscCopyMode">PETSC_USE_POINTER</A> - the array values are NOT copied, the object uses the array but does NOT take ownership of the array. The user cannot use
</pre>
<pre>
the array but the user must delete the array after the object is destroyed.
</pre>
<P>
<H3><FONT COLOR="#CC3333">For the PetscObject input</FONT></H3>
<pre>
<A HREF="../Sys/PetscCopyMode.html#PetscCopyMode">PETSC_COPY_VALUES</A> - the input <A HREF="../Sys/PetscObject.html#PetscObject">PetscObject</A> is cloned into the aggregate <A HREF="../Sys/PetscObject.html#PetscObject">PetscObject</A>; the user is free to reuse/modify the input <A HREF="../Sys/PetscObject.html#PetscObject">PetscObject</A> without side effects.
</pre>
<pre>
<A HREF="../Sys/PetscCopyMode.html#PetscCopyMode">PETSC_OWN_POINTER</A> - the input <A HREF="../Sys/PetscObject.html#PetscObject">PetscObject</A> is referenced by pointer (with reference count), thus should not be modified by the user. (Modification may cause errors or unintended side-effects in this or a future version of PETSc.)
</pre>
For either case above, the input <A HREF="../Sys/PetscObject.html#PetscObject">PetscObject</A> should be destroyed by the user when no longer needed (the aggregate object increases its reference count).
<pre>
<A HREF="../Sys/PetscCopyMode.html#PetscCopyMode">PETSC_USE_POINTER</A> - invalid for <A HREF="../Sys/PetscObject.html#PetscObject">PetscObject</A> inputs.
</pre>
<P>
<P><B></B><H3><FONT COLOR="#CC3333">Level</FONT></H3>beginner<BR>
<H3><FONT COLOR="#CC3333">Location</FONT></H3>
</B><A HREF="../../../include/petscsystypes.h.html#PetscCopyMode">include/petscsystypes.h</A>
<P><H3><FONT COLOR="#CC3333">Examples</FONT></H3>
<A HREF="../../../src/vec/vec/utils/tagger/tutorials/ex1.c.html">src/vec/vec/utils/tagger/tutorials/ex1.c.html</A><BR>
<A HREF="../../../src/vec/vec/tutorials/ex8.c.html">src/vec/vec/tutorials/ex8.c.html</A><BR>
<A HREF="../../../src/vec/is/is/tutorials/ex1.c.html">src/vec/is/is/tutorials/ex1.c.html</A><BR>
<A HREF="../../../src/vec/is/is/tutorials/ex3.c.html">src/vec/is/is/tutorials/ex3.c.html</A><BR>
<A HREF="../../../src/vec/is/is/tutorials/ex4.c.html">src/vec/is/is/tutorials/ex4.c.html</A><BR>
<A HREF="../../../src/vec/is/is/tutorials/ex5.c.html">src/vec/is/is/tutorials/ex5.c.html</A><BR>
<A HREF="../../../src/vec/is/is/tutorials/ex1f.F.html">src/vec/is/is/tutorials/ex1f.F.html</A><BR>
<A HREF="../../../src/vec/is/is/tutorials/ex1f90.F90.html">src/vec/is/is/tutorials/ex1f90.F90.html</A><BR>
<A HREF="../../../src/vec/is/is/tutorials/ex3f90.F90.html">src/vec/is/is/tutorials/ex3f90.F90.html</A><BR>
<A HREF="../../../src/vec/is/sf/tutorials/ex1.c.html">src/vec/is/sf/tutorials/ex1.c.html</A><BR>
<A HREF="../../../src/vec/is/sf/tutorials/ex2.c.html">src/vec/is/sf/tutorials/ex2.c.html</A><BR>
<BR><A HREF="./index.html">Index of all Sys 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>
|