Skip to content

refactor: split FieldSpecificationBase into two classes#4025

Open
kdrienCG wants to merge 66 commits intodevelopfrom
feature/kdrienCG/refactoFieldSpecificationBase
Open

refactor: split FieldSpecificationBase into two classes#4025
kdrienCG wants to merge 66 commits intodevelopfrom
feature/kdrienCG/refactoFieldSpecificationBase

Conversation

@kdrienCG
Copy link
Copy Markdown

@kdrienCG kdrienCG commented Apr 10, 2026

(Previously #4011)

This PR aims to refactor the FieldSpecificationBase class into two separate class.
FieldSpecification for the data.
FieldSpecificationImpl for the "behavior" (with methods like apply, computeRhsContribution, etc.).

This will separate concerns and make the code easier to understand when encountering field specifications.


The following architecture is proposed:

image

kdrienCG added 30 commits March 25, 2026 15:40
@kdrienCG kdrienCG marked this pull request as draft April 10, 2026 10:26
@kdrienCG kdrienCG removed the ci: run integrated tests Allows to run the integrated tests in GEOS CI label Apr 10, 2026
@kdrienCG kdrienCG marked this pull request as ready for review April 10, 2026 11:29
@kdrienCG kdrienCG added ci: run CUDA builds Allows to triggers (costly) CUDA jobs ci: run integrated tests Allows to run the integrated tests in GEOS CI ci: run code coverage enables running of the code coverage CI jobs labels Apr 10, 2026
Comment on lines 224 to 229
integer const isInitialCondition = fs.initialCondition();
if( ( isInitialCondition && fieldName=="") || // this only use case for this line is in the unit test for field specification
( !isInitialCondition && time >= fs.getStartTime() && time < fs.getEndTime() && fieldName == fs.getFieldName() ) )
{
fs.template apply< OBJECT_TYPE, BCTYPE, LAMBDA >( mesh, std::forward< LAMBDA >( lambda ) );
FieldSpecificationImpl::apply< OBJECT_TYPE, BCTYPE, LAMBDA >( fs, mesh, std::forward< LAMBDA >( lambda ) );
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I understand that you keep the apply() / applyFieldValue() methods in the manager as there is some data-hierarchy matters involved that are manager's responsability, but is it possible to extract this part in FieldSpecificationImpl? I think this is more related with internal FieldSpecification behavior.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also, becareful of long lines (>100 char).

Comment on lines +19 to +20
#include "fieldSpecification/FieldSpecification.hpp"
#include "fieldSpecification/FieldSpecificationImpl.hpp"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
#include "fieldSpecification/FieldSpecification.hpp"
#include "fieldSpecification/FieldSpecificationImpl.hpp"
#include "fieldSpecification/FieldSpecificationImpl.hpp"

Comment on lines +20 to +21
#include "fieldSpecification/FieldSpecificationManager.hpp"
#include "fieldSpecification/FieldSpecificationBase.hpp"
#include "fieldSpecification/FieldSpecification.hpp"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
#include "fieldSpecification/FieldSpecificationManager.hpp"
#include "fieldSpecification/FieldSpecificationBase.hpp"
#include "fieldSpecification/FieldSpecification.hpp"
#include "fieldSpecification/FieldSpecificationManager.hpp"

#define GEOS_PHYSICSSOLVERS_FLUIDFLOW_IMMISCIBLEMULTIPHASEFLOW_HPP_

#include "physicsSolvers/fluidFlow/FlowSolverBase.hpp"
#include "fieldSpecification/FieldSpecificationImpl.hpp"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it really needed to include FieldSpecificationImpl.hpp in here and in SinglePhaseReactiveTransport? Should applyFieldValue() be relocated? (Can it be in a cpp or in FieldSpecificationImpl.hpp)?

@kdrienCG kdrienCG removed ci: run CUDA builds Allows to triggers (costly) CUDA jobs ci: run integrated tests Allows to run the integrated tests in GEOS CI ci: run code coverage enables running of the code coverage CI jobs labels Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flag: no rebaseline Does not require rebaseline type: cleanup / refactor Non-functional change (NFC) type: new A new issue has been created and requires attention

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants