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
fc849336
Commit
fc849336
authored
15 years ago
by
Jonathan Lambrechts
Browse files
Options
Downloads
Patches
Plain Diff
adjust bindings of linearSystemPetsc, dg: implicit.lua works anew
parent
b1ae2e41
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Common/LuaBindings.cpp
+5
-5
5 additions, 5 deletions
Common/LuaBindings.cpp
Common/LuaBindings.h
+8
-4
8 additions, 4 deletions
Common/LuaBindings.h
Solver/linearSystem.cpp
+6
-1
6 additions, 1 deletion
Solver/linearSystem.cpp
Solver/linearSystemPETSc.cpp
+1
-9
1 addition, 9 deletions
Solver/linearSystemPETSc.cpp
with
20 additions
and
19 deletions
Common/LuaBindings.cpp
+
5
−
5
View file @
fc849336
...
...
@@ -123,11 +123,11 @@ static void reportErrors(lua_State *L, int status)
}
}
const
char
*
colorRed
=
"
\033
[1;31m"
;
const
char
*
colorGreen
=
"
\033
[1;32m"
;
const
char
*
colorBlue
=
"
\033
[1;34m"
;
const
char
*
colorDefault
=
"
\033
[0m"
;
const
char
*
colorBold
=
"
\033
[1m"
;
static
const
char
*
colorRed
=
"
\033
[1;31m"
;
static
const
char
*
colorGreen
=
"
\033
[1;32m"
;
static
const
char
*
colorBlue
=
"
\033
[1;34m"
;
static
const
char
*
colorDefault
=
"
\033
[0m"
;
static
const
char
*
colorBold
=
"
\033
[1m"
;
static
void
printMethod
(
std
::
string
name
,
luaMethodBinding
*
mb
,
bool
isConstructor
=
false
)
{
...
...
This diff is collapsed.
Click to expand it.
Common/LuaBindings.h
+
8
−
4
View file @
fc849336
...
...
@@ -1227,13 +1227,12 @@ class classBinding {
lua_setmetatable
(
L
,
methods
);
// setmetatable(methods, mt)
lua_pop
(
L
,
2
);
// drop metatable and method table
}
template
<
typename
parentType
>
void
setParentClass
()
{
void
setParentClassName
(
const
std
::
string
parentClassName
)
{
if
(
_parent
)
Msg
::
Error
(
"Multiple inheritance not implemented in lua bindings "
"for class %s"
,
_className
.
c_str
());
std
::
string
parentClassName
=
className
<
parentType
>::
get
();
if
(
_b
->
classes
.
find
(
parentClassName
)
==
_b
->
classes
.
end
())
Msg
::
Error
(
"Unknown class %s"
,
parentClassName
.
c_str
());
_parent
=
_b
->
classes
[
parentClassName
];
_parent
->
children
.
insert
(
this
);
lua_getglobal
(
_b
->
L
,
_className
.
c_str
());
...
...
@@ -1244,6 +1243,11 @@ class classBinding {
// mt.__index = global[_parentClassName] // this is the inheritance bit
lua_pop
(
_b
->
L
,
2
);
}
template
<
typename
parentType
>
void
setParentClass
()
{
setParentClassName
(
className
<
parentType
>::
get
());
}
void
setDescription
(
std
::
string
description
){
_description
=
description
;
}
inline
const
std
::
string
getDescription
()
const
{
return
_description
;
}
inline
classBinding
*
getParent
()
const
{
return
_parent
;
}
...
...
This diff is collapsed.
Click to expand it.
Solver/linearSystem.cpp
+
6
−
1
View file @
fc849336
...
...
@@ -8,7 +8,7 @@
template
<
>
void
linearSystem
<
double
>::
registerBindings
(
binding
*
b
){
classBinding
*
cb
=
b
->
addClass
<
linearSystem
<
double
>
>
(
"linearSystem"
);
classBinding
*
cb
=
b
->
addClass
<
linearSystem
<
double
>
>
(
"linearSystem
Double
"
);
cb
->
setDescription
(
"An abstraction of a linear system Ax = b."
);
methodBinding
*
cm
;
cm
=
cb
->
addMethod
(
"systemSolve"
,
&
linearSystem
<
double
>::
systemSolve
);
...
...
@@ -34,6 +34,11 @@ void linearSystem<double>::registerBindings(binding *b){
cm
->
setDescription
(
"A new Lapack based <double> solver"
);
cm
->
setArgNames
(
NULL
);
cb
->
setParentClass
<
linearSystem
<
double
>
>
();
// block
cb
=
b
->
addClass
<
linearSystem
<
fullMatrix
<
double
>
>
>
(
"linearSystemFullMatrixDouble"
);
cb
->
setDescription
(
"An abstraction of a linear system Ax = b."
);
cm
=
cb
->
addMethod
(
"systemSolve"
,
&
linearSystem
<
fullMatrix
<
double
>
>::
systemSolve
);
cm
->
setDescription
(
"compute x = A^{-1}b"
);
#ifdef HAVE_PETSC
linearSystemPETScRegisterBindings
(
b
);
#endif
...
...
This diff is collapsed.
Click to expand it.
Solver/linearSystemPETSc.cpp
+
1
−
9
View file @
fc849336
...
...
@@ -107,21 +107,13 @@ void linearSystemPETScRegisterBindings(binding *b)
cm
->
setDescription
(
"A new PETSc<PetscScalar> solver"
);
cb
->
setParentClass
<
linearSystem
<
PetscScalar
>
>
();
cm
->
setArgNames
(
NULL
);
cm
=
cb
->
addMethod
(
"systemSolve"
,
&
linearSystem
<
fullMatrix
<
PetscScalar
>
>::
systemSolve
);
cm
->
setDescription
(
"compute x = A^{-1}b"
);
cb
=
b
->
addClass
<
linearSystem
<
fullMatrix
<
double
>
>
>
(
"linearSystemBlock"
);
cb
->
setDescription
(
"A linear system solver with blocks"
);
cb
=
b
->
addClass
<
linearSystemPETSc
<
fullMatrix
<
PetscScalar
>
>
>
(
"linearSystemPETScBlock"
);
cb
->
setDescription
(
"A linear system solver, based on PETSc"
);
cm
=
cb
->
setConstructor
<
linearSystemPETSc
<
fullMatrix
<
PetscScalar
>
>
,
int
>
();
cm
->
setDescription
(
"A new PETScBlock<PetscScalar> solver (we probably should get rid of the blockSize argument)"
);
cb
->
setParentClass
<
linearSystem
<
fullMatrix
<
PetscScalar
>
>
>
();
cm
->
setArgNames
(
"blockSize"
,
NULL
);
cm
=
cb
->
addMethod
(
"systemSolve"
,
&
linearSystem
<
fullMatrix
<
PetscScalar
>
>::
systemSolve
);
cm
->
setDescription
(
"compute x = A^{-1}b"
);
#endif // FIXME
#endif // FIXME
}
...
...
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