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
b4ffacde
Commit
b4ffacde
authored
12 years ago
by
Nicolas Marsic
Browse files
Options
Downloads
Patches
Plain Diff
Closure ...
parent
4caf2d4d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
FunctionSpace/BasisScalar.h
+17
-0
17 additions, 0 deletions
FunctionSpace/BasisScalar.h
FunctionSpace/BasisTest.cpp
+1
-1
1 addition, 1 deletion
FunctionSpace/BasisTest.cpp
FunctionSpace/TriNodeBasis.cpp
+36
-16
36 additions, 16 deletions
FunctionSpace/TriNodeBasis.cpp
with
54 additions
and
17 deletions
FunctionSpace/BasisScalar.h
+
17
−
0
View file @
b4ffacde
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
class
BasisScalar
:
public
Basis
{
class
BasisScalar
:
public
Basis
{
protected:
protected:
std
::
vector
<
const
Polynomial
*>*
basis
;
std
::
vector
<
const
Polynomial
*>*
basis
;
std
::
vector
<
const
Polynomial
*>*
revBasis
;
public:
public:
//! Deletes this BasisScalar
//! Deletes this BasisScalar
...
@@ -31,6 +32,11 @@ class BasisScalar: public Basis{
...
@@ -31,6 +32,11 @@ class BasisScalar: public Basis{
//! defining this (scalar) Basis
//! defining this (scalar) Basis
const
std
::
vector
<
const
Polynomial
*>&
getFunctions
(
void
)
const
;
const
std
::
vector
<
const
Polynomial
*>&
getFunctions
(
void
)
const
;
//! @param closure A natural number
//! @return Returns the set of @em Polynomial%s
//! defining this (scalar) Basis, for the given closure
const
std
::
vector
<
const
Polynomial
*>&
getFunctions
(
unsigned
int
closure
)
const
;
protected:
protected:
//! @internal
//! @internal
//! Instantiates a new BasisScalar
//! Instantiates a new BasisScalar
...
@@ -50,4 +56,15 @@ getFunctions(void) const{
...
@@ -50,4 +56,15 @@ getFunctions(void) const{
return
*
basis
;
return
*
basis
;
}
}
inline
const
std
::
vector
<
const
Polynomial
*>&
BasisScalar
::
getFunctions
(
unsigned
int
closure
)
const
{
if
(
!
closure
)
return
*
basis
;
else
return
*
revBasis
;
}
#endif
#endif
This diff is collapsed.
Click to expand it.
FunctionSpace/BasisTest.cpp
+
1
−
1
View file @
b4ffacde
...
@@ -32,7 +32,7 @@ int basisTest(int argc, char** argv){
...
@@ -32,7 +32,7 @@ int basisTest(int argc, char** argv){
writer
.
setDomain
(
goe
.
getAll
());
writer
.
setDomain
(
goe
.
getAll
());
// Plot Basis //
// Plot Basis //
HexEdg
eBasis
b
(
3
);
TriNod
eBasis
b
(
3
);
cout
<<
"Size: "
<<
b
.
getSize
()
<<
endl
;
cout
<<
"Size: "
<<
b
.
getSize
()
<<
endl
;
...
...
This diff is collapsed.
Click to expand it.
FunctionSpace/TriNodeBasis.cpp
+
36
−
16
View file @
b4ffacde
...
@@ -16,10 +16,13 @@ TriNodeBasis::TriNodeBasis(const int order){
...
@@ -16,10 +16,13 @@ TriNodeBasis::TriNodeBasis(const int order){
size
=
(
order
+
1
)
*
(
order
+
2
)
/
2
;
size
=
(
order
+
1
)
*
(
order
+
2
)
/
2
;
// Alloc Temporary Space //
// Alloc Temporary Space //
Polynomial
*
legendre
=
new
Polynomial
[
order
];
Polynomial
*
legendre
=
new
Polynomial
[
order
];
Polynomial
*
intLegendre
=
new
Polynomial
[
order
];
Polynomial
*
intLegendre
=
new
Polynomial
[
order
];
Polynomial
*
lagrangeSub
=
new
Polynomial
[
3
];
Polynomial
*
lagrangeSum
=
new
Polynomial
[
3
];
Polynomial
lagrangeSub
[
3
];
Polynomial
lagrangeSum
[
3
];
Polynomial
rLagrangeSub
[
3
];
Polynomial
rLagrangeSum
[
3
];
// Classical and Intrated-Scaled Legendre Polynomial //
// Classical and Intrated-Scaled Legendre Polynomial //
const
int
orderMinus
=
order
-
1
;
const
int
orderMinus
=
order
-
1
;
...
@@ -28,8 +31,9 @@ TriNodeBasis::TriNodeBasis(const int order){
...
@@ -28,8 +31,9 @@ TriNodeBasis::TriNodeBasis(const int order){
Legendre
::
intScaled
(
intLegendre
,
order
);
Legendre
::
intScaled
(
intLegendre
,
order
);
// Basis //
// Basis (& revert) //
basis
=
new
std
::
vector
<
const
Polynomial
*>
(
size
);
basis
=
new
std
::
vector
<
const
Polynomial
*>
(
size
);
revBasis
=
new
std
::
vector
<
const
Polynomial
*>
(
size
);
// Vertex Based (Lagrange) //
// Vertex Based (Lagrange) //
(
*
basis
)[
0
]
=
(
*
basis
)[
0
]
=
...
@@ -43,14 +47,23 @@ TriNodeBasis::TriNodeBasis(const int order){
...
@@ -43,14 +47,23 @@ TriNodeBasis::TriNodeBasis(const int order){
(
*
basis
)[
2
]
=
(
*
basis
)[
2
]
=
new
Polynomial
(
Polynomial
(
1
,
0
,
1
,
0
));
new
Polynomial
(
Polynomial
(
1
,
0
,
1
,
0
));
// Vertex Based (revert) //
for
(
int
i
=
0
;
i
<
3
;
i
++
)
(
*
revBasis
)[
i
]
=
(
*
basis
)[
i
];
// Lagrange Sum //
// Lagrange Sum (& revert) //
for
(
int
i
=
0
,
j
=
1
;
i
<
3
;
i
++
,
j
=
(
j
+
1
)
%
3
)
for
(
int
i
=
0
,
j
=
1
;
i
<
3
;
i
++
,
j
=
(
j
+
1
)
%
3
){
lagrangeSum
[
i
]
=
*
(
*
basis
)[
i
]
+
*
(
*
basis
)[
j
];
lagrangeSum
[
i
]
=
*
(
*
basis
)[
i
]
+
*
(
*
basis
)[
j
];
rLagrangeSum
[
i
]
=
*
(
*
basis
)[
j
]
+
*
(
*
basis
)[
i
];
}
// Lagrange Sub //
// Lagrange Sub (& revert) //
for
(
int
i
=
0
,
j
=
1
;
i
<
3
;
i
++
,
j
=
(
j
+
1
)
%
3
)
for
(
int
i
=
0
,
j
=
1
;
i
<
3
;
i
++
,
j
=
(
j
+
1
)
%
3
){
lagrangeSub
[
i
]
=
*
(
*
basis
)[
j
]
-
*
(
*
basis
)[
i
];
lagrangeSub
[
i
]
=
*
(
*
basis
)[
j
]
-
*
(
*
basis
)[
i
];
rLagrangeSub
[
i
]
=
*
(
*
basis
)[
i
]
-
*
(
*
basis
)[
j
];
}
// Edge Based //
// Edge Based //
...
@@ -60,7 +73,10 @@ TriNodeBasis::TriNodeBasis(const int order){
...
@@ -60,7 +73,10 @@ TriNodeBasis::TriNodeBasis(const int order){
for
(
int
e
=
0
;
e
<
3
;
e
++
){
for
(
int
e
=
0
;
e
<
3
;
e
++
){
(
*
basis
)[
i
]
=
new
Polynomial
(
(
*
basis
)[
i
]
=
new
Polynomial
(
intLegendre
[
l
].
compose
(
lagrangeSub
[
e
],
lagrangeSum
[
e
]));
intLegendre
[
l
].
compose
(
lagrangeSub
[
e
],
lagrangeSum
[
e
]));
(
*
revBasis
)[
i
]
=
new
Polynomial
(
intLegendre
[
l
].
compose
(
rLagrangeSub
[
e
],
rLagrangeSum
[
e
]));
i
++
;
i
++
;
}
}
}
}
...
@@ -75,6 +91,7 @@ TriNodeBasis::TriNodeBasis(const int order){
...
@@ -75,6 +91,7 @@ TriNodeBasis::TriNodeBasis(const int order){
intLegendre
[
l1
].
compose
(
lagrangeSub
[
0
],
lagrangeSum
[
0
])
*
intLegendre
[
l1
].
compose
(
lagrangeSub
[
0
],
lagrangeSum
[
0
])
*
legendre
[
l2
].
compose
(
p
)
*
*
(
*
basis
)[
2
]);
legendre
[
l2
].
compose
(
p
)
*
*
(
*
basis
)[
2
]);
(
*
revBasis
)[
i
]
=
(
*
basis
)[
i
];
i
++
;
i
++
;
}
}
}
}
...
@@ -82,13 +99,16 @@ TriNodeBasis::TriNodeBasis(const int order){
...
@@ -82,13 +99,16 @@ TriNodeBasis::TriNodeBasis(const int order){
// Free Temporary Sapce //
// Free Temporary Sapce //
delete
[]
legendre
;
delete
[]
legendre
;
delete
[]
intLegendre
;
delete
[]
intLegendre
;
delete
[]
lagrangeSub
;
delete
[]
lagrangeSum
;
}
}
TriNodeBasis
::~
TriNodeBasis
(
void
){
TriNodeBasis
::~
TriNodeBasis
(
void
){
for
(
int
i
=
0
;
i
<
size
;
i
++
)
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
delete
(
*
basis
)[
i
];
delete
(
*
basis
)[
i
];
if
(
i
>=
nVertex
&&
i
<
nVertex
+
nEdge
)
delete
(
*
revBasis
)[
i
];
}
delete
basis
;
delete
basis
;
delete
revBasis
;
}
}
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