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
c9e4a9c5
Commit
c9e4a9c5
authored
15 years ago
by
Éric Béchet
Browse files
Options
Downloads
Patches
Plain Diff
No commit message
No commit message
parent
61a9b923
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
contrib/arc/highlevel.h
+69
-20
69 additions, 20 deletions
contrib/arc/highlevel.h
contrib/arc/mainElasticity.cpp
+14
-1
14 additions, 1 deletion
contrib/arc/mainElasticity.cpp
with
83 additions
and
21 deletions
contrib/arc/highlevel.h
+
69
−
20
View file @
c9e4a9c5
...
...
@@ -14,9 +14,11 @@
#include
<vector>
#include
<complex>
#include
<iostream>
#include
"dofManager.h"
#include
"SVector3.h"
#include
"MElement.h"
...
...
@@ -24,45 +26,42 @@ typedef SVector3 Vector;
class
Tensor2
{};
class
Tensor4
{};
template
<
class
T
>
struct
TensorialTraits
{};
template
<
>
struct
TensorialTraits
<
double
>
template
<
class
T
>
struct
TensorialTraits
{
typedef
double
ValType
;
typedef
Vector
GradType
;
typedef
T
ensor2
HessType
;
typedef
T
ValType
;
typedef
T
GradType
[
3
]
;
typedef
T
HessType
[
3
][
3
]
;
};
template
<
>
struct
TensorialTraits
<
std
::
complex
<
double
>
>
/*
template<> struct TensorialTraits<double>
{
typedef
std
::
complex
<
double
>
ValType
;
typedef double ValType;
typedef Vector GradType;
typedef Tensor2 HessType;
};
template<> struct TensorialTraits<Vector>
{
typedef Vector ValType;
typedef Tensor2 GradType;
typedef
Tensor
4
HessType
;
typedef Tensor
3
HessType;
};
*/
template
<
class
T
>
class
Function
// Fonction au sens EF du terme.
// renvoie valeur , gradient, hessien, etc...pour un element donné et un point donné
{
public:
virtual
~
Function
(){}
virtual
void
GetVal
(
double
uvw
[],
MElement
*
e
,
T
&
Val
)
const
=
0
;
virtual
void
GetGrad
(
double
uvw
[],
MElement
*
e
,
typename
TensorialTraits
<
T
>::
GradType
&
Grad
)
const
=
0
;
virtual
void
GetHess
(
double
uvw
[],
MElement
*
e
,
typename
TensorialTraits
<
T
>::
HessType
&
Hess
)
const
=
0
;
virtual
void
GetVal
(
double
uvw
[],
MElement
*
e
,
T
&
Val
)
const
{};
//
=0;
virtual
void
GetGrad
(
double
uvw
[],
MElement
*
e
,
typename
TensorialTraits
<
T
>::
GradType
&
Grad
)
const
{};
//
=0;
virtual
void
GetHess
(
double
uvw
[],
MElement
*
e
,
typename
TensorialTraits
<
T
>::
HessType
&
Hess
)
const
{};
//
=0;
};
class
SpaceBase
// renvoie des clefs de dofs
{
public:
virtual
void
getDofs
(
MElement
*
e
,
std
::
vector
<
Dof
>
&
vecD
)
=
0
;
virtual
void
getDofs
(
MElement
*
e
,
std
::
vector
<
Dof
>
&
vecD
)
{};
//
=0;
};
template
<
class
T
>
class
Space
:
public
SpaceBase
// renvoie des clefs de dofs et des fonctions de formes
...
...
@@ -71,7 +70,7 @@ public:
Space
(){};
virtual
~
Space
(){};
virtual
void
getDofsandSFs
(
MElement
*
e
,
std
::
vector
<
std
::
pair
<
Dof
,
Function
<
T
>*
>
>
&
vecDFF
)
{}
virtual
void
getSFs
(
std
::
vector
<
std
::
pair
<
Dof
,
Function
<
T
>*
>
>
&
vecDFF
)
=
0
;
virtual
void
getSFs
(
std
::
vector
<
std
::
pair
<
Dof
,
Function
<
T
>*
>
>
&
vecDFF
)
{};
//
=0;
};
...
...
@@ -90,19 +89,69 @@ template<class T1,class T2> class TermBilinear // terme associe a un "element"
// soit ils ont qqc a stockuer et sont tous distincts
// on peut utiliser des membres statiques pour ce qui est constant pour tous les instances
{
TermBilinear
();
virtual
double
getTerm
(
double
uvw
[],
MElement
&
e
,
Function
<
T1
>
&
SF
,
Function
<
T2
>
&
TF
)
=
0
;
virtual
void
Update
(
double
uvw
[],
MElement
&
e
,
Function
<
T1
>
&
SF
,
Function
<
T2
>
&
TF
)
=
0
;
public:
typedef
void
Stype
;
// TermBilinear(){};
virtual
double
getTerm
(
double
uvw
[],
MElement
&
e
,
Function
<
T1
>
&
SF
,
Function
<
T2
>
&
TF
,
Stype
*
info
)
{};
virtual
void
Update
(
double
uvw
[],
MElement
&
e
,
Function
<
T1
>
&
SF
,
Function
<
T2
>
&
TF
)
{};
// toute fonctios utiles . prevoir un algorithme ad hoc pour l'appliquer sur ts les pts de gauss ...
};
class
TermBilinearMeca
:
public
TermBilinear
<
double
,
double
>
{
public:
// typedef Tensor Stype;
// TermBilinear(){};
// virtual double getTerm(double uvw[],MElement &e,Function<double> &SF,Function<double> &TF,Stype* info) {};
// virtual void Update(double uvw[],MElement &e,Function<T1> &SF,Function<T2> &TF) {};
// toute fonctios utiles . prevoir un algorithme
};
class
FormBilinear
{};
// Renvoie des matrices élémentaires (ff)
class
TermBilinearMecaNL
:
public
TermBilinearMeca
{
public:
typedef
Tensor2
Stype
;
// TermBilinear(){};
// virtual double getTerm(double uvw[],MElement &e,Function<double> &SF,Function<double> &TF,Stype* info) {};
// virtual void Update(double uvw[],MElement &e,Function<T1> &SF,Function<T2> &TF) {};
// toute fonctios utiles . prevoir un algorithme
};
class
FormBilinearBase
{
public:
template
<
class
T
>
void
allocate
(
T
*
p
)
{
p
=
new
T
[
10
];
std
::
cout
<<
"10"
<<
std
::
endl
;}
template
<
class
T
>
void
get
(
T
*
tab
,
T
*
p
,
int
ndx
)
{
p
=&
tab
[
ndx
];}
};
template
<
>
void
FormBilinearBase
::
allocate
(
void
*
p
)
{
p
=
NULL
;
std
::
cout
<<
"null"
<<
std
::
endl
;}
template
<
>
void
FormBilinearBase
::
get
(
void
*
tab
,
void
*
p
,
int
ndx
)
{
p
=
NULL
;}
template
<
class
Term
>
class
FormBilinear
:
public
FormBilinearBase
// Renvoie des matrices élémentaires (ff)
// Accessoirement stocke des pointeurs vers les termes pour chaque element
// Doit etre initialisée AVANT toute opération (pour l'allocation)
// en principe ce truc ne devrait pas ^etre reimplemente
// il devrait donc dependre d'un parametre template TermBilinear
// elle sait "integrer" dans un elemeent
{
typedef
typename
Term
::
Stype
Stype
;
// le truc a stocker
Term
instance
;
// une instance du terme. E.g. utile pour toute initialisation (calcul tenseur materiel, etc...)
Stype
*
p
;
MElement
*
e
;
Function
<
double
>
*
a
;
Function
<
double
>
*
b
;
double
uvw
[
3
];
public:
void
func
(
void
)
{
allocate
(
p
);}
void
func2
(
void
)
{
instance
.
getTerm
(
uvw
,
*
e
,
*
a
,
*
b
,
p
);
}
};
class
FormLinear
{};
// renvoie des vecteurs élémentaires
// on devrait pouvoir construire une forme lin à partir d'une forme bilin pour les pb "matrix free"
...
...
This diff is collapsed.
Click to expand it.
contrib/arc/mainElasticity.cpp
+
14
−
1
View file @
c9e4a9c5
...
...
@@ -3,13 +3,26 @@
#include
"PView.h"
#include
"PViewData.h"
#include
"highlevel.h"
int
main
(
int
argc
,
char
*
argv
[]){
int
main
(
int
argc
,
char
*
argv
[])
{
if
(
argc
!=
2
){
printf
(
"usage : elasticity input_file_name
\n
"
);
return
-
1
;
}
FormBilinear
<
TermBilinearMeca
>
f
;
f
.
func
();
f
.
func2
();
FormBilinear
<
TermBilinearMecaNL
>
fnl
;
fnl
.
func
();
fnl
.
func2
();
// globals are still present in Gmsh
GmshInitialize
(
argc
,
argv
);
...
...
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