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

[Core] adding multi level data value container #13172

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

Conversation

ddiezrod
Copy link
Contributor

This is an alternative to what we discussed in #12812 to store multiple values that I developed together with @pooyan-dadvand .

The idea here is to store a vector of BlockData, where each position stores values for a certain variable. Then for each of these BlockDatas we assign a size (number of values for that variable) and an accessor that will tell us how to access the different values inside the BlockData.

@ddiezrod ddiezrod requested a review from a team as a code owner February 26, 2025 16:48
@ddiezrod ddiezrod changed the title adding multi level data value container [Core] adding multi level data value container Feb 26, 2025
Comment on lines +19 to +20
class KRATOS_API(KRATOS_CORE) LayeredGaussPointDataAccesor
: public MultiLevelDataValueAccesor
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
class KRATOS_API(KRATOS_CORE) LayeredGaussPointDataAccesor
: public MultiLevelDataValueAccesor
class KRATOS_API(KRATOS_CORE) LayeredGaussPointDataAccessor
: public MultiLevelDataValueAccessor

Better fix it early, or we'll end up like with auxiliar.

namespace Kratos
{

class KRATOS_API(KRATOS_CORE) MultiLevelDataValueAccesor
Copy link
Contributor

Choose a reason for hiding this comment

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

Apart from the typo, I don't feel like Data and Value really add any meaning to the class' name. I've seen this recurring naming pattern in Kratos and it never gets me any closer to understanding the purpose of the class.

How about smth like MultiLevelAccessor or MultiLevelContainerAccessor? Of course other alternatives are also welcome.

Alternatively, it could just be a member class of MultiLevelDataValueContainer (which is suffering from the same naming pattern) and then it could just be renamed Accessor.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, this class is very light on docs.

Copy link
Contributor

Choose a reason for hiding this comment

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

Last one on this class I swear: why isn't the functionality of this class just included in the container?

Comment on lines +371 to +375
BlockType* Allocate(const VariableData* pVariable , std::size_t Size)
{
std::size_t allocation_size = pVariable->Size()/sizeof(BlockType);
return new BlockType[Size*allocation_size];
}
Copy link
Contributor

Choose a reason for hiding this comment

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

yikes. How about an std::unique_ptr?

btw this seems to be used as a static member so why not mark it as such?

Comment on lines +52 to +66
/**
* @brief Get the number of layers.
* This function returns the number of layers stored in the object.
* @return std::size_t The number of layers.
*/
std::size_t GetNumberOfLayers() const;

/**
* @brief Retrieves the number of Gauss points.
* This function returns the total number of Gauss points that are used in the
* current context. Gauss points are typically used in numerical integration
* methods such as the finite element method.
* @return The number of Gauss points.
*/
std::size_t GetNumberOfGaussPoints() const;
Copy link
Contributor

Choose a reason for hiding this comment

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

These could be inlined and noexcepted.

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.

2 participants