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
e1581b4d
Commit
e1581b4d
authored
10 years ago
by
Nicolas Marsic
Browse files
Options
Downloads
Patches
Plain Diff
New FunctionSpace getKey(): start point
parent
5ff79b44
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
+23
-19
23 additions, 19 deletions
FunctionSpace/FunctionSpace.cpp
FunctionSpace/FunctionSpace.h
+10
-18
10 additions, 18 deletions
FunctionSpace/FunctionSpace.h
with
33 additions
and
37 deletions
FunctionSpace/FunctionSpace.cpp
+
23
−
19
View file @
e1581b4d
...
...
@@ -79,7 +79,7 @@ void FunctionSpace::build(const GroupOfElement& goe, string family){
}
// Build Dof //
buildDof
();
buildDof
();
// Find next offset //
nxtOffset
=
findMaxType
()
+
1
;
...
...
@@ -90,11 +90,14 @@ void FunctionSpace::buildDof(void){
const
size_t
nElement
=
goe
->
getNumber
();
const
vector
<
const
MElement
*>&
element
=
goe
->
getAll
();
vector
<
Dof
>
myDof
;
size_t
nDof
;
// Create Dofs //
for
(
size_t
i
=
0
;
i
<
nElement
;
i
++
){
// Get Dof for this Element
vector
<
Dof
>
myDof
=
getKeys
(
*
(
element
[
i
]));
size_t
nDof
=
myDof
.
size
();
getKeys
(
*
(
element
[
i
])
,
myDof
);
nDof
=
myDof
.
size
();
// Add Dofs
for
(
size_t
j
=
0
;
j
<
nDof
;
j
++
)
...
...
@@ -118,7 +121,8 @@ size_t FunctionSpace::findMaxType(void){
return
maxType
;
}
vector
<
Dof
>
FunctionSpace
::
getUnorderedKeys
(
const
MElement
&
elem
)
const
{
void
FunctionSpace
::
getUnorderedKeys
(
const
MElement
&
elem
,
std
::
vector
<
Dof
>&
dof
)
const
{
// Const_Cast //
MElement
&
element
=
const_cast
<
MElement
&>
(
elem
);
...
...
@@ -147,20 +151,19 @@ vector<Dof> FunctionSpace::getUnorderedKeys(const MElement& elem) const{
const
size_t
fPerFace
=
this
->
fPerFace
[
type
];
const
size_t
fPerCell
=
this
->
fPerCell
[
type
];
size_t
it
=
0
;
size_t
nDof
=
fPerVertex
*
nVertex
+
fPerEdge
*
nEdge
+
fPerFace
*
nFace
+
fPerCell
;
vector
<
Dof
>
myDof
(
nDof
);
size_t
it
=
0
;
dof
.
resize
(
nDof
);
// Add Vertex Based Dof //
for
(
size_t
i
=
0
;
i
<
nVertex
;
i
++
){
for
(
size_t
j
=
0
;
j
<
fPerVertex
;
j
++
){
myD
of
[
it
].
setDof
(
mesh
->
getGlobalId
(
*
vertex
[
i
]),
j
+
offset
);
d
of
[
it
].
setDof
(
mesh
->
getGlobalId
(
*
vertex
[
i
]),
j
+
offset
);
it
++
;
}
}
...
...
@@ -168,7 +171,7 @@ vector<Dof> FunctionSpace::getUnorderedKeys(const MElement& elem) const{
// Add Edge Based Dof //
for
(
size_t
i
=
0
;
i
<
nEdge
;
i
++
){
for
(
size_t
j
=
0
;
j
<
fPerEdge
;
j
++
){
myD
of
[
it
].
setDof
(
mesh
->
getGlobalId
(
edge
[
i
]),
j
+
offset
);
d
of
[
it
].
setDof
(
mesh
->
getGlobalId
(
edge
[
i
]),
j
+
offset
);
it
++
;
}
}
...
...
@@ -176,21 +179,19 @@ vector<Dof> FunctionSpace::getUnorderedKeys(const MElement& elem) const{
// Add Face Based Dof //
for
(
size_t
i
=
0
;
i
<
nFace
;
i
++
){
for
(
size_t
j
=
0
;
j
<
fPerFace
;
j
++
){
myD
of
[
it
].
setDof
(
mesh
->
getGlobalId
(
face
[
i
]),
j
+
offset
);
d
of
[
it
].
setDof
(
mesh
->
getGlobalId
(
face
[
i
]),
j
+
offset
);
it
++
;
}
}
// Add Cell Based Dof //
for
(
size_t
j
=
0
;
j
<
fPerCell
;
j
++
){
myD
of
[
it
].
setDof
(
mesh
->
getGlobalId
(
element
),
j
+
offset
);
d
of
[
it
].
setDof
(
mesh
->
getGlobalId
(
element
),
j
+
offset
);
it
++
;
}
return
myDof
;
}
v
ector
<
Dof
>
FunctionSpace
::
getKeys
(
const
MElement
&
elem
)
const
{
v
oid
FunctionSpace
::
getKeys
(
const
MElement
&
elem
,
std
::
vector
<
Dof
>&
dof
)
const
{
// Const_Cast //
MElement
&
element
=
const_cast
<
MElement
&>
(
elem
);
...
...
@@ -214,11 +215,10 @@ vector<Dof> FunctionSpace::getKeys(const MElement& elem) const{
MElement
*
permElement
=
factory
.
create
(
lowOrderTag
,
vertex
,
element
.
getNum
());
// Get Dofs from permuted Element //
vector
<
Dof
>
myDofs
=
getUnorderedKeys
(
*
permElement
);
getUnorderedKeys
(
*
permElement
,
dof
);
// Free and Return //
delete
permElement
;
return
myDofs
;
}
void
FunctionSpace
::
getKeys
(
const
GroupOfElement
&
goe
,
...
...
@@ -227,13 +227,17 @@ void FunctionSpace::getKeys(const GroupOfElement& goe,
const
vector
<
const
MElement
*>&
element
=
goe
.
getAll
();
const
size_t
nElement
=
element
.
size
();
// Dof Vector //
vector
<
Dof
>
myDof
;
// Loop on Elements //
for
(
size_t
e
=
0
;
e
<
nElement
;
e
++
){
// Get my Dofs
vector
<
Dof
>
myDof
=
getUnorderedKeys
(
*
element
[
e
]);
const
size_t
nDof
=
myDof
.
size
();
getUnorderedKeys
(
*
element
[
e
],
myDof
);
// Add my Dofs
const
size_t
nDof
=
myDof
.
size
();
for
(
size_t
d
=
0
;
d
<
nDof
;
d
++
)
dof
.
insert
(
myDof
[
d
]);
}
...
...
@@ -250,5 +254,5 @@ void FunctionSpace::getKeys(const GroupOfElement& goe,
// Create Dofs //
for
(
size_t
i
=
0
;
i
<
nElement
;
i
++
)
dof
[
i
]
=
getKeys
(
*
(
element
[
i
]));
getKeys
(
*
(
element
[
i
])
,
dof
[
i
]
);
}
This diff is collapsed.
Click to expand it.
FunctionSpace/FunctionSpace.h
+
10
−
18
View file @
e1581b4d
...
...
@@ -56,8 +56,7 @@ class FunctionSpace{
size_t
order
;
// Dofs //
std
::
set
<
Dof
>
dof
;
std
::
vector
<
std
::
vector
<
Dof
>
>
group
;
std
::
set
<
Dof
>
dof
;
public:
virtual
~
FunctionSpace
(
void
);
...
...
@@ -69,12 +68,11 @@ class FunctionSpace{
const
Basis
&
getBasis
(
const
MElement
&
element
)
const
;
const
Basis
&
getBasis
(
size_t
eType
)
const
;
const
GroupOfElement
&
getSupport
(
void
)
const
;
const
std
::
set
<
Dof
>&
getAllDofs
(
void
)
const
;
std
::
vector
<
Dof
>
getKeys
(
const
MElement
&
element
)
const
;
void
getKeys
(
const
GroupOfElement
&
goe
,
std
::
set
<
Dof
>&
dof
)
const
;
void
getKeys
(
const
GroupOfElement
&
goe
,
std
::
vector
<
std
::
vector
<
Dof
>
>&
dof
)
const
;
void
getKeys
(
const
MElement
&
element
,
std
::
vector
<
Dof
>&
dof
)
const
;
void
getKeys
(
const
GroupOfElement
&
goe
,
std
::
set
<
Dof
>&
dof
)
const
;
void
getKeys
(
const
GroupOfElement
&
goe
,
std
::
vector
<
std
::
vector
<
Dof
>
>&
dof
)
const
;
protected:
FunctionSpace
(
void
);
...
...
@@ -83,7 +81,7 @@ class FunctionSpace{
void
buildDof
(
void
);
size_t
findMaxType
(
void
);
std
::
vector
<
Dof
>
getUnorderedKeys
(
const
MElement
&
element
)
const
;
void
getUnorderedKeys
(
const
MElement
&
element
,
std
::
vector
<
Dof
>&
dof
)
const
;
};
...
...
@@ -126,13 +124,11 @@ class FunctionSpace{
@return Returns the support of this FunctionSpace
**
@fn FunctionSpace::getAllDofs
@return Returns the set of all the Dof%s associated to this FunctionSpace
**
@fn std::vector<Dof> FunctionSpace::getKeys(const MElement&) const
@fn void FunctionSpace::getKeys(const MElement&,std::vector<Dof>&) const
@param element A MElement
@return Returns all the Dof%s associated to the given MElement
@param dof A vector of Dof%s
Populates the given vector with the Dof%s associated to the given MElement
**
@fn void FunctionSpace::getKeys(const GroupOfElement&, std::set<Dof>&) const
...
...
@@ -180,8 +176,4 @@ inline const GroupOfElement& FunctionSpace::getSupport(void) const{
return
*
goe
;
}
inline
const
std
::
set
<
Dof
>&
FunctionSpace
::
getAllDofs
(
void
)
const
{
return
dof
;
}
#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