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
13a36430
Commit
13a36430
authored
12 years ago
by
Nicolas Marsic
Browse files
Options
Downloads
Patches
Plain Diff
Closuer for Quadrangles (WARNING: Still nedd good Gauss Points)
parent
cf1e26e2
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/QuadEdgeBasis.cpp
+45
-16
45 additions, 16 deletions
FunctionSpace/QuadEdgeBasis.cpp
FunctionSpace/QuadNodeBasis.cpp
+22
-5
22 additions, 5 deletions
FunctionSpace/QuadNodeBasis.cpp
FunctionSpace/TriNodeBasis.cpp
+3
-0
3 additions, 0 deletions
FunctionSpace/TriNodeBasis.cpp
with
70 additions
and
21 deletions
FunctionSpace/QuadEdgeBasis.cpp
+
45
−
16
View file @
13a36430
...
@@ -25,11 +25,11 @@ QuadEdgeBasis::QuadEdgeBasis(const int order){
...
@@ -25,11 +25,11 @@ QuadEdgeBasis::QuadEdgeBasis(const int order){
Polynomial
*
legendreX
=
new
Polynomial
[
orderPlus
];
Polynomial
*
legendreX
=
new
Polynomial
[
orderPlus
];
Polynomial
*
legendreY
=
new
Polynomial
[
orderPlus
];
Polynomial
*
legendreY
=
new
Polynomial
[
orderPlus
];
Polynomial
*
lagrange
=
new
Polynomial
[
4
];
Polynomial
lagrange
[
4
];
Polynomial
*
l
agrangeSum
=
new
Polynomial
[
4
];
Polynomial
l
ifting
[
4
];
Polynomial
lagrangeSum
[
4
];
Polynomial
*
lifting
=
new
Polynomial
[
4
];
Polynomial
lifting
Sub
[
4
];
Polynomial
*
l
iftingSub
=
new
Polynomial
[
4
];
Polynomial
rL
iftingSub
[
4
];
// Integrated and classical Legendre Polynomial //
// Integrated and classical Legendre Polynomial //
Legendre
::
integrated
(
intLegendre
,
orderPlus
);
Legendre
::
integrated
(
intLegendre
,
orderPlus
);
...
@@ -74,12 +74,14 @@ QuadEdgeBasis::QuadEdgeBasis(const int order){
...
@@ -74,12 +74,14 @@ QuadEdgeBasis::QuadEdgeBasis(const int order){
(
Polynomial
(
1
,
0
,
1
,
0
));
(
Polynomial
(
1
,
0
,
1
,
0
));
// Lifting Sub //
// Lifting Sub //
for
(
int
i
=
0
,
j
=
1
;
i
<
4
;
i
++
,
j
=
(
j
+
1
)
%
4
)
for
(
int
i
=
0
,
j
=
1
;
i
<
4
;
i
++
,
j
=
(
j
+
1
)
%
4
){
liftingSub
[
i
]
=
lifting
[
j
]
-
lifting
[
i
];
liftingSub
[
i
]
=
lifting
[
j
]
-
lifting
[
i
];
rLiftingSub
[
i
]
=
lifting
[
i
]
-
lifting
[
j
];
}
// Basis (temporary --- *no* const) //
// Basis (temporary --- *no* const) //
std
::
vector
<
std
::
vector
<
Polynomial
>*>
basis
(
size
);
std
::
vector
<
std
::
vector
<
Polynomial
>*>
basis
(
size
);
std
::
vector
<
std
::
vector
<
Polynomial
>*>
revBasis
(
size
);
// Edge Based (Nedelec) //
// Edge Based (Nedelec) //
...
@@ -87,6 +89,7 @@ QuadEdgeBasis::QuadEdgeBasis(const int order){
...
@@ -87,6 +89,7 @@ QuadEdgeBasis::QuadEdgeBasis(const int order){
Polynomial
oneHalf
(
0.5
,
0
,
0
,
0
);
Polynomial
oneHalf
(
0.5
,
0
,
0
,
0
);
for
(
int
e
=
0
;
e
<
4
;
e
++
){
for
(
int
e
=
0
;
e
<
4
;
e
++
){
// Direct
basis
[
i
]
=
new
std
::
vector
<
Polynomial
>
(
liftingSub
[
e
].
gradient
());
basis
[
i
]
=
new
std
::
vector
<
Polynomial
>
(
liftingSub
[
e
].
gradient
());
basis
[
i
]
->
at
(
0
).
mul
(
lagrangeSum
[
e
]);
basis
[
i
]
->
at
(
0
).
mul
(
lagrangeSum
[
e
]);
...
@@ -97,6 +100,18 @@ QuadEdgeBasis::QuadEdgeBasis(const int order){
...
@@ -97,6 +100,18 @@ QuadEdgeBasis::QuadEdgeBasis(const int order){
basis
[
i
]
->
at
(
1
).
mul
(
oneHalf
);
basis
[
i
]
->
at
(
1
).
mul
(
oneHalf
);
basis
[
i
]
->
at
(
2
).
mul
(
oneHalf
);
basis
[
i
]
->
at
(
2
).
mul
(
oneHalf
);
// Revert
revBasis
[
i
]
=
new
std
::
vector
<
Polynomial
>
(
rLiftingSub
[
e
].
gradient
());
revBasis
[
i
]
->
at
(
0
).
mul
(
lagrangeSum
[
e
]);
revBasis
[
i
]
->
at
(
1
).
mul
(
lagrangeSum
[
e
]);
revBasis
[
i
]
->
at
(
2
).
mul
(
lagrangeSum
[
e
]);
revBasis
[
i
]
->
at
(
0
).
mul
(
oneHalf
);
revBasis
[
i
]
->
at
(
1
).
mul
(
oneHalf
);
revBasis
[
i
]
->
at
(
2
).
mul
(
oneHalf
);
// Next
i
++
;
i
++
;
}
}
...
@@ -104,7 +119,12 @@ QuadEdgeBasis::QuadEdgeBasis(const int order){
...
@@ -104,7 +119,12 @@ QuadEdgeBasis::QuadEdgeBasis(const int order){
for
(
int
l
=
1
;
l
<
orderPlus
;
l
++
){
for
(
int
l
=
1
;
l
<
orderPlus
;
l
++
){
for
(
int
e
=
0
;
e
<
4
;
e
++
){
for
(
int
e
=
0
;
e
<
4
;
e
++
){
basis
[
i
]
=
basis
[
i
]
=
new
std
::
vector
<
Polynomial
>
((
intLegendre
[
l
].
compose
(
liftingSub
[
e
])
*
lagrangeSum
[
e
]).
gradient
());
new
std
::
vector
<
Polynomial
>
((
intLegendre
[
l
].
compose
(
liftingSub
[
e
])
*
lagrangeSum
[
e
]).
gradient
());
revBasis
[
i
]
=
new
std
::
vector
<
Polynomial
>
((
intLegendre
[
l
].
compose
(
rLiftingSub
[
e
])
*
lagrangeSum
[
e
]).
gradient
());
i
++
;
i
++
;
}
}
...
@@ -131,6 +151,8 @@ QuadEdgeBasis::QuadEdgeBasis(const int order){
...
@@ -131,6 +151,8 @@ QuadEdgeBasis::QuadEdgeBasis(const int order){
for
(
int
l2
=
1
;
l2
<
orderPlus
;
l2
++
){
for
(
int
l2
=
1
;
l2
<
orderPlus
;
l2
++
){
basis
[
i
]
=
new
std
::
vector
<
Polynomial
>
((
iLegendreX
[
l1
]
*
iLegendreY
[
l2
]).
gradient
());
basis
[
i
]
=
new
std
::
vector
<
Polynomial
>
((
iLegendreX
[
l1
]
*
iLegendreY
[
l2
]).
gradient
());
revBasis
[
i
]
=
basis
[
i
];
i
++
;
i
++
;
}
}
}
}
...
@@ -144,6 +166,8 @@ QuadEdgeBasis::QuadEdgeBasis(const int order){
...
@@ -144,6 +166,8 @@ QuadEdgeBasis::QuadEdgeBasis(const int order){
basis
[
i
]
->
at
(
1
)
=
iLegendreX
[
l1
]
*
legendreY
[
l2
]
*
-
1
;
basis
[
i
]
->
at
(
1
)
=
iLegendreX
[
l1
]
*
legendreY
[
l2
]
*
-
1
;
basis
[
i
]
->
at
(
2
)
=
zero
;
basis
[
i
]
->
at
(
2
)
=
zero
;
revBasis
[
i
]
=
basis
[
i
];
i
++
;
i
++
;
}
}
}
}
...
@@ -161,9 +185,12 @@ QuadEdgeBasis::QuadEdgeBasis(const int order){
...
@@ -161,9 +185,12 @@ QuadEdgeBasis::QuadEdgeBasis(const int order){
basis
[
iPlus
]
->
at
(
1
)
=
iLegendreX
[
l
];
basis
[
iPlus
]
->
at
(
1
)
=
iLegendreX
[
l
];
basis
[
iPlus
]
->
at
(
2
)
=
zero
;
basis
[
iPlus
]
->
at
(
2
)
=
zero
;
revBasis
[
i
]
=
basis
[
i
];
i
++
;
i
++
;
}
}
// Free Temporary Sapce //
// Free Temporary Sapce //
delete
[]
legendre
;
delete
[]
legendre
;
delete
[]
intLegendre
;
delete
[]
intLegendre
;
...
@@ -173,21 +200,23 @@ QuadEdgeBasis::QuadEdgeBasis(const int order){
...
@@ -173,21 +200,23 @@ QuadEdgeBasis::QuadEdgeBasis(const int order){
delete
[]
legendreX
;
delete
[]
legendreX
;
delete
[]
legendreY
;
delete
[]
legendreY
;
delete
[]
lagrange
;
delete
[]
lagrangeSum
;
delete
[]
lifting
;
delete
[]
liftingSub
;
// Set Basis //
// Set Basis //
this
->
basis
=
new
std
::
vector
<
const
std
::
vector
<
Polynomial
>*>
this
->
basis
=
new
std
::
vector
<
const
std
::
vector
<
Polynomial
>*>
(
basis
.
begin
(),
basis
.
end
());
(
basis
.
begin
(),
basis
.
end
());
this
->
revBasis
=
new
std
::
vector
<
const
std
::
vector
<
Polynomial
>*>
(
revBasis
.
begin
(),
revBasis
.
end
());
}
}
QuadEdgeBasis
::~
QuadEdgeBasis
(
void
){
QuadEdgeBasis
::~
QuadEdgeBasis
(
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.
FunctionSpace/QuadNodeBasis.cpp
+
22
−
5
View file @
13a36430
...
@@ -17,7 +17,7 @@ QuadNodeBasis::QuadNodeBasis(const int order){
...
@@ -17,7 +17,7 @@ QuadNodeBasis::QuadNodeBasis(const int order){
// Alloc Temporary Space //
// Alloc Temporary Space //
Polynomial
*
legendre
=
new
Polynomial
[
order
];
Polynomial
*
legendre
=
new
Polynomial
[
order
];
Polynomial
*
lifting
=
new
Polynomial
[
4
];
Polynomial
lifting
[
4
];
// Legendre Polynomial //
// Legendre Polynomial //
Legendre
::
integrated
(
legendre
,
order
);
Legendre
::
integrated
(
legendre
,
order
);
...
@@ -42,7 +42,8 @@ QuadNodeBasis::QuadNodeBasis(const int order){
...
@@ -42,7 +42,8 @@ QuadNodeBasis::QuadNodeBasis(const int order){
// Basis //
// Basis //
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
]
=
...
@@ -61,6 +62,11 @@ QuadNodeBasis::QuadNodeBasis(const int order){
...
@@ -61,6 +62,11 @@ QuadNodeBasis::QuadNodeBasis(const int order){
new
Polynomial
((
Polynomial
(
1
,
0
,
0
,
0
)
-
Polynomial
(
1
,
1
,
0
,
0
))
*
new
Polynomial
((
Polynomial
(
1
,
0
,
0
,
0
)
-
Polynomial
(
1
,
1
,
0
,
0
))
*
(
Polynomial
(
1
,
0
,
1
,
0
)));
(
Polynomial
(
1
,
0
,
1
,
0
)));
// Vertex Based (Revert) //
for
(
int
i
=
0
;
i
<
3
;
i
++
)
(
*
revBasis
)[
i
]
=
(
*
basis
)[
i
];
// Edge Based //
// Edge Based //
int
i
=
4
;
int
i
=
4
;
...
@@ -69,11 +75,15 @@ QuadNodeBasis::QuadNodeBasis(const int order){
...
@@ -69,11 +75,15 @@ QuadNodeBasis::QuadNodeBasis(const int order){
(
*
basis
)[
i
]
=
(
*
basis
)[
i
]
=
new
Polynomial
(
legendre
[
l
].
compose
(
lifting
[
e2
]
-
lifting
[
e1
])
*
new
Polynomial
(
legendre
[
l
].
compose
(
lifting
[
e2
]
-
lifting
[
e1
])
*
(
*
(
*
basis
)[
e1
]
+
*
(
*
basis
)[
e2
]));
(
*
(
*
basis
)[
e1
]
+
*
(
*
basis
)[
e2
]));
(
*
revBasis
)[
i
]
=
new
Polynomial
(
legendre
[
l
].
compose
(
lifting
[
e1
]
-
lifting
[
e2
])
*
(
*
(
*
basis
)[
e1
]
+
*
(
*
basis
)[
e2
]));
i
++
;
i
++
;
}
}
}
}
// Cell Based //
// Cell Based //
Polynomial
px
=
Polynomial
(
2
,
1
,
0
,
0
);
Polynomial
px
=
Polynomial
(
2
,
1
,
0
,
0
);
Polynomial
py
=
Polynomial
(
2
,
0
,
1
,
0
);
Polynomial
py
=
Polynomial
(
2
,
0
,
1
,
0
);
...
@@ -86,18 +96,25 @@ QuadNodeBasis::QuadNodeBasis(const int order){
...
@@ -86,18 +96,25 @@ QuadNodeBasis::QuadNodeBasis(const int order){
(
*
basis
)[
i
]
=
(
*
basis
)[
i
]
=
new
Polynomial
(
legendre
[
l1
].
compose
(
px
)
*
legendre
[
l2
].
compose
(
py
));
new
Polynomial
(
legendre
[
l1
].
compose
(
px
)
*
legendre
[
l2
].
compose
(
py
));
(
*
revBasis
)[
i
]
=
(
*
basis
)[
i
];
i
++
;
i
++
;
}
}
}
}
// Free Temporary Sapce //
// Free Temporary Sapce //
delete
[]
legendre
;
delete
[]
legendre
;
delete
[]
lifting
;
}
}
QuadNodeBasis
::~
QuadNodeBasis
(
void
){
QuadNodeBasis
::~
QuadNodeBasis
(
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.
FunctionSpace/TriNodeBasis.cpp
+
3
−
0
View file @
13a36430
...
@@ -76,6 +76,7 @@ TriNodeBasis::TriNodeBasis(const int order){
...
@@ -76,6 +76,7 @@ TriNodeBasis::TriNodeBasis(const int order){
}
}
}
}
// Cell Based //
// Cell Based //
Polynomial
p
=
*
(
*
basis
)[
2
]
*
2
-
Polynomial
(
1
,
0
,
0
,
0
);
Polynomial
p
=
*
(
*
basis
)[
2
]
*
2
-
Polynomial
(
1
,
0
,
0
,
0
);
const
int
orderMinusTwo
=
order
-
2
;
const
int
orderMinusTwo
=
order
-
2
;
...
@@ -87,10 +88,12 @@ TriNodeBasis::TriNodeBasis(const int order){
...
@@ -87,10 +88,12 @@ TriNodeBasis::TriNodeBasis(const int order){
legendre
[
l2
].
compose
(
p
)
*
*
(
*
basis
)[
2
]);
legendre
[
l2
].
compose
(
p
)
*
*
(
*
basis
)[
2
]);
(
*
revBasis
)[
i
]
=
(
*
basis
)[
i
];
(
*
revBasis
)[
i
]
=
(
*
basis
)[
i
];
i
++
;
i
++
;
}
}
}
}
// Free Temporary Sapce //
// Free Temporary Sapce //
delete
[]
legendre
;
delete
[]
legendre
;
delete
[]
intLegendre
;
delete
[]
intLegendre
;
...
...
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