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
Releases
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
Yuhao Liu
ogs
Commits
598e7390
Commit
598e7390
authored
8 years ago
by
Christoph Lehmann
Browse files
Options
Downloads
Patches
Plain Diff
[NL] removed vec mat asm
parent
c2bf5190
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
NumLib/Assembler/VectorMatrixAssembler.h
+2
-145
2 additions, 145 deletions
NumLib/Assembler/VectorMatrixAssembler.h
with
2 additions
and
145 deletions
NumLib/Assembler/VectorMatrixAssembler.h
+
2
−
145
View file @
598e7390
...
...
@@ -52,150 +52,7 @@ getLocalNodalDOFs(GlobalVector const& x,
return
local_x
;
}
}
// namespace detail
/*! Calls the local assemblers of FEM processes and assembles
* \c GlobalMatrix'es and \c GlobalVector's.
*
* It optionally gets the local d.o.f. from a GlobalVector using
* a LocalToGlobalIndexMap and passes them on to the local assembler.
*
* Each type of equation as flagged by the \c ODETag will have a different
* VectorMatrixAssembler type.
*/
template
<
typename
LocalAssembler
,
NumLib
::
ODESystemTag
ODETag
>
class
VectorMatrixAssembler
;
//! Specialization for first-order implicit quasi-linear systems.
template
<
typename
LocalAssembler
>
class
VectorMatrixAssembler
<
LocalAssembler
,
NumLib
::
ODESystemTag
::
FirstOrderImplicitQuasilinear
>
final
{
public:
VectorMatrixAssembler
(
LocalToGlobalIndexMap
const
&
data_pos
)
:
_data_pos
(
data_pos
)
{}
/// Executes local assembler for the given mesh item and adds the result
/// into the global matrix and vector.
/// The positions in the global matrix/vector are taken from
/// the LocalToGlobalIndexMap provided in the constructor at index \c id.
/// \attention The index \c id is not necessarily the mesh item's id.
void
assemble
(
std
::
size_t
const
id
,
LocalAssembler
&
local_assembler
,
const
double
t
,
GlobalVector
const
&
x
,
GlobalMatrix
&
M
,
GlobalMatrix
&
K
,
GlobalVector
&
b
)
const
{
auto
const
indices
=
detail
::
getIndices
(
id
,
_data_pos
);
auto
const
local_x
=
detail
::
getLocalNodalDOFs
(
x
,
indices
);
auto
const
r_c_indices
=
NumLib
::
LocalToGlobalIndexMap
::
RowColumnIndices
(
indices
,
indices
);
local_assembler
.
assemble
(
t
,
local_x
);
local_assembler
.
addToGlobal
(
r_c_indices
,
M
,
K
,
b
);
}
/// Executes assembleJacobian() of the local assembler for the
/// given mesh item passing the mesh item's nodal d.o.f.
/// \attention The index \c id is not necessarily the mesh item's id.
void
assembleJacobian
(
std
::
size_t
const
id
,
LocalAssembler
&
local_assembler
,
const
double
t
,
GlobalVector
const
&
x
,
GlobalMatrix
&
Jac
)
const
{
auto
const
indices
=
detail
::
getIndices
(
id
,
_data_pos
);
auto
const
local_x
=
detail
::
getLocalNodalDOFs
(
x
,
indices
);
auto
const
r_c_indices
=
NumLib
::
LocalToGlobalIndexMap
::
RowColumnIndices
(
indices
,
indices
);
local_assembler
.
assembleJacobian
(
t
,
local_x
);
local_assembler
.
addJacobianToGlobal
(
r_c_indices
,
Jac
);
}
/// Executes the preTimestep() method of the local assembler for the
/// given mesh item passing the mesh item's nodal d.o.f.
/// \attention The index \c id is not necessarily the mesh item's id.
void
preTimestep
(
std
::
size_t
const
id
,
LocalAssembler
&
local_assembler
,
GlobalVector
const
&
x
,
double
const
t
,
double
const
delta_t
)
const
{
auto
const
indices
=
detail
::
getIndices
(
id
,
_data_pos
);
auto
const
local_x
=
detail
::
getLocalNodalDOFs
(
x
,
indices
);
local_assembler
.
preTimestep
(
local_x
,
t
,
delta_t
);
}
/// Executes the postTimestep() method of the local assembler for the
/// given mesh item passing the mesh item's nodal d.o.f.
/// \attention The index \c id is not necessarily the mesh item's id.
void
postTimestep
(
std
::
size_t
const
id
,
LocalAssembler
&
local_assembler
,
GlobalVector
const
&
x
)
const
{
auto
const
indices
=
detail
::
getIndices
(
id
,
_data_pos
);
auto
const
local_x
=
detail
::
getLocalNodalDOFs
(
x
,
indices
);
local_assembler
.
postTimestep
(
local_x
);
}
/// Executes the given callback function for the given mesh item
/// passing the mesh item's nodal d.o.f.
/// \attention The index \c id is not necessarily the mesh item's id.
template
<
typename
Callback
,
typename
...
Args
>
void
passLocalVector
(
Callback
&
cb
,
std
::
size_t
const
id
,
GlobalVector
const
&
x
,
Args
&&
...
args
)
{
auto
const
indices
=
detail
::
getIndices
(
id
,
_data_pos
);
auto
const
local_x
=
detail
::
getLocalNodalDOFs
(
x
,
indices
);
auto
const
r_c_indices
=
NumLib
::
LocalToGlobalIndexMap
::
RowColumnIndices
(
indices
,
indices
);
cb
(
local_x
,
r_c_indices
,
std
::
forward
<
Args
>
(
args
)...);
}
private
:
LocalToGlobalIndexMap
const
&
_data_pos
;
};
//! Specialization used to add Neumann boundary conditions.
template
<
typename
LocalAssembler
>
class
VectorMatrixAssembler
<
LocalAssembler
,
NumLib
::
ODESystemTag
::
NeumannBC
>
final
{
public:
VectorMatrixAssembler
(
LocalToGlobalIndexMap
const
&
data_pos
)
:
_data_pos
(
data_pos
)
{}
/// Executes local assembler for the given mesh item and adds the result
/// into the global matrix and vector.
/// The positions in the global matrix/vector are taken from
/// the LocalToGlobalIndexMap provided in the constructor at index \c id.
/// \attention The index \c id is not necessarily the mesh item's id.
void
assemble
(
std
::
size_t
const
id
,
LocalAssembler
&
local_assembler
,
const
double
t
,
GlobalVector
&
b
)
const
{
auto
const
indices
=
detail
::
getIndices
(
id
,
_data_pos
);
auto
const
r_c_indices
=
NumLib
::
LocalToGlobalIndexMap
::
RowColumnIndices
(
indices
,
indices
);
local_assembler
.
assemble
(
t
);
local_assembler
.
addToGlobal
(
r_c_indices
,
b
);
}
private
:
LocalToGlobalIndexMap
const
&
_data_pos
;
};
}
// namespace NumLib
}
// namespace detail
}
// namespace NumLib
#endif // NUMLIB_VECTORMATRIXASSEMBLER_H_
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