Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mojtaba Abdolkhani
ogs
Commits
e453909d
Commit
e453909d
authored
8 years ago
by
Christoph Lehmann
Browse files
Options
Downloads
Patches
Plain Diff
[NL] renamed local variables
parent
2ae83c41
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
NumLib/Extrapolation/LocalLinearLeastSquaresExtrapolator.cpp
+21
-21
21 additions, 21 deletions
NumLib/Extrapolation/LocalLinearLeastSquaresExtrapolator.cpp
with
21 additions
and
21 deletions
NumLib/Extrapolation/LocalLinearLeastSquaresExtrapolator.cpp
+
21
−
21
View file @
e453909d
...
...
@@ -88,25 +88,24 @@ void LocalLinearLeastSquaresExtrapolator::extrapolateElement(
extrapolatables
.
getIntegrationPointValues
(
element_index
,
_integration_point_values_cache
);
// number of nodes in the element
const
auto
nn
=
extrapolatables
.
getShapeMatrix
(
element_index
,
0
).
cols
();
// number of integration points in the element
const
auto
ni
=
integration_point_values
.
size
();
const
unsigned
num_nodes
=
extrapolatables
.
getShapeMatrix
(
element_index
,
0
).
cols
();
const
unsigned
num_int_pts
=
integration_point_values
.
size
();
assert
(
n
i
>=
static_cast
<
decltype
(
ni
)
>
(
nn
)
&&
assert
(
n
um_int_pts
>=
num_nodes
&&
"Least squares is not possible if there are more nodes than"
"integration points."
);
auto
&
N
=
_local_matrix_cache
;
// TODO make that local?
N
.
resize
(
n
i
,
nn
);
// TODO: might reallocate very often
N
.
resize
(
n
um_int_pts
,
num_nodes
);
// TODO: might reallocate very often
for
(
auto
int_pt
=
decltype
(
ni
){
0
}
;
int_pt
<
n
i
;
++
int_pt
)
{
for
(
unsigned
int_pt
=
0
;
int_pt
<
n
um_int_pts
;
++
int_pt
)
{
auto
const
&
shp_mat
=
extrapolatables
.
getShapeMatrix
(
element_index
,
int_pt
);
assert
(
shp_mat
.
cols
()
==
n
n
);
assert
(
shp_mat
.
cols
()
==
n
um_nodes
);
// copy shape matrix to extrapolation matrix
column
wise
N
.
block
(
int_pt
,
0
,
1
,
nn
)
=
shp_mat
;
// copy shape matrix to extrapolation matrix
row-
wise
N
.
row
(
int_pt
)
=
shp_mat
;
}
// TODO make gp_vals an Eigen::VectorXd const& ?
...
...
@@ -140,34 +139,35 @@ void LocalLinearLeastSquaresExtrapolator::calculateResidualElement(
std
::
size_t
const
element_index
,
ExtrapolatableElementCollection
const
&
extrapolatables
)
{
auto
const
&
gp
_vals
=
extrapolatables
.
getIntegrationPointValues
(
auto
const
&
int_pt
_vals
=
extrapolatables
.
getIntegrationPointValues
(
element_index
,
_integration_point_values_cache
);
const
unsigned
ni
=
gp_vals
.
size
();
// number of gauss points
// TODO: for now always zeroth component is used
const
auto
&
global_indices
=
_local_to_global
(
element_index
,
0
).
rows
;
const
unsigned
num_int_pts
=
int_pt_vals
.
size
();
const
unsigned
num_nodes
=
global_indices
.
size
();
// filter nodal values of the current element
std
::
vector
<
double
>
nodal_vals_element
;
nodal_vals_element
.
resize
(
global_indices
.
size
());
for
(
unsigned
i
=
0
;
i
<
global_indices
.
size
();
++
i
)
{
std
::
vector
<
double
>
nodal_vals_element
(
num_nodes
);
for
(
unsigned
i
=
0
;
i
<
num_nodes
;
++
i
)
{
// TODO PETSc negative indices?
nodal_vals_element
[
i
]
=
_nodal_values
[
global_indices
[
i
]];
}
double
residual
=
0.0
;
double
gp
_val_extrapol
=
0.0
;
double
int_pt
_val_extrapol
ated
=
0.0
;
for
(
unsigned
gp
=
0
;
gp
<
ni
;
++
gp
)
{
for
(
unsigned
int_pt
=
0
;
int_pt
<
num_int_pts
;
++
int_pt
)
{
NumLib
::
shapeFunctionInterpolate
(
nodal_vals_element
,
extrapolatables
.
getShapeMatrix
(
element_index
,
gp
),
gp
_val_extrapol
);
auto
const
&
ax_m_b
=
gp
_val_extrapol
-
gp_vals
[
gp
];
extrapolatables
.
getShapeMatrix
(
element_index
,
int_pt
),
int_pt
_val_extrapol
ated
);
auto
const
&
ax_m_b
=
int_pt
_val_extrapol
ated
-
int_pt_vals
[
int_pt
];
residual
+=
ax_m_b
*
ax_m_b
;
}
_residuals
.
set
(
element_index
,
std
::
sqrt
(
residual
/
n
i
));
_residuals
.
set
(
element_index
,
std
::
sqrt
(
residual
/
n
um_int_pts
));
}
}
// namespace NumLib
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