Skip to content

Remove partially initializing volumeField constructor. #220

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

greole
Copy link
Contributor

@greole greole commented Dec 27, 2024

Motivation

This PR removes a constructor from VolumeField with a given internalField. The constructor would copy only the given internalField but doesn't specifically set the boundaryFields. This seems like a partially initialized state which is rather unintuitive.

Additional changes:

  • added further docstrings

Copy link

Deployed test documentation to https://exasim-project.com/NeoFOAM/Build_PR_220

@greole greole changed the title Remove half initializing constructor. Remove partially initializing volumeField constructor. Dec 27, 2024
@@ -119,20 +93,13 @@ class VolumeField : public GeometricFieldMixin<ValueType>
const Executor& exec,
std::string fieldName,
const UnstructuredMesh& mesh,
const Field<ValueType>& internalField,
const std::vector<VolumeBoundary<ValueType>>& boundaryConditions,
Database& db,
std::string dbKey,
std::string collectionName
Copy link
Collaborator

Choose a reason for hiding this comment

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

        Database& db,
        std::string dbKey,
        std::string collectionName

defining them as default parameter makes the usage and registration a lot simpler

        Database& db = std::nullopt,
        std::string dbKey = "",
        std::string collectionName = ""

and should reduce the total amount of constructors

Copy link
Contributor Author

@greole greole Dec 28, 2024

Choose a reason for hiding this comment

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

i thought about wrapping this in a struct

struct DataBaseInfo {
        Database& db;
        std::string dbKey;
        std::string collectionName;
}

and change the ctr of VolumeField to take a std::optional<DataBaseInfo> because you either have non or all three parameters.

Copy link
Collaborator

Choose a reason for hiding this comment

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

done

@@ -119,20 +93,13 @@ class VolumeField : public GeometricFieldMixin<ValueType>
const Executor& exec,
std::string fieldName,
const UnstructuredMesh& mesh,
const Field<ValueType>& internalField,
Copy link
Collaborator

Choose a reason for hiding this comment

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

constructuors with boundaryConditions (that are only partially initialized) should call correct boundary conditions to set the boundaryValues of the domainField

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So how should we proceed here? leave the internalField in and call correctBoundary()?

@greole greole self-assigned this Mar 5, 2025
@greole greole moved this to later in 2nd Hackathon Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: later
Development

Successfully merging this pull request may close these issues.

2 participants