File: PetscMalloc1.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 (72 lines) | stat: -rw-r--r-- 4,182 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<!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/PetscMalloc1.html" />
<META NAME="GENERATOR" CONTENT="DOCTEXT">
<TITLE>PetscMalloc1</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/PetscMalloc1.html "><small>Report Typos and Errors</small></a></div>
<A NAME="PetscMalloc1"><H1>PetscMalloc1</H1></A>
Allocates an array of memory aligned to PETSC_MEMALIGN 
<H3><FONT COLOR="#CC3333">Synopsis</FONT></H3>
<PRE>
#include &lt;petscsys.h&gt;
<A HREF="../Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> <A HREF="../Sys/PetscMalloc1.html#PetscMalloc1">PetscMalloc1</A>(size_t m1,type **r1)
</PRE>
Not Collective
<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>m1 </B></TD><TD>- number of elements to allocate  (may be zero)
</TD></TR></TABLE>
<P>
<H3><FONT COLOR="#CC3333">Output Parameter</FONT></H3>
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>r1 </B></TD><TD>- memory allocated
</TD></TR></TABLE>
<P>
<H3><FONT COLOR="#CC3333">Note</FONT></H3>
This uses the sizeof() of the memory type requested to determine the total memory to be allocated, therefore you should not
multiply the number of elements requested by the sizeof() the type. For example use
<pre>
 <A HREF="../Sys/PetscInt.html#PetscInt">PetscInt</A> *id;
</pre>
<pre>
 <A HREF="../Sys/PetscMalloc1.html#PetscMalloc1">PetscMalloc1</A>(10,&amp;id);
</pre>
not
<pre>
 <A HREF="../Sys/PetscInt.html#PetscInt">PetscInt</A> *id;
</pre>
<pre>
 <A HREF="../Sys/PetscMalloc1.html#PetscMalloc1">PetscMalloc1</A>(10*sizeof(<A HREF="../Sys/PetscInt.html#PetscInt">PetscInt</A>),&amp;id);
</pre>
<P>
Does not zero the memory allocated, use <A HREF="../Sys/PetscCalloc1.html#PetscCalloc1">PetscCalloc1</A>() to obtain memory that has been zeroed.
<P>

<P>
<H3><FONT COLOR="#CC3333">See Also</FONT></H3>
 <A HREF="../Sys/PetscFree.html#PetscFree">PetscFree</A>(), <A HREF="../Sys/PetscNew.html#PetscNew">PetscNew</A>(), <A HREF="../Sys/PetscMalloc.html#PetscMalloc">PetscMalloc</A>(), <A HREF="../Sys/PetscCalloc1.html#PetscCalloc1">PetscCalloc1</A>(), <A HREF="../Sys/PetscMalloc2.html#PetscMalloc2">PetscMalloc2</A>()
<BR>
<P>
<P><B></B><H3><FONT COLOR="#CC3333">Level</FONT></H3>beginner<BR>
<H3><FONT COLOR="#CC3333">Location</FONT></H3>
</B><A HREF="../../../include/petscsys.h.html#PetscMalloc1">include/petscsys.h</A>
<P><H3><FONT COLOR="#CC3333">Examples</FONT></H3>
<A HREF="../../../src/sys/classes/random/tutorials/ex1.c.html">src/sys/classes/random/tutorials/ex1.c.html</A><BR>
<A HREF="../../../src/sys/classes/random/tutorials/ex2.c.html">src/sys/classes/random/tutorials/ex2.c.html</A><BR>
<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/ex6.c.html">src/vec/vec/tutorials/ex6.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/vec/tutorials/ex9.c.html">src/vec/vec/tutorials/ex9.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/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>
<A HREF="../../../src/mat/tutorials/ex2.c.html">src/mat/tutorials/ex2.c.html</A><BR>
<A HREF="../../../src/mat/tutorials/ex9.c.html">src/mat/tutorials/ex9.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>