Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre post timestep for local asm #1094

Merged
merged 6 commits into from
Mar 14, 2016

Conversation

endJunction
Copy link
Member

  • Splitting of postTimestep() and output(). (No changes, just copy&paste).
  • Implementation of preTimestep and postTimestep executors for local asm.

To use in particular process one needs an implementation in FEM part of the process of

void FEM::preTimestep(std::vector<double> const& local_x) override;

and an implementation in the Process calling FEM::preTimestep

void SpecificProcess::preTimestep() override
{
    Base::_global_setup.execute(
        [&](std::size_t const id, LocalAssembler* const local_assembler, GlobalVector const& x) -> void
        {
            Base::_global_assembler->preTimestep(id, local_assembler, x);
        },
        _local_assemblers, x);
}

/// 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 necesserily the mesh item's id.
template <typename LocalAssembler_>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need the trailing underscore? ✅

@chleh
Copy link
Collaborator

chleh commented Mar 14, 2016

Very important comment, though easy to fix. Afterwards ⏩.

@@ -72,14 +72,59 @@ class Process
/// Process specific initialization called by initialize().
virtual void createLocalAssemblers() = 0;

/// Postprocessing after solve().
/// Preprocessing before starting assembly for new timestep.
virtual void preTimestep(GlobalVector const& x) {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will preTimestep(), postTimestep() or output() change the internals of the process object or will they work on external data? If they only work on external data the methods could be const.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They do change the internals. E.g., they could save some secondary variables from the previous timeste.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for explanation. I understand that preTimestep() and postTimestep() should be able change internal things. Will output() change internals, too? ✅

@TomFischer
Copy link
Member

Looks good. 👍

chleh and others added 5 commits March 14, 2016 11:32
 - moved the generalized method out of the class.
 - extracted function for getting indices
Need an implementation in FEM part of the process:
void preTimestep(std::vector<double> const& local_x) override;

and implementation in the Process calling FEM::preTimestep:

void SpecificProcess::preTimestep() override
{
  Base::_global_setup.execute(
    [&](std::size_t const id, LocalAssembler* const local_assembler, GlobalVector const& x) -> void
    {
      Base::_global_assembler->preTimestep(id, local_assembler, x);
    },
  _local_assemblers, x);
}
@chleh
Copy link
Collaborator

chleh commented Mar 14, 2016

👍
I guess, there is no need for further review, and I really need this piece of code.

endJunction added a commit that referenced this pull request Mar 14, 2016
@endJunction endJunction merged commit 0e64cf9 into ufz:master Mar 14, 2016
@endJunction endJunction deleted the PrePostTimestepForLocalAsm branch March 14, 2016 11:46
@ogsbot
Copy link
Member

ogsbot commented Jun 19, 2020

OpenGeoSys development has been moved to GitLab.

See this pull request on GitLab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants