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

Implementation of operator coefficient handler #151

Merged
merged 7 commits into from
Oct 6, 2024

Conversation

greole
Copy link
Contributor

@greole greole commented Sep 30, 2024

This PR implements a class to handle dslTerm coefficients.

Motivation: In an eqnSystem we commonly have things like 2*T*operator::div(U) - operator::laplace(U). To keep the ability to lazily evaluate the system the coefficients, namely 2*T and -1 need to be stored separately. This is the responsibility of the dslCoefficient class.

Usage: Writing eqnSystem( -2*T*operator::div(U)) would lead to eager evaluation of 2*T.
Ideally one would use eqnSystem(coeff(-2,T)*operator::div(U)). Other combinations like eqnSystem(coeff(-2) *T*operator::div(U)) and eqnSystem(coeff()*-2 *T*operator::div(U)) are equivalent. Also eqnSystem(2*(T*operator::div(U))) can force lazy evaluation.

Internal Usage
An operation like Type*operator::div(Field) calls the eqnTerm::operator* implementation this passes Type and creates an instance of Coeff(Type). In the actual evaluation step Coeff::operator[] is called which performs the multiplication of scalar*field[i] if required.

Based on: #136
Part of the stack: #102

@greole greole force-pushed the impl/scalingField branch 2 times, most recently from 2809339 to aa05d2d Compare September 30, 2024 11:27
This was referenced Sep 30, 2024
@greole greole changed the title Impl/scaling field Implementation of Scaling Field Sep 30, 2024
@greole greole changed the title Implementation of Scaling Field Implementation of scalingHandler Sep 30, 2024
@greole greole changed the title Implementation of scalingHandler Implementation of dslTerm coefficient handler Oct 1, 2024
@greole greole added the ready-for-review Set this label to indicate that the PR is ready for review label Oct 2, 2024
@greole greole force-pushed the impl/scalingField branch from ea7c43c to 24f9cf9 Compare October 2, 2024 11:23
@greole greole changed the title Implementation of dslTerm coefficient handler Implementation of operator coefficient handler Oct 4, 2024
@greole greole added the dsl label Oct 4, 2024
};


inline Coeff operator*(const Coeff& lhs, const Coeff& rhs)
Copy link
Collaborator

Choose a reason for hiding this comment

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

The coeff would be used inside the Operator and the cases of multiplying two coeff should Not excist

greole and others added 4 commits October 4, 2024 13:29
Co-authored-by: Henning Scheufler <henning.scheufler@web.de>
- updates docstrings
- fix formating
- fix some compilation issues
@greole greole force-pushed the impl/scalingField branch from 658de08 to 634568a Compare October 4, 2024 11:29
@HenningScheufler
Copy link
Collaborator

@greole
I added an additional test case please review

@greole
Copy link
Contributor Author

greole commented Oct 6, 2024

@greole I added an additional test case please review

lgtm!

@HenningScheufler HenningScheufler merged commit 7377af8 into stack/dsl Oct 6, 2024
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dsl ready-for-review Set this label to indicate that the PR is ready for review Skip-Changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants