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
b3728ec7
Commit
b3728ec7
authored
14 years ago
by
Tuomas Karna
Browse files
Options
Downloads
Patches
Plain Diff
some function lua bindings
parent
34142976
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Solver/function.cpp
+63
-2
63 additions, 2 deletions
Solver/function.cpp
Solver/function.h
+1
-0
1 addition, 0 deletions
Solver/function.h
with
64 additions
and
2 deletions
Solver/function.cpp
+
63
−
2
View file @
b3728ec7
...
@@ -370,7 +370,7 @@ class functionSum : public function {
...
@@ -370,7 +370,7 @@ class functionSum : public function {
functionSum
(
const
function
*
f0
,
const
function
*
f1
)
:
function
(
f0
->
getNbCol
())
functionSum
(
const
function
*
f0
,
const
function
*
f1
)
:
function
(
f0
->
getNbCol
())
{
{
if
(
f0
->
getNbCol
()
!=
f1
->
getNbCol
())
{
if
(
f0
->
getNbCol
()
!=
f1
->
getNbCol
())
{
Msg
::
Error
(
"trying to sum 2 functions of different sizes
\n
"
);
Msg
::
Error
(
"trying to sum 2 functions of different sizes
: %d %d
\n
"
,
f0
->
getNbCol
(),
f1
->
getNbCol
()
);
throw
;
throw
;
}
}
setArgument
(
_f0
,
f0
);
setArgument
(
_f0
,
f0
);
...
@@ -397,7 +397,7 @@ class functionProd : public function {
...
@@ -397,7 +397,7 @@ class functionProd : public function {
functionProd
(
const
function
*
f0
,
const
function
*
f1
)
:
function
(
f0
->
getNbCol
())
functionProd
(
const
function
*
f0
,
const
function
*
f1
)
:
function
(
f0
->
getNbCol
())
{
{
if
(
f0
->
getNbCol
()
!=
f1
->
getNbCol
())
{
if
(
f0
->
getNbCol
()
!=
f1
->
getNbCol
())
{
Msg
::
Error
(
"trying to compute product of 2 functions of different sizes
\n
"
);
Msg
::
Error
(
"trying to compute product of 2 functions of different sizes
: %d %d
\n
"
,
f0
->
getNbCol
(),
f1
->
getNbCol
()
);
throw
;
throw
;
}
}
setArgument
(
_f0
,
f0
);
setArgument
(
_f0
,
f0
);
...
@@ -433,6 +433,32 @@ function *functionExtractCompNew(const function *f0, const int iComp)
...
@@ -433,6 +433,32 @@ function *functionExtractCompNew(const function *f0, const int iComp)
return
new
functionExtractComp
(
f0
,
iComp
);
return
new
functionExtractComp
(
f0
,
iComp
);
}
}
// functionCatComp
class
functionCatComp
:
public
function
{
public:
int
_nComp
;
std
::
vector
<
fullMatrix
<
double
>
>
_fMatrix
;
void
call
(
dataCacheMap
*
m
,
fullMatrix
<
double
>
&
val
)
{
for
(
int
i
=
0
;
i
<
val
.
size1
();
i
++
)
for
(
int
comp
=
0
;
comp
<
_nComp
;
comp
++
)
val
(
i
,
comp
)
=
_fMatrix
[
comp
](
i
,
0
);
}
functionCatComp
(
std
::
vector
<
const
function
*>
fArray
)
:
function
(
fArray
.
size
())
{
_nComp
=
fArray
.
size
();
_fMatrix
.
resize
(
_nComp
);
for
(
int
i
=
0
;
i
<
_nComp
;
i
++
)
setArgument
(
_fMatrix
[
i
],
fArray
[
i
]);
}
};
function
*
functionCatCompNew
(
std
::
vector
<
const
function
*>
fArray
)
{
return
new
functionCatComp
(
fArray
);
}
// functionScale
// functionScale
class
functionScale
:
public
function
{
class
functionScale
:
public
function
{
...
@@ -692,6 +718,41 @@ void function::registerBindings(binding *b)
...
@@ -692,6 +718,41 @@ void function::registerBindings(binding *b)
mb
->
setDescription
(
"A new constant function wich values 'v' everywhere. v can be a row-vector."
);
mb
->
setDescription
(
"A new constant function wich values 'v' everywhere. v can be a row-vector."
);
cb
->
setParentClass
<
function
>
();
cb
->
setParentClass
<
function
>
();
cb
=
b
->
addClass
<
functionSum
>
(
"functionSum"
);
cb
->
setDescription
(
"A sum of two functions 'a + b'. The arguments a, b must have same dimension."
);
mb
=
cb
->
setConstructor
<
functionSum
,
const
function
*
,
const
function
*>
();
mb
->
setArgNames
(
"a"
,
"b"
,
NULL
);
mb
->
setDescription
(
"Creates a new functionSum instance with given arguments"
);
cb
->
setParentClass
<
function
>
();
cb
=
b
->
addClass
<
functionProd
>
(
"functionProd"
);
cb
->
setDescription
(
"A pointwise product of two functions 'a(i,j)*b(i,j)'. The arguments a, b must have same dimension."
);
mb
=
cb
->
setConstructor
<
functionProd
,
const
function
*
,
const
function
*>
();
mb
->
setArgNames
(
"a"
,
"b"
,
NULL
);
mb
->
setDescription
(
"Creates a new functionProd instance with given arguments"
);
cb
->
setParentClass
<
function
>
();
cb
=
b
->
addClass
<
functionExtractComp
>
(
"functionExtractComp"
);
cb
->
setDescription
(
"Extracts a given component of the vector valued function."
);
mb
=
cb
->
setConstructor
<
functionExtractComp
,
const
function
*
,
int
>
();
mb
->
setArgNames
(
"function"
,
"component"
,
NULL
);
mb
->
setDescription
(
"Creates a new functionExtractComp instance with given arguments"
);
cb
->
setParentClass
<
function
>
();
cb
=
b
->
addClass
<
functionCatComp
>
(
"functionCatComp"
);
cb
->
setDescription
(
"Creates a vector valued function by concatenating the given scalar functions. Uses only the first component of each function."
);
mb
=
cb
->
setConstructor
<
functionCatComp
,
std
::
vector
<
const
function
*>
>
();
mb
->
setArgNames
(
"functionArray"
,
NULL
);
mb
->
setDescription
(
"Creates a new functionCatComp instance with given arguments"
);
cb
->
setParentClass
<
function
>
();
cb
=
b
->
addClass
<
functionScale
>
(
"functionScale"
);
cb
->
setDescription
(
"Scales a function by a given scalar."
);
mb
=
cb
->
setConstructor
<
functionScale
,
const
function
*
,
double
>
();
mb
->
setArgNames
(
"function"
,
"scalar"
,
NULL
);
mb
->
setDescription
(
"Creates a new functionScale instance with given arguments"
);
cb
->
setParentClass
<
function
>
();
cb
=
b
->
addClass
<
functionCoordinates
>
(
"functionCoordinates"
);
cb
=
b
->
addClass
<
functionCoordinates
>
(
"functionCoordinates"
);
cb
->
setDescription
(
"A function to access the coordinates (xyz). This is a "
cb
->
setDescription
(
"A function to access the coordinates (xyz). This is a "
"single-instance class, use the 'get' member to access the instance."
);
"single-instance class, use the 'get' member to access the instance."
);
...
...
This diff is collapsed.
Click to expand it.
Solver/function.h
+
1
−
0
View file @
b3728ec7
...
@@ -270,6 +270,7 @@ function *functionSumNew (const function *f0, const function *f1);
...
@@ -270,6 +270,7 @@ function *functionSumNew (const function *f0, const function *f1);
function
*
functionProdNew
(
const
function
*
f0
,
const
function
*
f1
);
function
*
functionProdNew
(
const
function
*
f0
,
const
function
*
f1
);
function
*
functionScaleNew
(
const
function
*
f0
,
const
double
s
);
function
*
functionScaleNew
(
const
function
*
f0
,
const
double
s
);
function
*
functionExtractCompNew
(
const
function
*
f0
,
const
int
iComp
);
function
*
functionExtractCompNew
(
const
function
*
f0
,
const
int
iComp
);
function
*
functionCatCompNew
(
std
::
vector
<
const
function
*>
fArray
);
function
*
getFunctionCoordinates
();
function
*
getFunctionCoordinates
();
...
...
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