Geogram Version 1.8.5
A programming library of geometric algorithms
Loading...
Searching...
No Matches
nl.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2000-2022 Inria
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * * Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * * Neither the name of the ALICE Project-Team nor the names of its
14 * contributors may be used to endorse or promote products derived from this
15 * software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
28 *
29 * Contact: Bruno Levy
30 *
31 * https://www.inria.fr/fr/bruno-levy
32 *
33 * Inria,
34 * Domaine de Voluceau,
35 * 78150 Le Chesnay - Rocquencourt
36 * FRANCE
37 *
38 */
39
40#ifndef OPENNL_H
41#define OPENNL_H
42
43#include "nl_linkage.h"
44#include <stdio.h>
45#include <stdint.h>
46
47#ifdef __cplusplus
48extern "C" {
49#endif
50
51#define NL_VERSION_4_0 1
52
53#define NLAPI
54
55/*
56 * Deactivate warnings about documentation
57 * We do that, because CLANG's doxygen parser does not know
58 * some doxygen commands that we use (retval, copydoc) and
59 * generates many warnings for them...
60 */
61
62#if defined(__clang__)
63#pragma clang diagnostic ignored "-Wunknown-pragmas"
64#pragma clang diagnostic ignored "-Wdocumentation"
65#pragma clang diagnostic ignored "-Wdocumentation-unknown-command"
66#endif
67
215typedef unsigned int NLenum;
216
221typedef unsigned char NLboolean;
222
227typedef unsigned int NLbitfield;
228
233typedef void NLvoid;
234
238typedef signed char NLbyte;
239
243typedef short NLshort;
244
248typedef int32_t NLint;
249
253typedef unsigned char NLubyte;
254
258typedef unsigned short NLushort;
259
263typedef uint32_t NLuint;
264
268typedef int64_t NLlong;
269
273typedef uint64_t NLulong;
274
278typedef int NLsizei;
279
283typedef float NLfloat;
284
288typedef double NLdouble;
289
297typedef void(*NLfunc)(void);
298
305typedef void* NLContext;
306
311#define NL_FALSE 0x0
316#define NL_TRUE 0x1
317
336#define NL_SOLVER 0x100
337
347#define NL_NB_VARIABLES 0x101
348
361#define NL_LEAST_SQUARES 0x102
362
375#define NL_MAX_ITERATIONS 0x103
376
388#define NL_THRESHOLD 0x104
389
400#define NL_OMEGA 0x105
401
419#define NL_SYMMETRIC 0x106
420
433#define NL_USED_ITERATIONS 0x107
434
445#define NL_ERROR 0x108
446
457#define NL_INNER_ITERATIONS 0x109
458
469#define NL_ELAPSED_TIME 0x10a
470
483#define NL_PRECONDITIONER 0x10b
484
496#define NL_GFLOPS 0x10c
497
509#define NL_NNZ 0x10d
510
511
516#define NL_NB_SYSTEMS 0x10e
517
540#define NL_SOLVER_DEFAULT 0x000
541
553#define NL_CG 0x200
554
566#define NL_BICGSTAB 0x201
567
583#define NL_GMRES 0x202
584
599#define NL_PRECOND_NONE 0x000
600
612#define NL_PRECOND_JACOBI 0x300
613
627#define NL_PRECOND_SSOR 0x301
628
640#define NL_PRECOND_USER 0x303
641
674#define NL_NORMALIZE_ROWS 0x400
675
689#define NL_VERBOSE 0x401
690
691
705#define NL_NO_VARIABLES_INDIRECTION 0x402
706
724 NLAPI NLContext NLAPIENTRY nlNewContext(void);
725
731 NLAPI void NLAPIENTRY nlDeleteContext(NLContext context);
732
739 NLAPI void NLAPIENTRY nlMakeCurrent(NLContext context);
740
745 NLAPI NLContext NLAPIENTRY nlGetCurrent(void);
746
757 NLAPI NLboolean NLAPIENTRY nlInitExtension(const char* extension);
758
764 NLAPI NLboolean NLAPIENTRY nlExtensionIsInitialized(const char* extension);
765
771 NLAPI void NLAPIENTRY nlInitialize(int argc, char** argv);
772
792 NLAPI void NLAPIENTRY nlSolverParameterd(NLenum pname, NLdouble param);
793
825 NLAPI void NLAPIENTRY nlSolverParameteri(NLenum pname, NLint param);
826
832 NLAPI void NLAPIENTRY nlGetBooleanv(NLenum pname, NLboolean* params);
833
839 NLAPI void NLAPIENTRY nlGetDoublev(NLenum pname, NLdouble* params);
840
846 NLAPI void NLAPIENTRY nlGetIntegerv(NLenum pname, NLint* params);
847
853 NLAPI void NLAPIENTRY nlGetIntegervL(NLenum pname, NLlong* params);
854
855
860 NLAPI void NLAPIENTRY nlEnable(NLenum pname);
861
866 NLAPI void NLAPIENTRY nlDisable(NLenum pname);
867
874
897#define NL_FUNC_SOLVER 0x600
898
911#define NL_FUNC_MATRIX 0x601
912
926#define NL_FUNC_PRECONDITIONER 0x602
927
947#define NL_FUNC_PROGRESS 0x603
948
957 NLAPI void NLAPIENTRY nlSetFunction(NLenum pname, NLfunc param);
958
966 NLAPI void NLAPIENTRY nlGetFunction(NLenum pname, NLfunc* param);
967
982 NLAPI void NLAPIENTRY nlSetVariable(NLuint i, NLdouble value);
983
984
995 NLAPI void NLAPIENTRY nlMultiSetVariable(
996 NLuint i, NLuint k, NLdouble value
997 );
998
1007 NLAPI NLdouble NLAPIENTRY nlGetVariable(NLuint i);
1008
1020
1033 NLAPI void NLAPIENTRY nlLockVariable(NLuint index);
1034
1046 NLAPI void NLAPIENTRY nlUnlockVariable(NLuint index);
1047
1059 NLAPI NLboolean NLAPIENTRY nlVariableIsLocked(NLuint index);
1060
1073#define NL_SYSTEM 0x0
1074
1081#define NL_MATRIX 0x1
1082
1089#define NL_ROW 0x2
1090
1097#define NL_MATRIX_PATTERN 0x3
1098
1116 NLAPI void NLAPIENTRY nlBegin(NLenum primitive);
1117
1135 NLAPI void NLAPIENTRY nlEnd(NLenum primitive);
1136
1137
1145 NLAPI void NLAPIENTRY nlSetRowLength(NLuint i, NLuint n);
1146
1159 NLAPI void NLAPIENTRY nlCoefficient(NLuint i, NLdouble value);
1160
1161
1162
1172 NLAPI void NLAPIENTRY nlAddIJCoefficient(
1173 NLuint i, NLuint j, NLdouble value
1174 );
1175
1176
1187 NLAPI void NLAPIENTRY nlAddIRightHandSide(NLuint i, NLdouble value);
1188
1200 NLAPI void NLAPIENTRY nlMultiAddIRightHandSide(
1201 NLuint i, NLuint k, NLdouble value
1202 );
1203
1231 NLAPI void NLAPIENTRY nlRightHandSide(NLdouble value);
1232
1233
1241 NLAPI void NLAPIENTRY nlMultiRightHandSide(NLuint k, NLdouble value);
1242
1272 NLAPI void NLAPIENTRY nlRowScaling(NLdouble value);
1273
1287 NLAPI NLboolean NLAPIENTRY nlSolve(void);
1288
1289
1299 NLAPI void NLAPIENTRY nlUpdateRightHandSide(NLdouble* values);
1300
1312#define NL_VARIABLES_BUFFER 0x1000
1313
1327 NLAPI void NLAPIENTRY nlBindBuffer(
1328 NLenum buffer, NLuint k, void* addr, NLuint stride
1329 );
1330
1331
1341#define NL_STIFFNESS_MATRIX 0x3001
1342
1346#define NL_MASS_MATRIX 0x3002
1347
1355NLAPI void NLAPIENTRY nlMatrixMode(NLenum matrix);
1356
1361#define NL_NB_EIGENS NL_NB_SYSTEMS
1362
1367#define NL_EIGEN_MAX_ITERATIONS NL_MAX_ITERATIONS
1368
1373#define NL_EIGEN_THRESHOLD NL_THRESHOLD
1374
1379#define NL_EIGEN_SOLVER 0x2000
1380
1385#define NL_EIGEN_SHIFT 0x2001
1386
1391#define NL_EIGEN_SHIFT_INVERT 0x2002
1392
1398 NLAPI void NLAPIENTRY nlEigenSolverParameterd(
1399 NLenum pname, NLdouble val
1400 );
1401
1408 NLAPI void NLAPIENTRY nlEigenSolverParameteri(
1409 NLenum pname, NLint val
1410 );
1411
1415 NLAPI void NLAPIENTRY nlEigenSolve(void);
1416
1417
1423 NLAPI double NLAPIENTRY nlGetEigenValue(NLuint i);
1424
1434 typedef int (*NLprintfFunc)(const char* format, ...);
1435
1439 typedef int (*NLfprintfFunc)(FILE* out, const char* format, ...);
1440
1444 NLAPI void NLAPIENTRY nlPrintfFuncs(NLprintfFunc f1, NLfprintfFunc f2);
1445
1446
1451#ifdef __cplusplus
1452}
1453#endif
1454
1455#include "nl_ext.h"
1456#include "nl_64.h"
1457
1458/*************************************************************************/
1459
1460#endif
NLAPI void NLAPIENTRY nlMultiAddIRightHandSide(NLuint i, NLuint k, NLdouble value)
Adds a coefficient to a component of the right hand side of the equation.
NLAPI void NLAPIENTRY nlEnable(NLenum pname)
Sets a boolean parameter to NL_TRUE.
NLAPI void NLAPIENTRY nlGetIntegerv(NLenum pname, NLint *params)
Gets the value of an integer parameter.
NLAPI NLContext NLAPIENTRY nlGetCurrent(void)
Gets the current context.
NLAPI void NLAPIENTRY nlUpdateRightHandSide(NLdouble *values)
Updates the right hand side of the constructed system in one call.
NLAPI void NLAPIENTRY nlGetFunction(NLenum pname, NLfunc *param)
Gets a function pointer.
NLAPI void NLAPIENTRY nlPrintfFuncs(NLprintfFunc f1, NLfprintfFunc f2)
Specifies user functions for printing messages.
NLAPI void NLAPIENTRY nlMatrixMode(NLenum matrix)
Specifies to which matrix the subsequent calls to nlBegin(), nlEnd(), nlCoefficient(),...
void * NLContext
An OpenNL context.
Definition nl.h:305
uint32_t NLuint
A 4-bytes unsigned integer.
Definition nl.h:263
NLAPI void NLAPIENTRY nlEigenSolverParameterd(NLenum pname, NLdouble val)
Sets a floating-point parameter of the eigen solver.
NLAPI void NLAPIENTRY nlCoefficient(NLuint i, NLdouble value)
Appends a coefficient to the current row.
NLAPI void NLAPIENTRY nlGetIntegervL(NLenum pname, NLlong *params)
Gets the value of a 64 bits integer parameter.
NLAPI void NLAPIENTRY nlUnlockVariable(NLuint index)
Unlocks a variable.
unsigned char NLubyte
A 1-byte unsigned integer.
Definition nl.h:253
int NLsizei
Size of an object, 4-bytes signed integer.
Definition nl.h:278
NLAPI void NLAPIENTRY nlMultiRightHandSide(NLuint k, NLdouble value)
Sets the right-hand side of the current row when there are several systems to be solved.
short NLshort
A 2-bytes signed integer.
Definition nl.h:243
NLAPI NLboolean NLAPIENTRY nlInitExtension(const char *extension)
Initializes an OpenNL extension.
uint64_t NLulong
A 8-bytes unsigned integer.
Definition nl.h:273
NLAPI void NLAPIENTRY nlSetVariable(NLuint i, NLdouble value)
Sets the value of a variable.
int(* NLprintfFunc)(const char *format,...)
Function pointer type for user printf function.
Definition nl.h:1434
signed char NLbyte
A 1-byte signed integer.
Definition nl.h:238
double NLdouble
A double-precision floating-point number.
Definition nl.h:288
NLAPI void NLAPIENTRY nlEigenSolve(void)
Calls the eigen solver.
NLAPI NLboolean nlIsEnabled(NLenum pname)
Tests a boolean parameter.
void(* NLfunc)(void)
A function pointer.
Definition nl.h:297
NLAPI void NLAPIENTRY nlInitialize(int argc, char **argv)
Initializes OpenNL using command line arguments.
NLAPI void NLAPIENTRY nlGetDoublev(NLenum pname, NLdouble *params)
Gets the value of a double-precision floating-point parameter.
NLAPI void NLAPIENTRY nlMultiSetVariable(NLuint i, NLuint k, NLdouble value)
Sets the value of a variable when there are several systems to solve.
int32_t NLint
A 4-bytes signed integer.
Definition nl.h:248
NLAPI NLdouble NLAPIENTRY nlMultiGetVariable(NLuint i, NLuint k)
Gets the value of a variable when there are several systems to solve.
int64_t NLlong
A 8-bytes signed integer.
Definition nl.h:268
unsigned int NLenum
A symbolic constant.
Definition nl.h:215
NLAPI void NLAPIENTRY nlRightHandSide(NLdouble value)
Sets the right-hand side of the current row.
NLAPI void NLAPIENTRY nlDisable(NLenum pname)
Sets a boolean parameter to NL_FALSE.
float NLfloat
A single-precision floating-point number.
Definition nl.h:283
NLAPI void NLAPIENTRY nlSolverParameteri(NLenum pname, NLint param)
Specifies an integer solver parameter.
NLAPI void NLAPIENTRY nlBindBuffer(NLenum buffer, NLuint k, void *addr, NLuint stride)
Specifies a buffer binding to directly map user data to variables instead of using nlGetVariable() / ...
NLAPI void NLAPIENTRY nlLockVariable(NLuint index)
Locks a variable.
NLAPI void NLAPIENTRY nlGetBooleanv(NLenum pname, NLboolean *params)
Gets the value of a boolean parameter.
NLAPI void NLAPIENTRY nlSolverParameterd(NLenum pname, NLdouble param)
Specifies a floating-point solver parameter.
NLAPI NLboolean NLAPIENTRY nlSolve(void)
Solves the linear system in the current context.
NLAPI NLContext NLAPIENTRY nlNewContext(void)
Creates a new OpenNL context.
NLAPI void NLAPIENTRY nlEigenSolverParameteri(NLenum pname, NLint val)
Sets an integer parameter of the eigen solver.
int(* NLfprintfFunc)(FILE *out, const char *format,...)
Function pointer type for user fprintf function.
Definition nl.h:1439
unsigned short NLushort
A 2-bytes unsigned integer.
Definition nl.h:258
NLAPI void NLAPIENTRY nlMakeCurrent(NLContext context)
Sets the current OpenNL context.
unsigned char NLboolean
A truth value (NL_TRUE or NL_FALSE).
Definition nl.h:221
NLAPI NLboolean NLAPIENTRY nlVariableIsLocked(NLuint index)
Tests whether a variable is locked.
NLAPI void NLAPIENTRY nlAddIJCoefficient(NLuint i, NLuint j, NLdouble value)
Adds a coefficient to the current matrix.
NLAPI void NLAPIENTRY nlRowScaling(NLdouble value)
Sets the row scaling for the next row.
NLAPI NLdouble NLAPIENTRY nlGetVariable(NLuint i)
Gets the value of a variable.
NLAPI NLboolean NLAPIENTRY nlExtensionIsInitialized(const char *extension)
Tests whether an OpenNL extension is initialized.
NLAPI void NLAPIENTRY nlAddIRightHandSide(NLuint i, NLdouble value)
Adds a coefficient to a component of the right hand side of the equation.
NLAPI void NLAPIENTRY nlBegin(NLenum primitive)
Begins a new primitive.
NLAPI void NLAPIENTRY nlSetFunction(NLenum pname, NLfunc param)
Sets a function pointer.
NLAPI double NLAPIENTRY nlGetEigenValue(NLuint i)
Gets an eigenvalue.
void NLvoid
Return type of functions that do not return a value.
Definition nl.h:233
unsigned int NLbitfield
A set of symbolic constants that can be combined with the bitwise or operator.
Definition nl.h:227
NLAPI void NLAPIENTRY nlSetRowLength(NLuint i, NLuint n)
Specifies the length of a row of the matrix.
NLAPI void NLAPIENTRY nlEnd(NLenum primitive)
Begins a new primitive.
NLAPI void NLAPIENTRY nlDeleteContext(NLContext context)
Destroys an existing OpenNL context.
Some optional extensions of the OpenNL linear solver library.
Specify linkage for OpenNL integrated into Geogram.