Skip to content
Snippets Groups Projects
Commit 86b3a8b3 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

explain that undesired output args in C API can be ignored by passing NULL (cf. !470)

parent cb51a262
No related branches found
No related tags found
No related merge requests found
...@@ -5286,6 +5286,8 @@ See ...@@ -5286,6 +5286,8 @@ See
@url{@value{GITLAB-PREFIX}/tutorials/t2.geo,t2.geo}. Also @url{@value{GITLAB-PREFIX}/tutorials/t2.geo,t2.geo}. Also
available in C++ available in C++
(@url{@value{GITLAB-PREFIX}/tutorials/c++/t2.cpp,t2.cpp}), (@url{@value{GITLAB-PREFIX}/tutorials/c++/t2.cpp,t2.cpp}),
C
(@url{@value{GITLAB-PREFIX}/tutorials/c/t2.c,t2.c}),
Python Python
(@url{@value{GITLAB-PREFIX}/tutorials/python/t2.py,t2.py}) (@url{@value{GITLAB-PREFIX}/tutorials/python/t2.py,t2.py})
and Julia and Julia
...@@ -5365,7 +5367,9 @@ and Julia ...@@ -5365,7 +5367,9 @@ and Julia
See See
@url{@value{GITLAB-PREFIX}/tutorials/t6.geo,t6.geo}. @url{@value{GITLAB-PREFIX}/tutorials/t6.geo,t6.geo}.
Also available in C++ Also available in C++
(@url{@value{GITLAB-PREFIX}/tutorials/c++/t6.cpp,t6.cpp}) (@url{@value{GITLAB-PREFIX}/tutorials/c++/t6.cpp,t6.cpp}),
C
(@url{@value{GITLAB-PREFIX}/tutorials/c/t6.c,t6.c})
and Python and Python
(@url{@value{GITLAB-PREFIX}/tutorials/python/t6.py,t6.py}). (@url{@value{GITLAB-PREFIX}/tutorials/python/t6.py,t6.py}).
...@@ -5439,7 +5443,9 @@ See ...@@ -5439,7 +5443,9 @@ See
Also available in C++ Also available in C++
(@url{@value{GITLAB-PREFIX}/tutorials/c++/t10.cpp,t10.cpp}) (@url{@value{GITLAB-PREFIX}/tutorials/c++/t10.cpp,t10.cpp})
and Python and Python
(@url{@value{GITLAB-PREFIX}/tutorials/python/t10.py,t10.py}). (@url{@value{GITLAB-PREFIX}/tutorials/python/t10.py,t10.py})
and Julia
(@url{@value{GITLAB-PREFIX}/tutorials/julia/t10.jl,t10.jl}).
@smallformat @smallformat
@verbatiminclude ../../tutorials/t10.geo @verbatiminclude ../../tutorials/t10.geo
...@@ -5546,6 +5552,8 @@ See ...@@ -5546,6 +5552,8 @@ See
@url{@value{GITLAB-PREFIX}/tutorials/t16.geo,t16.geo}. @url{@value{GITLAB-PREFIX}/tutorials/t16.geo,t16.geo}.
Also available in C++ Also available in C++
(@url{@value{GITLAB-PREFIX}/tutorials/c++/t16.cpp,t16.cpp}), (@url{@value{GITLAB-PREFIX}/tutorials/c++/t16.cpp,t16.cpp}),
C
(@url{@value{GITLAB-PREFIX}/tutorials/c/t16.c,t16.c}),
Python Python
(@url{@value{GITLAB-PREFIX}/tutorials/python/t16.py,t16.py}) (@url{@value{GITLAB-PREFIX}/tutorials/python/t16.py,t16.py})
and Julia and Julia
......
...@@ -82,8 +82,11 @@ int main(int argc, char **argv) ...@@ -82,8 +82,11 @@ int main(int argc, char **argv)
// should be freed with `gmshFree()' when not used anymore: // should be freed with `gmshFree()' when not used anymore:
gmshFree(ov); gmshFree(ov);
// Note that in the C API, undesired output values can be ignored by passing a
// NULL pointer. For example, to ignore the error flag, we can pass NULL as
// the last argument:
const int cl2[] = {5, -8, -7, 3}; const int cl2[] = {5, -8, -7, 3};
gmshModelGeoAddCurveLoop(cl2, sizeof(cl2) / sizeof(cl2[0]), 10, 0, &ierr); gmshModelGeoAddCurveLoop(cl2, sizeof(cl2) / sizeof(cl2[0]), 10, 0, NULL);
const int s2[] = {10}; const int s2[] = {10};
gmshModelGeoAddPlaneSurface(s2, sizeof(s2) / sizeof(s2[0]), 11, &ierr); gmshModelGeoAddPlaneSurface(s2, sizeof(s2) / sizeof(s2[0]), 11, &ierr);
...@@ -161,18 +164,15 @@ int main(int argc, char **argv) ...@@ -161,18 +164,15 @@ int main(int argc, char **argv)
// the surface 11 along the z axis and automatically creates a new volume (as // the surface 11 along the z axis and automatically creates a new volume (as
// well as all the needed points, curves and surfaces). As expected, the // well as all the needed points, curves and surfaces). As expected, the
// function takes a vector of (dim, tag) pairs as input as well as the // function takes a vector of (dim, tag) pairs as input as well as the
// translation vector, and returns a vector of (dim, tag) pairs as output: // translation vector; since we don't plan to use the output vector of (dim,
int *ov2; // tag) pairs, we pass NULL instead:
size_t ov2_n;
const int *numElements; const int *numElements;
const size_t numElements_n = 0; const size_t numElements_n = 0;
const double *heights; const double *heights;
const size_t heights_n = 0; const size_t heights_n = 0;
const int recombine = 0; const int recombine = 0;
gmshModelGeoExtrude(&(ov[2]), 2, 0.0, 0.0, 0.12, &ov2, &ov2_n, numElements, gmshModelGeoExtrude(&(ov[2]), 2, 0.0, 0.0, 0.12, NULL, NULL, numElements,
numElements_n, heights, heights_n, recombine, &ierr); numElements_n, heights, heights_n, recombine, &ierr);
gmshFree(ov);
gmshFree(ov2);
// Mesh sizes associated to geometrical points can be set by passing a vector // Mesh sizes associated to geometrical points can be set by passing a vector
// of (dim, tag) pairs for the corresponding points: // of (dim, tag) pairs for the corresponding points:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment