MoReFEM
|
Class that drives the finite element resolution. More...
#include <Model.hpp>
Public Types | |
using | self = Model<DerivedT, MoReFEMDataT, DoConsiderProcessorWiseLocal2GlobalT> |
Alias to the type of the class. | |
using | morefem_data_type = MoReFEMDataT |
Alias to MoReFEMDataT. | |
using | time_manager_type = typename morefem_data_type::time_manager_type |
Alias to the object in charge of time management. | |
Public Member Functions | |
bool | HasFinished () |
Whether the model has finished all its dynamic iterations. | |
void | Initialize () |
Initialize the model. | |
void | InitializeStep () |
Initialize the dynamic step. | |
void | FinalizeStep () |
Finalize the dynamic step. | |
void | Finalize () |
Finalize the model once the time loop is done. | |
void | Run () |
A convenient wrapper over the usual way a Model is used. | |
const time_manager_type & | GetTimeManager () const noexcept |
Access to the object in charge of transient data. | |
const FilesystemNS::Directory & | GetOutputDirectory () const noexcept |
Access to output directory. | |
void | SetDoPrintNewTimeIterationBanner (bool do_print) noexcept |
void | SetClearGodOfDofTemporaryDataToFalse () |
Set do_clear_god_of_dof_temporary_data_after_initialize_ to false. | |
const GodOfDof & | GetGodOfDof (::MoReFEM::MeshNS::unique_id unique_id) const |
const morefem_data_type & | GetMoReFEMData () const noexcept |
Accessor to the underlying MoReFEMData object. | |
const Mesh & | GetMesh (::MoReFEM::MeshNS::unique_id unique_id) const |
Non constant accessor to Mesh which unique identifier is unique_id . | |
bool | DoWriteRestartData () const noexcept |
const Wrappers::Mpi & | GetMpi () const noexcept |
Special members. | |
Model (morefem_data_type &morefem_data, create_domain_list_for_coords a_create_domain_list_for_coords=create_domain_list_for_coords::no, print_banner do_print_banner=print_banner::yes) | |
Constructor. | |
~Model () | |
Destructor. | |
Model (const Model &rhs)=delete | |
The copy constructor. | |
Model (Model &&rhs)=delete | |
The move constructor. - deactivated. | |
Model & | operator= (const Model &rhs)=delete |
The (copy) operator=. | |
Model & | operator= (Model &&rhs)=delete |
The (move) operator=. | |
Protected Member Functions | |
Mesh & | GetNonCstMesh (::MoReFEM::MeshNS::unique_id unique_id) const |
Constant accessor to Mesh which unique identifier is unique_id . | |
std::size_t | GetDisplayValue () const |
Files will be written every GetDisplayValue() time iterations. | |
time_manager_type & | GetNonCstTimeManager () noexcept |
Non constant access to the object in charge of transient data. | |
morefem_data_type & | GetNonCstMoReFEMData () noexcept |
Accessor to the underlying MoReFEMData object. | |
Private Member Functions | |
void | UpdateTime () |
Go the the next iteration step. | |
void | PrintNewTimeIterationBanner () const |
Print a banner with text, the time and the iteration number. | |
create_domain_list_for_coords | GetCreateDomainListForCoords () const noexcept |
Constant accessor to create_domain_list_for_coords_. | |
void | CreateDomainListForCoords () |
Coords will get the information of which domain they are in. | |
bool | DoPrintBanner () const noexcept |
Whether banners should be printed or not. | |
Private Attributes | |
morefem_data_type & | morefem_data_ |
Reference to the MoReFEMData object. | |
std::optional< std::size_t > | display_value_ { std::nullopt } |
Files will be written every display_value_ time iteration. Choose 1 to write all of them. | |
bool | do_clear_god_of_dof_temporary_data_after_initialize_ = true |
Enables to postpone the ClearGodOfDofTemporaryData to be able to create operators after the initialize. | |
bool | do_print_new_time_iteration_banner_ = true |
If false, the banner for each new time iteration won't be printed. | |
print_banner | do_print_banner_ = print_banner::yes |
If false, no banner at all will be printed. False is useful for test framework. | |
bool | was_initialize_already_called_ { false } |
bool | do_write_restart_data_ { false } |
const Wrappers::Mpi & | mpi_ |
Mpi object. | |
Class that drives the finite element resolution.
A main can consist only on the instantiation of a Model and a call to its Run() method.
DerivedT | Model is used as a CRTP class. |
DoConsiderProcessorWiseLocal2GlobalT | Whether the local-2-global for processor-wise data might be required by at least one of the operator. In some models processor-wise is never considered (most linear models); in that case it's irrelevant to use up loads of memory to store them so 'no'should be given. |
TimeManagerPolicyT | The time manager policy to use. Currently three options are open:
|
DerivedT is expected to define the following methods (otherwise the compilation will fail):
In the case TimeManagerNS::Policy::None policy is chosen, only SupplInitialize() and SupplFinalize() are mandatory.
using MoReFEM::Model< DerivedT, MoReFEMDataT, DoConsiderProcessorWiseLocal2GlobalT >::self = Model<DerivedT, MoReFEMDataT, DoConsiderProcessorWiseLocal2GlobalT> |
Alias to the type of the class.
|
explicit |
Constructor.
Model drives most of MoReFEM; so its constructor is responsible for a lot the initialisation steps (for instance VariationalFormulation or dof numbering are fully built there).
[in,out] | morefem_data | The object which encapsulates some stuff that acts as global data, such as:
|
The argument is noted as input and output, but most of the content is actually constant; the only part that may be modified here is the time iteration related stuff.
[in] | a_create_domain_list_for_coords | Whether the model will compute the list of domains a coord is in or not. |
[in] | do_print_banner | If True, print text at the beginning and the end of the program. False has been introduced only for the integration tests. |
|
delete |
The copy constructor.
[in] | rhs | The object from which the construction occurs. |
|
delete |
The move constructor. - deactivated.
[in] | rhs | The object from which the construction occurs. - deactivated. |
|
delete |
The (copy) operator=.
[in] | rhs | The object from which the affectation occurs. |
|
delete |
The (move) operator=.
[in] | rhs | The object from which the affectation occurs. |
bool MoReFEM::Model< DerivedT, MoReFEMDataT, DoConsiderProcessorWiseLocal2GlobalT >::HasFinished | ( | ) |
Whether the model has finished all its dynamic iterations.
[internal]
Part of its implementation is the responsibility of DerivedT: the base class just checks whether maximum time has been hit, but it is possible for some model to add additional criteria through SupplHasFinishedConditions().
void MoReFEM::Model< DerivedT, MoReFEMDataT, DoConsiderProcessorWiseLocal2GlobalT >::Initialize | ( | ) |
Initialize the model.
Base class only creates the GodOfDof and finite element spaces; additional functionalities must be implemented in DerivedT::SupplInitialize() (this method must be defined even in cases its content is null).
void MoReFEM::Model< DerivedT, MoReFEMDataT, DoConsiderProcessorWiseLocal2GlobalT >::InitializeStep | ( | ) |
Initialize the dynamic step.
Base class only print information about time; additional functionalities must be implemented in DerivedT::SupplInitializeStep() (this method must be defined even in cases its content is null).
void MoReFEM::Model< DerivedT, MoReFEMDataT, DoConsiderProcessorWiseLocal2GlobalT >::FinalizeStep | ( | ) |
Finalize the dynamic step.
Base class only asks the TimeManager object to update the time; additional functionalities must be implemented in DerivedT::SupplFinalizeStep() (this method must be defined even in cases its content is null).
void MoReFEM::Model< DerivedT, MoReFEMDataT, DoConsiderProcessorWiseLocal2GlobalT >::Run | ( | ) |
A convenient wrapper over the usual way a Model is used.
A main could be just the instantiation of a Model and subsequently the call to this method.
This method is equivalent to what is usually in a main for Verdandi:
|
noexcept |
Setter on do_print_new_time_iteration_banner_.
[in] | do_print | True if you want to print the banner. |
const GodOfDof & MoReFEM::Model< DerivedT, MoReFEMDataT, DoConsiderProcessorWiseLocal2GlobalT >::GetGodOfDof | ( | ::MoReFEM::MeshNS::unique_id | unique_id | ) | const |
Access a GodOfDof object using its unique id.
[in] | unique_id | Unique identifier of the sought GodOfDof (as returned by GodOfDof::GetUniqueId()). |
|
noexcept |
Accessor to the underlying MoReFEMData object.
const Mesh & MoReFEM::Model< DerivedT, MoReFEMDataT, DoConsiderProcessorWiseLocal2GlobalT >::GetMesh | ( | ::MoReFEM::MeshNS::unique_id | unique_id | ) | const |
Non constant accessor to Mesh which unique identifier is unique_id
.
[in] | unique_id | Unique identifier of the sought Mesh (as returned by Mesh::GetUniqueId()).. |
|
noexcept |
Please notice this field does little more than store what was indicated in the input data file in the InputDataNS::Restart::DoWriteRestartData field; it is in each model that support restarts that you may provide the logic to write or not the data, e.g. with something like (in which MyModel derives from current class):
This is for an Advanced user; you may have a look at Elastic model in the example to see how it is used.
|
protected |
Constant accessor to Mesh which unique identifier is unique_id
.
[in] | unique_id | Unique identifier of the sought Mesh (as returned by Mesh::GetUniqueId()).. |
|
protectednoexcept |
Accessor to the underlying MoReFEMData object.
|
privatenoexcept |
Whether banners should be printed or not.
|
noexceptinherited |
Read-only access to underlying Mpi object.
|
private |
Files will be written every display_value_ time iteration. Choose 1 to write all of them.
May be std::nullopt
for 'models' related to some of the tests.
|
private |
Enables to postpone the ClearGodOfDofTemporaryData to be able to create operators after the initialize.
|
private |
If false, the banner for each new time iteration won't be printed.
Even if true it is second to do_print_banner_.
|
private |
In debug mode, data attribute to check Initialize is not called more than one for a given Model object.
|
private |
Please notice this field does little more than store what was indicated in the input data file in the InputDataNS::Restart::DoWriteRestartData field; it is in each model that support restarts that you may provide the logic to write or not the data, e.g. with something like (in which MyModel derives from current class):