Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
aa0b8ef0
Commit
aa0b8ef0
authored
13 years ago
by
Jonathan Lambrechts
Browse files
Options
Downloads
Patches
Plain Diff
function python constructor to access discontinuous function
parent
a94d55e3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Solver/functionPython.h
+31
-13
31 additions, 13 deletions
Solver/functionPython.h
with
31 additions
and
13 deletions
Solver/functionPython.h
+
31
−
13
View file @
aa0b8ef0
...
@@ -15,6 +15,26 @@ class functionPython : public function {
...
@@ -15,6 +15,26 @@ class functionPython : public function {
std
::
string
_luaFunctionName
;
std
::
string
_luaFunctionName
;
std
::
vector
<
fullMatrix
<
double
>
>
args
;
std
::
vector
<
fullMatrix
<
double
>
>
args
;
functionPythonReturnMatrix
R
;
functionPythonReturnMatrix
R
;
void
_init
()
{
_swigA
.
resize
(
args
.
size
());
_swigR
=
SWIG_NewPointerObj
((
void
*
)
&
R
,
SWIGTYPE_p_functionPythonReturnMatrix
,
0
);
for
(
int
i
=
0
;
i
<
args
.
size
();
i
++
)
{
_swigA
[
i
]
=
SWIG_NewPointerObj
((
void
*
)
&
args
[
i
],
SWIGTYPE_p_fullMatrixT_double_t
,
0
);
}
switch
(
args
.
size
())
{
case
0
:
_pyargs
=
Py_BuildValue
(
"(O)"
,
_swigR
);
break
;
case
1
:
_pyargs
=
Py_BuildValue
(
"(OO)"
,
_swigR
,
_swigA
[
0
]);
break
;
case
2
:
_pyargs
=
Py_BuildValue
(
"(OOO)"
,
_swigR
,
_swigA
[
0
],
_swigA
[
1
]);
break
;
case
3
:
_pyargs
=
Py_BuildValue
(
"(OOOO)"
,
_swigR
,
_swigA
[
0
],
_swigA
[
1
],
_swigA
[
2
]);
break
;
case
4
:
_pyargs
=
Py_BuildValue
(
"(OOOOO)"
,
_swigR
,
_swigA
[
0
],
_swigA
[
1
],
_swigA
[
2
],
_swigA
[
3
]);
break
;
case
5
:
_pyargs
=
Py_BuildValue
(
"(OOOOOO)"
,
_swigR
,
_swigA
[
0
],
_swigA
[
1
],
_swigA
[
2
],
_swigA
[
3
],
_swigA
[
4
]);
break
;
case
6
:
_pyargs
=
Py_BuildValue
(
"(OOOOOOO)"
,
_swigR
,
_swigA
[
0
],
_swigA
[
1
],
_swigA
[
2
],
_swigA
[
3
],
_swigA
[
4
],
_swigA
[
5
]);
break
;
case
7
:
_pyargs
=
Py_BuildValue
(
"(OOOOOOOO)"
,
_swigR
,
_swigA
[
0
],
_swigA
[
1
],
_swigA
[
2
],
_swigA
[
3
],
_swigA
[
4
],
_swigA
[
5
],
_swigA
[
6
]);
break
;
case
8
:
_pyargs
=
Py_BuildValue
(
"(OOOOOOOOO)"
,
_swigR
,
_swigA
[
0
],
_swigA
[
1
],
_swigA
[
2
],
_swigA
[
3
],
_swigA
[
4
],
_swigA
[
5
],
_swigA
[
6
],
_swigA
[
7
]);
break
;
default:
Msg
::
Error
(
"python function not implemented for more than 8 arguments"
);
}
}
public
:
public
:
void
call
(
dataCacheMap
*
m
,
fullMatrix
<
double
>
&
res
)
void
call
(
dataCacheMap
*
m
,
fullMatrix
<
double
>
&
res
)
{
{
...
@@ -34,23 +54,21 @@ class functionPython : public function {
...
@@ -34,23 +54,21 @@ class functionPython : public function {
{
{
args
.
resize
(
dependencies
.
size
());
args
.
resize
(
dependencies
.
size
());
_swigA
.
resize
(
args
.
size
());
_swigA
.
resize
(
args
.
size
());
_swigR
=
SWIG_NewPointerObj
((
void
*
)
&
R
,
SWIGTYPE_p_functionPythonReturnMatrix
,
0
);
for
(
int
i
=
0
;
i
<
dependencies
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
dependencies
.
size
();
i
++
)
{
setArgument
(
args
[
i
],
dependencies
[
i
]);
setArgument
(
args
[
i
],
dependencies
[
i
]);
_swigA
[
i
]
=
SWIG_NewPointerObj
((
void
*
)
&
args
[
i
],
SWIGTYPE_p_fullMatrixT_double_t
,
0
);
}
}
switch
(
args
.
size
())
{
_init
();
case
0
:
_pyargs
=
Py_BuildValue
(
"(O)"
,
_swigR
);
break
;
}
case
1
:
_pyargs
=
Py_BuildValue
(
"(OO)"
,
_swigR
,
_swigA
[
0
]);
break
;
functionPython
(
int
nbCol
,
PyObject
*
callback
,
std
::
vector
<
std
::
pair
<
const
function
*
,
int
>
>
dependencies
)
case
2
:
_pyargs
=
Py_BuildValue
(
"(OOO)"
,
_swigR
,
_swigA
[
0
],
_swigA
[
1
]);
break
;
:
function
(
nbCol
),
_pycallback
(
callback
)
case
3
:
_pyargs
=
Py_BuildValue
(
"(OOOO)"
,
_swigR
,
_swigA
[
0
],
_swigA
[
1
],
_swigA
[
2
]);
break
;
{
case
4
:
_pyargs
=
Py_BuildValue
(
"(OOOOO)"
,
_swigR
,
_swigA
[
0
],
_swigA
[
1
],
_swigA
[
2
],
_swigA
[
3
]);
break
;
args
.
resize
(
dependencies
.
size
());
case
5
:
_pyargs
=
Py_BuildValue
(
"(OOOOOO)"
,
_swigR
,
_swigA
[
0
],
_swigA
[
1
],
_swigA
[
2
],
_swigA
[
3
],
_swigA
[
4
]);
break
;
_swigA
.
resize
(
args
.
size
());
case
6
:
_pyargs
=
Py_BuildValue
(
"(OOOOOOO)"
,
_swigR
,
_swigA
[
0
],
_swigA
[
1
],
_swigA
[
2
],
_swigA
[
3
],
_swigA
[
4
],
_swigA
[
5
]);
break
;
for
(
int
i
=
0
;
i
<
dependencies
.
size
();
i
++
)
{
case
7
:
_pyargs
=
Py_BuildValue
(
"(OOOOOOOO)"
,
_swigR
,
_swigA
[
0
],
_swigA
[
1
],
_swigA
[
2
],
_swigA
[
3
],
_swigA
[
4
],
_swigA
[
5
],
_swigA
[
6
]);
break
;
printf
(
"%p %i
\n
"
,
dependencies
[
i
].
first
,
dependencies
[
i
].
second
);
case
8
:
_pyargs
=
Py_BuildValue
(
"(OOOOOOOOO)"
,
_swigR
,
_swigA
[
0
],
_swigA
[
1
],
_swigA
[
2
],
_swigA
[
3
],
_swigA
[
4
],
_swigA
[
5
],
_swigA
[
6
],
_swigA
[
7
]);
break
;
setArgument
(
args
[
i
],
dependencies
[
i
].
first
,
dependencies
[
i
].
second
);
default:
Msg
::
Error
(
"python function not implemented for more than 8 arguments"
);
}
}
_init
();
}
}
};
};
#endif
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment