PLplot
5.15.0
Toggle main menu visibility
Loading...
Searching...
No Matches
plmem.c
Go to the documentation of this file.
1
// xId: plmem.c 11966 2011-10-14 07:10:05Z andrewross $
2
//
3
// plmem.c
4
//
5
// Copyright (C) 1992, 1993, 1994, 1995
6
// Maurice LeBrun mjl@dino.ph.utexas.edu
7
// Institute for Fusion Studies University of Texas at Austin
8
//
9
// Copyright (C) 2004 Joao Cardoso
10
// Copyright (C) 2004-2018 Alan W. Irwin
11
// Copyright (C) 2004 Andrew Ross
12
//
13
// This file is part of PLplot.
14
//
15
// PLplot is free software; you can redistribute it and/or modify
16
// it under the terms of the GNU Library General Public License as published
17
// by the Free Software Foundation; either version 2 of the License, or
18
// (at your option) any later version.
19
//
20
// PLplot is distributed in the hope that it will be useful,
21
// but WITHOUT ANY WARRANTY; without even the implied warranty of
22
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
// GNU Library General Public License for more details.
24
//
25
// You should have received a copy of the GNU Library General Public License
26
// along with PLplot; if not, write to the Free Software
27
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
28
//
29
//--------------------------------------------------------------------------
30
//
31
36
37
#include "
plplotP.h
"
38
39
//--------------------------------------------------------------------------
40
//
58
//--------------------------------------------------------------------------
59
60
void
61
plStatic2dGrid
(
PLFLT_NC_MATRIX
zIliffe,
PLFLT_VECTOR
zStatic,
PLINT
nx,
PLINT
ny )
62
{
63
PLINT
i;
64
65
for
( i = 0; i < nx; i++ )
66
{
67
zIliffe[i] = (
PLFLT_NC_SCALAR
) ( zStatic + i * ny );
68
}
69
}
70
71
//--------------------------------------------------------------------------
72
//
88
//--------------------------------------------------------------------------
89
90
void
91
plAlloc2dGrid
(
PLFLT
***f,
PLINT
nx,
PLINT
ny )
92
{
93
PLINT
i;
94
95
if
( ( *f = (
PLFLT
**) calloc( (
size_t
) nx,
sizeof
(
PLFLT
* ) ) ) == NULL )
96
plexit
(
"Memory allocation error in \"plAlloc2dGrid\""
);
97
98
for
( i = 0; i < nx; i++ )
99
{
100
if
( ( ( *f )[i] = (
PLFLT
*) calloc( (
size_t
) ny,
sizeof
(
PLFLT
) ) ) == NULL )
101
plexit
(
"Memory allocation error in \"plAlloc2dGrid\""
);
102
}
103
}
104
105
//--------------------------------------------------------------------------
106
// plFree2dGrid()
107
//
113
//--------------------------------------------------------------------------
114
115
void
116
plFree2dGrid
(
PLFLT
**f,
PLINT
nx,
PLINT
PL_UNUSED
( ny ) )
117
{
118
PLINT
i;
119
120
for
( i = 0; i < nx; i++ )
121
free( (
void
*) f[i] );
122
123
free( (
void
*) f );
124
}
125
126
//--------------------------------------------------------------------------
127
// plMinMax2dGrid()
128
//
138
//--------------------------------------------------------------------------
139
140
void
141
plMinMax2dGrid
(
PLFLT_MATRIX
f,
PLINT
nx,
PLINT
ny,
PLFLT
*fnmax,
PLFLT
*fnmin )
142
{
143
int
i, j;
144
PLFLT
m,
M
;
145
146
if
( !isfinite( f[0][0] ) )
147
{
148
M
= -
HUGE_VAL
;
149
m =
HUGE_VAL
;
150
}
151
else
152
M
= m = f[0][0];
153
154
for
( i = 0; i < nx; i++ )
155
{
156
for
( j = 0; j < ny; j++ )
157
{
158
if
( !isfinite( f[i][j] ) )
159
continue
;
160
if
( f[i][j] >
M
)
161
M
= f[i][j];
162
if
( f[i][j] < m )
163
m = f[i][j];
164
}
165
}
166
*fnmax =
M
;
167
*fnmin = m;
168
}
M
#define M
Definition
mt19937ar.c:56
plexit
void plexit(PLCHAR_VECTOR errormsg)
Definition
plctrl.c:1958
plFree2dGrid
void plFree2dGrid(PLFLT **f, PLINT nx, PLINT PL_UNUSED(ny))
Definition
plmem.c:116
plStatic2dGrid
void plStatic2dGrid(PLFLT_NC_MATRIX zIliffe, PLFLT_VECTOR zStatic, PLINT nx, PLINT ny)
Definition
plmem.c:61
plMinMax2dGrid
void plMinMax2dGrid(PLFLT_MATRIX f, PLINT nx, PLINT ny, PLFLT *fnmax, PLFLT *fnmin)
Definition
plmem.c:141
plAlloc2dGrid
void plAlloc2dGrid(PLFLT ***f, PLINT nx, PLINT ny)
Definition
plmem.c:91
plplotP.h
HUGE_VAL
#define HUGE_VAL
Definition
plplotP.h:274
PLFLT
float PLFLT
Definition
plplot.h:163
PLFLT_NC_SCALAR
PLFLT * PLFLT_NC_SCALAR
Definition
plplot.h:233
PLFLT_VECTOR
const PLFLT * PLFLT_VECTOR
Definition
plplot.h:244
PLFLT_MATRIX
const PLFLT *const * PLFLT_MATRIX
Definition
plplot.h:253
PL_UNUSED
#define PL_UNUSED(x)
Definition
plplot.h:138
PLFLT_NC_MATRIX
PLFLT ** PLFLT_NC_MATRIX
Definition
plplot.h:248
PLINT
int PLINT
Definition
plplot.h:181
src
plmem.c
Generated on
for PLplot by
1.17.0