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
Snippets
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
Özgür Ozan Sen
ogs
Commits
9e723485
Commit
9e723485
authored
8 years ago
by
Christoph Lehmann
Browse files
Options
Downloads
Patches
Plain Diff
[PL] moved some code to separate class
parent
24cdce4b
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
ProcessLib/Process.h
+31
-50
31 additions, 50 deletions
ProcessLib/Process.h
with
31 additions
and
50 deletions
ProcessLib/Process.h
+
31
−
50
View file @
9e723485
...
@@ -16,8 +16,18 @@
...
@@ -16,8 +16,18 @@
#include
"NumLib/ODESolver/TimeDiscretization.h"
#include
"NumLib/ODESolver/TimeDiscretization.h"
#include
"NumLib/ODESolver/NonlinearSolver.h"
#include
"NumLib/ODESolver/NonlinearSolver.h"
#include
"DirichletBc.h"
#include
"NeumannBc.h"
#include
"NeumannBcAssembler.h"
#include
"Parameter.h"
#include
"Parameter.h"
#include
"ProcessOutput.h"
#include
"ProcessVariable.h"
#include
"ProcessVariable.h"
#include
"UniformDirichletBoundaryCondition.h"
namespace
MeshLib
{
class
Mesh
;
}
namespace
ProcessLib
namespace
ProcessLib
{
{
...
@@ -37,15 +47,20 @@ public:
...
@@ -37,15 +47,20 @@ public:
using
NonlinearSolver
=
NumLib
::
NonlinearSolverBase
<
GlobalMatrix
,
GlobalVector
>
;
using
NonlinearSolver
=
NumLib
::
NonlinearSolverBase
<
GlobalMatrix
,
GlobalVector
>
;
using
TimeDiscretization
=
NumLib
::
TimeDiscretization
<
GlobalVector
>
;
using
TimeDiscretization
=
NumLib
::
TimeDiscretization
<
GlobalVector
>
;
Process
(
MeshLib
::
Mesh
&
mesh
,
Process
(
NonlinearSolver
&
nonlinear_solver
,
MeshLib
::
Mesh
&
mesh
,
std
::
unique_ptr
<
TimeDiscretization
>&&
time_discretization
,
NonlinearSolver
&
nonlinear_solver
,
std
::
vector
<
std
::
reference_wrapper
<
ProcessVariable
>>&&
std
::
unique_ptr
<
TimeDiscretization
>&&
time_discretization
,
process_variables
)
std
::
vector
<
std
::
reference_wrapper
<
ProcessVariable
>>&&
process_variables
,
SecondaryVariableCollection
<
GlobalVector
>&&
secondary_variables
,
ProcessOutput
<
GlobalVector
>&&
process_output
)
:
_mesh
(
mesh
)
:
_mesh
(
mesh
)
,
_nonlinear_solver
(
nonlinear_solver
)
,
_nonlinear_solver
(
nonlinear_solver
)
,
_time_discretization
(
std
::
move
(
time_discretization
))
,
_time_discretization
(
std
::
move
(
time_discretization
))
,
_process_variables
(
std
::
move
(
process_variables
))
,
_process_variables
(
std
::
move
(
process_variables
))
,
_process_output
(
std
::
move
(
process_output
))
,
_secondary_variables
(
std
::
move
(
secondary_variables
))
{}
{}
/// Preprocessing before starting assembly for new timestep.
/// Preprocessing before starting assembly for new timestep.
...
@@ -61,48 +76,8 @@ public:
...
@@ -61,48 +76,8 @@ public:
const
unsigned
/*timestep*/
,
const
unsigned
/*timestep*/
,
GlobalVector
const
&
x
)
const
GlobalVector
const
&
x
)
const
{
{
DBUG
(
"Process output."
);
doProcessOutput
(
file_name
,
x
,
_mesh
,
*
_local_to_global_index_map
,
_process_variables
,
_secondary_variables
,
_process_output
);
// Copy result
#ifdef USE_PETSC
// TODO It is also possible directly to copy the data for single process
// variable to a mesh property. It needs a vector of global indices and
// some PETSc magic to do so.
std
::
vector
<
double
>
x_copy
(
x
.
getLocalSize
()
+
x
.
getGhostSize
());
#else
std
::
vector
<
double
>
x_copy
(
x
.
size
());
#endif
x
.
copyValues
(
x_copy
);
std
::
size_t
const
n_nodes
=
_mesh
.
getNNodes
();
for
(
ProcessVariable
&
pv
:
_process_variables
)
{
auto
&
output_data
=
pv
.
getOrCreateMeshProperty
();
int
const
n_components
=
pv
.
getNumberOfComponents
();
for
(
std
::
size_t
node_id
=
0
;
node_id
<
n_nodes
;
++
node_id
)
{
MeshLib
::
Location
const
l
(
_mesh
.
getID
(),
MeshLib
::
MeshItemType
::
Node
,
node_id
);
// TODO extend component ids to multiple process variables.
for
(
int
component_id
=
0
;
component_id
<
n_components
;
++
component_id
)
{
auto
const
index
=
_local_to_global_index_map
->
getLocalIndex
(
l
,
component_id
,
x
.
getRangeBegin
(),
x
.
getRangeEnd
());
output_data
[
node_id
*
n_components
+
component_id
]
=
x_copy
[
index
];
}
}
}
// Write output file
DBUG
(
"Writing output to
\'
%s
\'
."
,
file_name
.
c_str
());
MeshLib
::
IO
::
VtuInterface
vtu_interface
(
&
_mesh
,
vtkXMLWriter
::
Binary
,
true
);
vtu_interface
.
writeToFile
(
file_name
);
}
}
void
initialize
()
void
initialize
()
...
@@ -117,7 +92,8 @@ public:
...
@@ -117,7 +92,8 @@ public:
computeSparsityPattern
();
computeSparsityPattern
();
#endif
#endif
createAssemblers
(
*
_local_to_global_index_map
,
_mesh
,
_integration_order
);
initializeConcreteProcess
(
*
_local_to_global_index_map
,
_mesh
,
_integration_order
);
DBUG
(
"Initialize boundary conditions."
);
DBUG
(
"Initialize boundary conditions."
);
for
(
ProcessVariable
&
pv
:
_process_variables
)
for
(
ProcessVariable
&
pv
:
_process_variables
)
...
@@ -203,7 +179,7 @@ public:
...
@@ -203,7 +179,7 @@ public:
private
:
private
:
/// Process specific initialization called by initialize().
/// Process specific initialization called by initialize().
virtual
void
cre
a
te
Assembler
s
(
virtual
void
initializeCon
crete
Proces
s
(
AssemblerLib
::
LocalToGlobalIndexMap
const
&
dof_table
,
AssemblerLib
::
LocalToGlobalIndexMap
const
&
dof_table
,
MeshLib
::
Mesh
const
&
mesh
,
MeshLib
::
Mesh
const
&
mesh
,
unsigned
const
integration_order
)
=
0
;
unsigned
const
integration_order
)
=
0
;
...
@@ -326,7 +302,6 @@ private:
...
@@ -326,7 +302,6 @@ private:
unsigned
const
_integration_order
=
2
;
unsigned
const
_integration_order
=
2
;
MeshLib
::
Mesh
&
_mesh
;
MeshLib
::
Mesh
&
_mesh
;
std
::
unique_ptr
<
MeshLib
::
MeshSubset
const
>
_mesh_subset_all_nodes
;
std
::
unique_ptr
<
AssemblerLib
::
LocalToGlobalIndexMap
>
std
::
unique_ptr
<
AssemblerLib
::
LocalToGlobalIndexMap
>
_local_to_global_index_map
;
_local_to_global_index_map
;
...
@@ -341,6 +316,12 @@ private:
...
@@ -341,6 +316,12 @@ private:
/// Variables used by this process.
/// Variables used by this process.
std
::
vector
<
std
::
reference_wrapper
<
ProcessVariable
>>
_process_variables
;
std
::
vector
<
std
::
reference_wrapper
<
ProcessVariable
>>
_process_variables
;
ProcessOutput
<
GlobalVector
>
_process_output
;
protected
:
std
::
unique_ptr
<
MeshLib
::
MeshSubset
const
>
_mesh_subset_all_nodes
;
SecondaryVariableCollection
<
GlobalVector
>
_secondary_variables
;
};
};
/// Find process variables in \c variables whose names match the settings under
/// Find process variables in \c variables whose names match the settings under
...
...
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