-
Notifications
You must be signed in to change notification settings - Fork 251
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
base: master
Are you sure you want to change the base?
Conversation
class KRATOS_API(KRATOS_CORE) LayeredGaussPointDataAccesor | ||
: public MultiLevelDataValueAccesor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
BlockType* Allocate(const VariableData* pVariable , std::size_t Size) | ||
{ | ||
std::size_t allocation_size = pVariable->Size()/sizeof(BlockType); | ||
return new BlockType[Size*allocation_size]; | ||
} |
There was a problem hiding this comment.
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?
/** | ||
* @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; |
There was a problem hiding this comment.
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 noexcept
ed.
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.