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
ae9d7b0c
Commit
ae9d7b0c
authored
11 years ago
by
Amaury Johnen
Browse files
Options
Downloads
Patches
Plain Diff
remove useless things in GradientBasisx
parent
c07a9503
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Numeric/JacobianBasis.cpp
+5
-6
5 additions, 6 deletions
Numeric/JacobianBasis.cpp
Numeric/JacobianBasis.h
+0
-13
0 additions, 13 deletions
Numeric/JacobianBasis.h
Numeric/MetricBasis.cpp
+67
-2
67 additions, 2 deletions
Numeric/MetricBasis.cpp
Numeric/MetricBasis.h
+2
-1
2 additions, 1 deletion
Numeric/MetricBasis.h
with
74 additions
and
22 deletions
Numeric/JacobianBasis.cpp
+
5
−
6
View file @
ae9d7b0c
...
@@ -25,7 +25,6 @@ namespace {
...
@@ -25,7 +25,6 @@ namespace {
GradientBasis
::
GradientBasis
(
int
tag
,
int
order
)
GradientBasis
::
GradientBasis
(
int
tag
,
int
order
)
{
{
_bezier
=
BasisFactory
::
getBezierBasis
(
ElementType
::
ParentTypeFromTag
(
tag
),
order
);
const
int
type
=
ElementType
::
ParentTypeFromTag
(
tag
);
const
int
type
=
ElementType
::
ParentTypeFromTag
(
tag
);
fullMatrix
<
double
>
samplingPoints
;
fullMatrix
<
double
>
samplingPoints
;
...
@@ -57,7 +56,7 @@ GradientBasis::GradientBasis(int tag, int order)
...
@@ -57,7 +56,7 @@ GradientBasis::GradientBasis(int tag, int order)
//samplingPoints = JacobianBasis::generateJacPointsPyramid(order);
//samplingPoints = JacobianBasis::generateJacPointsPyramid(order);
break
;
break
;
default
:
default
:
Msg
::
Error
(
"Unknown Jacobian function space for element t
ype
%d"
,
t
ype
);
Msg
::
Error
(
"Unknown Jacobian function space for element t
ag
%d"
,
t
ag
);
return
;
return
;
}
}
const
int
numSampPnts
=
samplingPoints
.
size1
();
const
int
numSampPnts
=
samplingPoints
.
size1
();
...
@@ -125,7 +124,7 @@ JacobianBasis::JacobianBasis(int tag)
...
@@ -125,7 +124,7 @@ JacobianBasis::JacobianBasis(int tag)
lagPoints
=
generateJacPointsPyramid
(
jacobianOrder
);
lagPoints
=
generateJacPointsPyramid
(
jacobianOrder
);
break
;
break
;
default
:
default
:
Msg
::
Error
(
"Unknown Jacobian function space for element t
ype
%d"
,
parentType
);
Msg
::
Error
(
"Unknown Jacobian function space for element t
ag
%d"
,
tag
);
return
;
return
;
}
}
numJacNodes
=
lagPoints
.
size1
();
numJacNodes
=
lagPoints
.
size1
();
...
@@ -134,7 +133,7 @@ JacobianBasis::JacobianBasis(int tag)
...
@@ -134,7 +133,7 @@ JacobianBasis::JacobianBasis(int tag)
bezier
=
BasisFactory
::
getBezierBasis
(
parentType
,
jacobianOrder
);
bezier
=
BasisFactory
::
getBezierBasis
(
parentType
,
jacobianOrder
);
// Store shape function gradients of mapping at Jacobian nodes
// Store shape function gradients of mapping at Jacobian nodes
_gradBasis
=
new
GradientBasis
(
tag
,
jacobianOrder
);
_gradBasis
=
BasisFactory
::
get
GradientBasis
(
tag
,
jacobianOrder
);
// Compute matrix for lifting from primary Jacobian basis to Jacobian basis
// Compute matrix for lifting from primary Jacobian basis to Jacobian basis
int
primJacType
=
ElementType
::
getTag
(
parentType
,
primJacobianOrder
,
false
);
int
primJacType
=
ElementType
::
getTag
(
parentType
,
primJacobianOrder
,
false
);
...
@@ -626,8 +625,8 @@ void JacobianBasis::getMetricMinAndGradients(const fullMatrix<double> &nodesXYZ,
...
@@ -626,8 +625,8 @@ void JacobianBasis::getMetricMinAndGradients(const fullMatrix<double> &nodesXYZ,
for
(
int
l
=
0
;
l
<
numJacNodes
;
l
++
)
{
for
(
int
l
=
0
;
l
<
numJacNodes
;
l
++
)
{
double
jac
[
2
][
2
]
=
{{
0.
,
0.
},
{
0.
,
0.
}};
double
jac
[
2
][
2
]
=
{{
0.
,
0.
},
{
0.
,
0.
}};
for
(
int
i
=
0
;
i
<
numMapNodes
;
i
++
)
{
for
(
int
i
=
0
;
i
<
numMapNodes
;
i
++
)
{
const
double
&
dPhidX
=
_gradBasis
->
get
gradShapeMatX
(
l
,
i
);
const
double
&
dPhidX
=
_gradBasis
->
gradShapeMatX
(
l
,
i
);
const
double
&
dPhidY
=
_gradBasis
->
get
gradShapeMatY
(
l
,
i
);
const
double
&
dPhidY
=
_gradBasis
->
gradShapeMatY
(
l
,
i
);
const
double
dpsidx
=
dPhidX
*
invJaci
[
0
][
0
]
+
dPhidY
*
invJaci
[
1
][
0
];
const
double
dpsidx
=
dPhidX
*
invJaci
[
0
][
0
]
+
dPhidY
*
invJaci
[
1
][
0
];
const
double
dpsidy
=
dPhidX
*
invJaci
[
0
][
1
]
+
dPhidY
*
invJaci
[
1
][
1
];
const
double
dpsidy
=
dPhidX
*
invJaci
[
0
][
1
]
+
dPhidY
*
invJaci
[
1
][
1
];
jac
[
0
][
0
]
+=
nodesXYZ
(
i
,
0
)
*
dpsidx
;
jac
[
0
][
0
]
+=
nodesXYZ
(
i
,
0
)
*
dpsidx
;
...
...
This diff is collapsed.
Click to expand it.
Numeric/JacobianBasis.h
+
0
−
13
View file @
ae9d7b0c
...
@@ -16,30 +16,17 @@ class GradientBasis {
...
@@ -16,30 +16,17 @@ class GradientBasis {
public:
public:
fullMatrix
<
double
>
gradShapeMatX
,
gradShapeMatY
,
gradShapeMatZ
;
fullMatrix
<
double
>
gradShapeMatX
,
gradShapeMatY
,
gradShapeMatZ
;
private:
const
bezierBasis
*
_bezier
;
public
:
public
:
GradientBasis
(
int
tag
,
int
order
);
GradientBasis
(
int
tag
,
int
order
);
int
getNumSamplingPoints
()
const
{
return
gradShapeMatX
.
size1
();}
int
getNumSamplingPoints
()
const
{
return
gradShapeMatX
.
size1
();}
int
getNumMapNodes
()
const
{
return
gradShapeMatX
.
size2
();}
int
getNumMapNodes
()
const
{
return
gradShapeMatX
.
size2
();}
const
bezierBasis
*
getBezierBasis
()
const
{
return
_bezier
;}
void
getGradientsFromNodes
(
const
fullMatrix
<
double
>
&
nodes
,
void
getGradientsFromNodes
(
const
fullMatrix
<
double
>
&
nodes
,
fullMatrix
<
double
>
*
dxyzdX
,
fullMatrix
<
double
>
*
dxyzdX
,
fullMatrix
<
double
>
*
dxyzdY
,
fullMatrix
<
double
>
*
dxyzdY
,
fullMatrix
<
double
>
*
dxyzdZ
)
const
;
fullMatrix
<
double
>
*
dxyzdZ
)
const
;
inline
double
getgradShapeMatX
(
int
i
,
int
j
)
const
{
return
gradShapeMatX
(
i
,
j
);}
inline
double
getgradShapeMatY
(
int
i
,
int
j
)
const
{
return
gradShapeMatY
(
i
,
j
);}
inline
double
getgradShapeMatZ
(
int
i
,
int
j
)
const
{
return
gradShapeMatZ
(
i
,
j
);}
inline
void
lag2Bez
(
const
fullVector
<
double
>
&
jac
,
fullVector
<
double
>
&
bez
)
const
{
_bezier
->
matrixLag2Bez
.
mult
(
jac
,
bez
);
}
inline
void
lag2Bez
(
const
fullMatrix
<
double
>
&
jac
,
fullMatrix
<
double
>
&
bez
)
const
{
_bezier
->
matrixLag2Bez
.
mult
(
jac
,
bez
);
}
};
};
...
...
This diff is collapsed.
Click to expand it.
Numeric/MetricBasis.cpp
+
67
−
2
View file @
ae9d7b0c
...
@@ -12,9 +12,11 @@
...
@@ -12,9 +12,11 @@
MetricCoefficient
::
MetricCoefficient
(
MElement
*
el
)
:
_element
(
el
)
MetricCoefficient
::
MetricCoefficient
(
MElement
*
el
)
:
_element
(
el
)
{
{
const
int
tag
=
el
->
getTypeForMSH
();
const
int
tag
=
el
->
getTypeForMSH
();
const
int
type
=
ElementType
::
ParentTypeFromTag
(
tag
);
const
int
metricOrder
=
MetricCoefficient
::
metricOrder
(
tag
);
const
int
metricOrder
=
MetricCoefficient
::
metricOrder
(
tag
);
_jacobian
=
BasisFactory
::
getJacobianBasis
(
tag
);
_jacobian
=
BasisFactory
::
getJacobianBasis
(
tag
);
_gradients
=
BasisFactory
::
getGradientBasis
(
tag
,
metricOrder
);
_gradients
=
BasisFactory
::
getGradientBasis
(
tag
,
metricOrder
);
_bezier
=
BasisFactory
::
getBezierBasis
(
type
,
metricOrder
);
int
nSampPnts
=
_gradients
->
getNumSamplingPoints
();
int
nSampPnts
=
_gradients
->
getNumSamplingPoints
();
int
nMapping
=
_gradients
->
getNumMapNodes
();
int
nMapping
=
_gradients
->
getNumMapNodes
();
...
@@ -143,7 +145,7 @@ void MetricCoefficient::interpolate(const double *uvw, double *minmaxQ)
...
@@ -143,7 +145,7 @@ void MetricCoefficient::interpolate(const double *uvw, double *minmaxQ)
return
;
return
;
}
}
int
order
=
_
gradients
->
getBezierBasis
()
->
getOrder
();
int
order
=
_
bezier
->
getOrder
();
int
dimSimplex
;
int
dimSimplex
;
fullMatrix
<
double
>
exponents
;
fullMatrix
<
double
>
exponents
;
...
@@ -277,6 +279,69 @@ void MetricCoefficient::interpolate(const double *uvw, double *minmaxQ)
...
@@ -277,6 +279,69 @@ void MetricCoefficient::interpolate(const double *uvw, double *minmaxQ)
}
}
}
}
double
MetricCoefficient
::
getBoundRmin
(
double
tol
)
{
fullMatrix
<
double
>
nodes
(
_element
->
getNumShapeFunctions
(),
3
);
fullVector
<
double
>
jac
(
_jacobian
->
getNumJacNodes
());
_element
->
getNodesCoord
(
nodes
);
_jacobian
->
getSignedJacobian
(
nodes
,
jac
);
if
(
jac
.
size
()
!=
_coefficientsBez
.
size1
())
Msg
::
Fatal
(
"not same size, jac %d, coeff %d"
,
jac
.
size
(),
_coefficientsBez
.
size1
());
// compute RminLag
double
RminLag
=
1.
;
const
double
factor1
=
std
::
sqrt
(
6
)
/
3
;
const
double
factor2
=
std
::
sqrt
(
6
)
*
3
;
for
(
int
i
=
0
;
i
<
_bezier
->
getNumLagCoeff
();
++
i
)
{
double
q
=
_coefficientsBez
(
i
,
0
);
double
tmp
=
pow_int
(
_coefficientsBez
(
i
,
1
),
2
);
tmp
+=
pow_int
(
_coefficientsBez
(
i
,
2
),
2
);
tmp
+=
pow_int
(
_coefficientsBez
(
i
,
3
),
2
);
tmp
+=
2
*
pow_int
(
_coefficientsBez
(
i
,
4
),
2
);
tmp
+=
2
*
pow_int
(
_coefficientsBez
(
i
,
5
),
2
);
tmp
+=
2
*
pow_int
(
_coefficientsBez
(
i
,
6
),
2
);
tmp
=
tmp
*
factor1
;
if
(
tmp
<
1e-3
*
q
)
{
tmp
=
(
q
-
tmp
)
/
(
q
+
tmp
);
RminLag
=
std
::
min
(
RminLag
,
tmp
);
}
else
{
double
phi
=
jac
(
i
)
*
jac
(
i
);
phi
-=
q
*
q
*
q
;
phi
+=
.5
*
q
*
tmp
*
tmp
;
phi
/=
tmp
*
tmp
*
tmp
;
phi
*=
factor2
;
if
(
phi
>
1.1
||
phi
<
-
1.1
)
Msg
::
Warning
(
"phi %g"
,
phi
);
if
(
phi
>
1
)
phi
=
1
;
if
(
phi
<
-
1
)
phi
=
-
1
;
phi
=
std
::
acos
(
phi
)
/
3
;
tmp
=
(
q
+
tmp
*
std
::
cos
(
phi
+
2
*
M_PI
/
3
))
/
(
q
+
tmp
*
std
::
cos
(
phi
));
RminLag
=
std
::
min
(
RminLag
,
tmp
);
}
}
// compute RminBez
/*double RminBez = 1.;
double minq = minq();
double minp = minp();
double maxq = maxq();
double maxp = maxp();
if (minq < 1e-3 * maxp) {
double tmp = (minq - maxp) / (minq + maxp);
RminLag = std::min(RminBez, tmp);
}
else {
}*/
/*compute RminBez
if RminLag-RminBez < tol : return RminBez
return subdivide*/
}
int
MetricCoefficient
::
metricOrder
(
int
tag
)
int
MetricCoefficient
::
metricOrder
(
int
tag
)
{
{
...
@@ -355,5 +420,5 @@ void MetricCoefficient::_computeBezCoeff()
...
@@ -355,5 +420,5 @@ void MetricCoefficient::_computeBezCoeff()
{
{
_coefficientsBez
.
resize
(
_coefficientsLag
.
size1
(),
_coefficientsBez
.
resize
(
_coefficientsLag
.
size1
(),
_coefficientsLag
.
size2
());
_coefficientsLag
.
size2
());
_
gradients
->
l
ag2Bez
(
_coefficientsLag
,
_coefficientsBez
);
_
bezier
->
matrixL
ag2Bez
.
mult
(
_coefficientsLag
,
_coefficientsBez
);
}
}
This diff is collapsed.
Click to expand it.
Numeric/MetricBasis.h
+
2
−
1
View file @
ae9d7b0c
...
@@ -15,6 +15,7 @@ class MetricCoefficient {
...
@@ -15,6 +15,7 @@ class MetricCoefficient {
MElement
*
_element
;
MElement
*
_element
;
const
JacobianBasis
*
_jacobian
;
const
JacobianBasis
*
_jacobian
;
const
GradientBasis
*
_gradients
;
const
GradientBasis
*
_gradients
;
const
bezierBasis
*
_bezier
;
fullMatrix
<
double
>
_coefficientsLag
,
_coefficientsBez
;
fullMatrix
<
double
>
_coefficientsLag
,
_coefficientsBez
;
public:
public:
...
@@ -22,7 +23,7 @@ class MetricCoefficient {
...
@@ -22,7 +23,7 @@ class MetricCoefficient {
void
getCoefficients
(
fullMatrix
<
double
>&
,
bool
bezier
=
true
);
void
getCoefficients
(
fullMatrix
<
double
>&
,
bool
bezier
=
true
);
void
interpolate
(
const
double
*
uvw
,
double
*
minmaxQ
);
void
interpolate
(
const
double
*
uvw
,
double
*
minmaxQ
);
void
getBoundRmin
(
double
tol
);
double
getBoundRmin
(
double
tol
);
static
int
metricOrder
(
int
tag
);
static
int
metricOrder
(
int
tag
);
...
...
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