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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
75d6a829
Commit
75d6a829
authored
15 years ago
by
Boris Sedji
Browse files
Options
Downloads
Patches
Plain Diff
No commit message
No commit message
parent
829af106
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Solver/elasticitySolver.cpp
+34
-23
34 additions, 23 deletions
Solver/elasticitySolver.cpp
Solver/elasticitySolver.h
+9
-4
9 additions, 4 deletions
Solver/elasticitySolver.h
with
43 additions
and
27 deletions
Solver/elasticitySolver.cpp
+
34
−
23
View file @
75d6a829
...
@@ -249,10 +249,12 @@ void elasticitySolver::readInputFile(const std::string &fn)
...
@@ -249,10 +249,12 @@ void elasticitySolver::readInputFile(const std::string &fn)
/********************* end deprecated api ****************************************/
/********************* end deprecated api ****************************************/
void
elasticitySolver
::
addDirichletBC
(
int
dim
,
int
entityId
,
int
component
,
double
value
)
{
#if defined (HAVE_LUA)
void
elasticitySolver
::
addDirichletBCLua
(
int
dim
,
int
entityId
,
int
component
,
std
::
string
luaFunctionName
,
lua_State
*
L
)
{
dirichletBC
diri
;
dirichletBC
diri
;
diri
.
g
=
new
groupOfElements
(
dim
,
entityId
);
diri
.
g
=
new
groupOfElements
(
dim
,
entityId
);
diri
.
_f
=
new
simpleFunction
<
double
>
(
value
);
diri
.
_f
=
new
simpleFunction
Lua
<
double
>
(
L
,
luaFunctionName
,
0.
);
diri
.
_comp
=
component
;
diri
.
_comp
=
component
;
diri
.
_tag
=
entityId
;
diri
.
_tag
=
entityId
;
switch
(
dim
)
{
switch
(
dim
)
{
...
@@ -264,10 +266,26 @@ void elasticitySolver::addDirichletBC (int dim, int entityId, int component, dou
...
@@ -264,10 +266,26 @@ void elasticitySolver::addDirichletBC (int dim, int entityId, int component, dou
allDirichlet
.
push_back
(
diri
);
allDirichlet
.
push_back
(
diri
);
}
}
void
elasticitySolver
::
addDirichletBCLua
(
int
dim
,
int
entityId
,
int
component
,
std
::
string
luaFunctionName
,
lua_State
*
L
)
{
void
elasticitySolver
::
addNeumannBCLua
(
int
dim
,
int
entityId
,
std
::
string
luaFunctionName
,
lua_State
*
L
)
{
neumannBC
neu
;
neu
.
g
=
new
groupOfElements
(
dim
,
entityId
);
neu
.
_f
=
new
simpleFunctionLua
<
SVector3
>
(
L
,
luaFunctionName
,
SVector3
(
0
,
0
,
0
));
neu
.
_tag
=
entityId
;
switch
(
dim
)
{
case
0
:
neu
.
onWhat
=
BoundaryCondition
::
ON_VERTEX
;
break
;
case
1
:
neu
.
onWhat
=
BoundaryCondition
::
ON_EDGE
;
break
;
case
2
:
neu
.
onWhat
=
BoundaryCondition
::
ON_FACE
;
break
;
default
:
return
;
}
allNeumann
.
push_back
(
neu
);
}
#endif
void
elasticitySolver
::
addDirichletBC
(
int
dim
,
int
entityId
,
int
component
,
double
value
)
{
dirichletBC
diri
;
dirichletBC
diri
;
diri
.
g
=
new
groupOfElements
(
dim
,
entityId
);
diri
.
g
=
new
groupOfElements
(
dim
,
entityId
);
diri
.
_f
=
new
simpleFunction
Lua
<
double
>
(
L
,
luaFunctionName
,
0.
);
diri
.
_f
=
new
simpleFunction
<
double
>
(
value
);
diri
.
_comp
=
component
;
diri
.
_comp
=
component
;
diri
.
_tag
=
entityId
;
diri
.
_tag
=
entityId
;
switch
(
dim
)
{
switch
(
dim
)
{
...
@@ -279,6 +297,7 @@ void elasticitySolver::addDirichletBCLua (int dim, int entityId, int component,
...
@@ -279,6 +297,7 @@ void elasticitySolver::addDirichletBCLua (int dim, int entityId, int component,
allDirichlet
.
push_back
(
diri
);
allDirichlet
.
push_back
(
diri
);
}
}
void
elasticitySolver
::
addNeumannBC
(
int
dim
,
int
entityId
,
const
std
::
vector
<
double
>
value
)
{
void
elasticitySolver
::
addNeumannBC
(
int
dim
,
int
entityId
,
const
std
::
vector
<
double
>
value
)
{
if
(
value
.
size
()
!=
3
)
return
;
if
(
value
.
size
()
!=
3
)
return
;
neumannBC
neu
;
neumannBC
neu
;
...
@@ -294,19 +313,7 @@ void elasticitySolver::addNeumannBC (int dim, int entityId, const std::vector<do
...
@@ -294,19 +313,7 @@ void elasticitySolver::addNeumannBC (int dim, int entityId, const std::vector<do
allNeumann
.
push_back
(
neu
);
allNeumann
.
push_back
(
neu
);
}
}
void
elasticitySolver
::
addNeumannBCLua
(
int
dim
,
int
entityId
,
std
::
string
luaFunctionName
,
lua_State
*
L
)
{
neumannBC
neu
;
neu
.
g
=
new
groupOfElements
(
dim
,
entityId
);
neu
.
_f
=
new
simpleFunctionLua
<
SVector3
>
(
L
,
luaFunctionName
,
SVector3
(
0
,
0
,
0
));
neu
.
_tag
=
entityId
;
switch
(
dim
)
{
case
0
:
neu
.
onWhat
=
BoundaryCondition
::
ON_VERTEX
;
break
;
case
1
:
neu
.
onWhat
=
BoundaryCondition
::
ON_EDGE
;
break
;
case
2
:
neu
.
onWhat
=
BoundaryCondition
::
ON_FACE
;
break
;
default
:
return
;
}
allNeumann
.
push_back
(
neu
);
}
void
elasticitySolver
::
addElasticDomain
(
int
physical
,
double
e
,
double
nu
){
void
elasticitySolver
::
addElasticDomain
(
int
physical
,
double
e
,
double
nu
){
elasticField
field
;
elasticField
field
;
...
@@ -602,6 +609,9 @@ PView* elasticitySolver::buildVonMisesView(const std::string &postFileName)
...
@@ -602,6 +609,9 @@ PView* elasticitySolver::buildVonMisesView(const std::string &postFileName)
}
}
#endif
#endif
#if defined (HAVE_LUA)
#include
"Bindings.h"
#include
"Bindings.h"
void
elasticitySolverRegisterBindings
(
binding
*
b
)
void
elasticitySolverRegisterBindings
(
binding
*
b
)
{
{
...
@@ -663,3 +673,4 @@ void elasticitySolverRegisterBindings(binding *b)
...
@@ -663,3 +673,4 @@ void elasticitySolverRegisterBindings(binding *b)
cm
->
setArgNames
(
"model"
,
"tag"
,
NULL
);
cm
->
setArgNames
(
"model"
,
"tag"
,
NULL
);
}
}
#endif
This diff is collapsed.
Click to expand it.
Solver/elasticitySolver.h
+
9
−
4
View file @
75d6a829
...
@@ -55,7 +55,6 @@ struct neumannBC : public BoundaryCondition
...
@@ -55,7 +55,6 @@ struct neumannBC : public BoundaryCondition
simpleFunction
<
SVector3
>
*
_f
;
simpleFunction
<
SVector3
>
*
_f
;
neumannBC
()
:
BoundaryCondition
(),
_f
(
NULL
){}
neumannBC
()
:
BoundaryCondition
(),
_f
(
NULL
){}
};
};
// an elastic solver ...
// an elastic solver ...
class
elasticitySolver
class
elasticitySolver
{
{
...
@@ -78,12 +77,18 @@ class elasticitySolver
...
@@ -78,12 +77,18 @@ class elasticitySolver
elasticitySolver
(
int
tag
)
:
_tag
(
tag
),
LagSpace
(
0
),
pAssembler
(
0
),
LagrangeMultiplierSpace
(
0
)
{}
elasticitySolver
(
int
tag
)
:
_tag
(
tag
),
LagSpace
(
0
),
pAssembler
(
0
),
LagrangeMultiplierSpace
(
0
)
{}
elasticitySolver
(
GModel
*
model
,
int
tag
);
elasticitySolver
(
GModel
*
model
,
int
tag
);
void
addDirichletBC
(
int
dim
,
int
entityId
,
int
component
,
double
value
);
void
addDirichletBC
(
int
dim
,
int
entityId
,
int
component
,
double
value
);
void
addDirichletBCLua
(
int
dim
,
int
entityId
,
int
component
,
std
::
string
luaFunctionName
,
lua_State
*
L
);
void
addNeumannBC
(
int
dim
,
int
entityId
,
const
std
::
vector
<
double
>
value
);
void
addNeumannBC
(
int
dim
,
int
entityId
,
const
std
::
vector
<
double
>
value
);
void
addNeumannBCLua
(
int
dim
,
int
entityId
,
std
::
string
luaFunctionName
,
lua_State
*
L
);
void
addElasticDomain
(
int
tag
,
double
e
,
double
nu
);
void
addElasticDomain
(
int
tag
,
double
e
,
double
nu
);
#if defined (HAVE_LUA)
void
addDirichletBCLua
(
int
dim
,
int
entityId
,
int
component
,
std
::
string
luaFunctionName
,
lua_State
*
L
);
void
addNeumannBCLua
(
int
dim
,
int
entityId
,
std
::
string
luaFunctionName
,
lua_State
*
L
);
#endif
virtual
~
elasticitySolver
()
virtual
~
elasticitySolver
()
{
{
if
(
LagSpace
)
delete
LagSpace
;
if
(
LagSpace
)
delete
LagSpace
;
...
...
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