Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs-feliks
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
Feliks Kiszkurno
ogs-feliks
Commits
86f3b6c6
Commit
86f3b6c6
authored
7 months ago
by
Dmitri Naumov
Browse files
Options
Downloads
Patches
Plain Diff
[PL] Extract runAssembly function
parent
53321f24
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
ProcessLib/Assembly/ParallelVectorMatrixAssembler.cpp
+22
-62
22 additions, 62 deletions
ProcessLib/Assembly/ParallelVectorMatrixAssembler.cpp
with
22 additions
and
62 deletions
ProcessLib/Assembly/ParallelVectorMatrixAssembler.cpp
+
22
−
62
View file @
86f3b6c6
...
...
@@ -134,66 +134,18 @@ collectActiveLocalAssemblers(
return
create_ids_asm_pairs
(
active_elements
);
}
void
runAssembly
ForEachLocalAssembler
(
void
runAssembly
(
std
::
vector
<
std
::
tuple
<
std
::
ptrdiff_t
,
std
::
reference_wrapper
<
ProcessLib
::
LocalAssemblerInterface
>>>
const
&
ids_local_assemblers
,
NumLib
::
LocalToGlobalIndexMap
const
&
dof_table
,
double
const
t
,
double
const
dt
,
GlobalVector
const
&
x
,
GlobalVector
const
&
x_prev
,
std
::
vector
<
double
>&
local_b_data
,
std
::
vector
<
double
>&
local_Jac_data
,
ProcessLib
::
AbstractJacobianAssembler
&
jac_asm
,
ThreadException
&
exception
,
ProcessLib
::
Assembly
::
MultiMatrixElementCache
&
cache
,
auto
local_matrix_output
)
ThreadException
&
exception
,
auto
local_matrix_output
,
auto
assemble
)
{
// due to MSVC++ error:
// error C3016: 'element_id': index variable in OpenMP 'for'
// statement must have signed integral type
std
::
ptrdiff_t
n_elements
=
static_cast
<
std
::
ptrdiff_t
>
(
ids_local_assemblers
.
size
());
#pragma omp for nowait
for
(
std
::
ptrdiff_t
i
=
0
;
i
<
n_elements
;
++
i
)
{
if
(
exception
)
{
continue
;
}
auto
[
element_id
,
loc_asm
]
=
ids_local_assemblers
[
i
];
try
{
assembleWithJacobianOneElement
(
element_id
,
loc_asm
,
dof_table
,
t
,
dt
,
x
,
x_prev
,
local_b_data
,
local_Jac_data
,
jac_asm
,
cache
);
}
catch
(...)
{
exception
.
capture
();
continue
;
}
local_matrix_output
(
element_id
);
}
}
void
runStaggeredAssemblyForEachLocalAssembler
(
std
::
vector
<
std
::
tuple
<
std
::
ptrdiff_t
,
std
::
reference_wrapper
<
ProcessLib
::
LocalAssemblerInterface
>>>
const
&
ids_local_assemblers
,
std
::
vector
<
NumLib
::
LocalToGlobalIndexMap
const
*>
const
&
dof_tables
,
double
const
t
,
double
const
dt
,
std
::
vector
<
GlobalVector
*>
const
&
x
,
std
::
vector
<
GlobalVector
*>
const
&
x_prev
,
int
const
process_id
,
std
::
vector
<
double
>&
local_b_data
,
std
::
vector
<
double
>&
local_Jac_data
,
ProcessLib
::
AbstractJacobianAssembler
&
jac_asm
,
ThreadException
&
exception
,
ProcessLib
::
Assembly
::
MultiMatrixElementCache
&
cache
,
auto
local_matrix_output
)
{
// due to MSVC++ error:
// error C3016: 'element_id': index variable in OpenMP 'for'
// statement must have signed integral type
std
::
ptrdiff_t
n_elements
=
static_cast
<
std
::
ptrdiff_t
>
(
ids_local_assemblers
.
size
());
#pragma omp for nowait
for
(
std
::
ptrdiff_t
i
=
0
;
i
<
n_elements
;
++
i
)
{
...
...
@@ -205,9 +157,7 @@ void runStaggeredAssemblyForEachLocalAssembler(
try
{
assembleWithJacobianForStaggeredSchemeOneElement
(
element_id
,
loc_asm
,
dof_tables
,
t
,
dt
,
x
,
x_prev
,
process_id
,
local_b_data
,
local_Jac_data
,
jac_asm
,
cache
);
assemble
(
element_id
,
loc_asm
);
}
catch
(...)
{
...
...
@@ -335,18 +285,28 @@ void ParallelVectorMatrixAssembler::assembleWithJacobian(
auto
const
&
x
=
*
xs
[
0
];
auto
const
&
x_prev
=
*
x_prevs
[
0
];
runAssembly
ForEachLocalAssembler
(
runAssembly
(
collectActiveLocalAssemblers
(
local_assemblers
,
active_elements
),
dof_table
,
t
,
dt
,
x
,
x_prev
,
local_b_data
,
local_Jac_data
,
*
jac_asm
,
exception
,
cache
,
local_matrix_output
);
exception
,
local_matrix_output
,
[
&
](
auto
element_id
,
auto
&
loc_asm
)
{
assembleWithJacobianOneElement
(
element_id
,
loc_asm
,
dof_table
,
t
,
dt
,
x
,
x_prev
,
local_b_data
,
local_Jac_data
,
*
jac_asm
,
cache
);
});
}
else
// Staggered scheme
{
run
StaggeredAssemblyForEachLocalAssembler
(
run
Assembly
(
collectActiveLocalAssemblers
(
local_assemblers
,
active_elements
),
dof_tables
,
t
,
dt
,
xs
,
x_prevs
,
process_id
,
local_b_data
,
local_Jac_data
,
*
jac_asm
,
exception
,
cache
,
local_matrix_output
);
exception
,
local_matrix_output
,
[
&
](
auto
element_id
,
auto
&
loc_asm
)
{
assembleWithJacobianForStaggeredSchemeOneElement
(
element_id
,
loc_asm
,
dof_tables
,
t
,
dt
,
xs
,
x_prevs
,
process_id
,
local_b_data
,
local_Jac_data
,
*
jac_asm
,
cache
);
});
}
}
...
...
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