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
331b2b96
Commit
331b2b96
authored
12 years ago
by
Nicolas Marsic
Browse files
Options
Downloads
Patches
Plain Diff
DofManager: OK -- FunctionSpace: GetKeys part one
parent
7384796a
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
FunctionSpace/FunctionSpace.cpp
+86
-2
86 additions, 2 deletions
FunctionSpace/FunctionSpace.cpp
FunctionSpace/FunctionSpace.h
+13
-33
13 additions, 33 deletions
FunctionSpace/FunctionSpace.h
with
99 additions
and
35 deletions
FunctionSpace/FunctionSpace.cpp
+
86
−
2
View file @
331b2b96
...
...
@@ -13,7 +13,6 @@ FunctionSpace::FunctionSpace(const GroupOfElement& goe, int basisType, int order
// Init Struct //
basis
=
BasisGenerator
::
generate
(
elementType
,
basisType
,
order
);
eToGoD
=
new
map
<
const
MElement
*
,
const
GroupOfDof
*
,
ElementComparator
>
;
// Count Function per Entity //
int
nVertex
=
goe
.
get
(
0
).
getNumVertices
();
...
...
@@ -36,8 +35,93 @@ FunctionSpace::FunctionSpace(const GroupOfElement& goe, int basisType, int order
fPerCell
=
basis
->
getNCellBased
();
// We always got 1 cell
}
const
vector
<
Dof
*>
FunctionSpace
::
getKeys
(
const
MElement
&
elem
)
const
{
// nTotVertex
int
nTotVertex
=
goe
->
getNVertex
();
// Const_Cast //
MElement
&
element
=
const_cast
<
MElement
&>
(
elem
);
// Get Element Data //
const
int
nVertex
=
element
.
getNumVertices
();
const
int
nEdge
=
element
.
getNumEdges
();
const
int
nFace
=
element
.
getNumFaces
();
vector
<
MVertex
*>
vertex
(
nVertex
);
vector
<
MEdge
>
edge
(
nEdge
);
vector
<
MFace
>
face
(
nFace
);
for
(
int
i
=
0
;
i
<
nVertex
;
i
++
)
vertex
[
i
]
=
element
.
getVertex
(
i
);
for
(
int
i
=
0
;
i
<
nEdge
;
i
++
)
edge
[
i
]
=
element
.
getEdge
(
i
);
for
(
int
i
=
0
;
i
<
nFace
;
i
++
)
face
[
i
]
=
element
.
getFace
(
i
);
// Get FunctionSpace Data for this Element //
const
int
nFVertex
=
getNFunctionPerVertex
(
element
);
const
int
nFEdge
=
getNFunctionPerEdge
(
element
);
const
int
nFFace
=
getNFunctionPerFace
(
element
);
const
int
nFCell
=
getNFunctionPerCell
(
element
);
// Create Dof //
const
int
nDofVertex
=
nFVertex
*
nVertex
;
const
int
nDofEdge
=
nFEdge
*
nEdge
;
const
int
nDofFace
=
nFFace
*
nFace
;
const
int
nDofCell
=
nFCell
;
int
nDof
=
nDofVertex
+
nDofEdge
+
nDofFace
+
nDofCell
;
vector
<
Dof
*>
myDof
(
nDof
);
int
it
=
0
;
// Add Vertex Based Dof //
for
(
int
i
=
0
;
i
<
nVertex
;
i
++
){
// Get Id of Vertex
const
int
id
=
vertex
[
i
]
->
getNum
();
// New Dof
for
(
int
j
=
0
;
j
<
nFVertex
;
j
++
){
myDof
[
it
]
=
new
Dof
(
id
,
j
);
it
++
;
}
}
// Add Edge Based Dof //
for
(
int
i
=
0
;
i
<
nEdge
;
i
++
){
// Get Id of Edge
MVertex
*
vEdge0
=
edge
[
i
].
getSortedVertex
(
0
);
MVertex
*
vEdge1
=
edge
[
i
].
getSortedVertex
(
1
);
const
int
id
=
vEdge0
->
getNum
()
+
vEdge1
->
getNum
()
*
nTotVertex
;
// Insert new Dof
for
(
int
j
=
0
;
j
<
nFEdge
;
j
++
){
myDof
[
it
]
=
new
Dof
(
id
,
j
);
it
++
;
}
}
// Add Cell Based Dof //
// Get Id of Cell
const
int
id
=
element
.
getNum
()
*
nTotVertex
*
nTotVertex
;
// Insert new Dof
for
(
int
j
=
0
;
j
<
nFCell
;
j
++
){
myDof
[
it
]
=
new
Dof
(
id
,
j
);
it
++
;
}
return
myDof
;
}
FunctionSpace
::~
FunctionSpace
(
void
){
delete
basis
;
delete
eToGoD
;
}
This diff is collapsed.
Click to expand it.
FunctionSpace/FunctionSpace.h
+
13
−
33
View file @
331b2b96
#ifndef _FUNCTIONSPACE_H_
#define _FUNCTIONSPACE_H_
#include
<map>
#include
"Dof.h"
#include
"GroupOfDof.h"
#include
<vector>
#include
"Basis.h"
#include
"GroupOfElement.h"
#include
"MElement.h"
#include
"Dof.h"
/**
@class FunctionSpace
...
...
@@ -24,13 +22,9 @@ class ElementComparator;
class
FunctionSpace
{
private:
friend
class
DofManager
;
const
Basis
*
basis
;
const
GroupOfElement
*
goe
;
std
::
map
<
const
MElement
*
,
const
GroupOfDof
*
,
ElementComparator
>*
eToGoD
;
int
fPerVertex
;
int
fPerEdge
;
int
fPerFace
;
...
...
@@ -43,20 +37,14 @@ class FunctionSpace{
~
FunctionSpace
(
void
);
const
GroupOfElement
&
getSupport
(
void
)
const
;
const
Basis
&
getBasis
(
MElement
&
element
)
const
;
const
Basis
&
getBasis
(
const
MElement
&
element
)
const
;
int
getNFunctionPerVertex
(
MElement
&
element
)
const
;
int
getNFunctionPerEdge
(
MElement
&
element
)
const
;
int
getNFunctionPerFace
(
MElement
&
element
)
const
;
int
getNFunctionPerCell
(
MElement
&
element
)
const
;
const
std
::
vector
<
Dof
*>
getKeys
(
const
MElement
&
element
)
const
;
private:
void
associate
(
const
MElement
&
element
,
const
GroupOfDof
&
god
);
};
class
ElementComparator
{
public:
bool
operator
()(
const
MElement
*
a
,
const
MElement
*
b
)
const
;
int
getNFunctionPerVertex
(
const
MElement
&
element
)
const
;
int
getNFunctionPerEdge
(
const
MElement
&
element
)
const
;
int
getNFunctionPerFace
(
const
MElement
&
element
)
const
;
int
getNFunctionPerCell
(
const
MElement
&
element
)
const
;
};
//////////////////////
...
...
@@ -67,32 +55,24 @@ inline const GroupOfElement& FunctionSpace::getSupport(void) const{
return
*
goe
;
}
inline
const
Basis
&
FunctionSpace
::
getBasis
(
MElement
&
element
)
const
{
inline
const
Basis
&
FunctionSpace
::
getBasis
(
const
MElement
&
element
)
const
{
return
*
basis
;
}
inline
int
FunctionSpace
::
getNFunctionPerVertex
(
MElement
&
element
)
const
{
inline
int
FunctionSpace
::
getNFunctionPerVertex
(
const
MElement
&
element
)
const
{
return
fPerVertex
;
}
inline
int
FunctionSpace
::
getNFunctionPerEdge
(
MElement
&
element
)
const
{
inline
int
FunctionSpace
::
getNFunctionPerEdge
(
const
MElement
&
element
)
const
{
return
fPerEdge
;
}
inline
int
FunctionSpace
::
getNFunctionPerFace
(
MElement
&
element
)
const
{
inline
int
FunctionSpace
::
getNFunctionPerFace
(
const
MElement
&
element
)
const
{
return
fPerFace
;
}
inline
int
FunctionSpace
::
getNFunctionPerCell
(
MElement
&
element
)
const
{
inline
int
FunctionSpace
::
getNFunctionPerCell
(
const
MElement
&
element
)
const
{
return
fPerCell
;
}
inline
void
FunctionSpace
::
associate
(
const
MElement
&
element
,
const
GroupOfDof
&
god
){
//return fPerCell;
}
inline
bool
ElementComparator
::
operator
()(
const
MElement
*
a
,
const
MElement
*
b
)
const
{
return
a
->
getNum
()
<
b
->
getNum
();
}
#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