-
Notifications
You must be signed in to change notification settings - Fork 9
592 improvement hdf5 dataset as regex #597
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
jmorice91
wants to merge
15
commits into
pdidev:main
Choose a base branch
from
jmorice91:592-improvement-hdf5-dataset-as-regex
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
e1e3dbb
fix#592, comment about dataset as regex
jmorice91 e1747c3
Fix #592, reduce the interior loop
jmorice91 06320c8
fix copyright
jmorice91 f469370
add fmt/range
jmorice91 7bd7897
fix indent
jmorice91 dbb4052
sort name of dataset in case of multiple regex found
jmorice91 68a2be6
fix indent
jmorice91 debdb1f
Fix #592, dsets as vector, introduce struct for explicit dataset
jmorice91 e97c0f1
change Dataset_explicit_type to class
jmorice91 314bc0e
Apply suggestion from @jbigot
jbigot a888c48
Update plugins/decl_hdf5/dataset_explicit_type.h
jbigot 1af70ff
Update plugins/decl_hdf5/dataset_explicit_type.h
jbigot 358ee6b
Update plugins/decl_hdf5/dataset_explicit_type.h
jbigot 15c5e1e
Update plugins/decl_hdf5/dataset_explicit_type.h
jbigot c4df1a2
add std:optional and remove unnecessary comment
jmorice91 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| /******************************************************************************* | ||
| * Copyright (C) 2025 Commissariat a l'energie atomique et aux energies alternatives (CEA) | ||
| * All rights reserved. | ||
| * | ||
| * Redistribution and use in source and binary forms, with or without | ||
| * modification, are permitted provided that the following conditions are met: | ||
| * * Redistributions of source code must retain the above copyright | ||
| * notice, this list of conditions and the following disclaimer. | ||
| * * Redistributions in binary form must reproduce the above copyright | ||
| * notice, this list of conditions and the following disclaimer in the | ||
| * documentation and/or other materials provided with the distribution. | ||
| * * Neither the name of CEA nor the names of its contributors may be used to | ||
| * endorse or promote products derived from this software without specific | ||
| * prior written permission. | ||
| * | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| * THE SOFTWARE. | ||
| ******************************************************************************/ | ||
|
|
||
|
|
||
| #ifndef DECL_HDF5_DATASET_EXPLICIT_TYPE_H_ | ||
| #define DECL_HDF5_DATASET_EXPLICIT_TYPE_H_ | ||
|
|
||
| // #include <hdf5.h> | ||
| // #ifdef H5_HAVE_PARALLEL | ||
| // #include <mpi.h> | ||
| // #endif | ||
jbigot marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| #include <regex> | ||
| #include <string> | ||
|
|
||
| #include <paraconf.h> | ||
|
|
||
| #include <pdi/pdi_fwd.h> | ||
|
|
||
| //#include <pdi/context.h> | ||
| //#include <pdi/expression.h> | ||
jbigot marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| namespace decl_hdf5 { | ||
|
|
||
| /// Information about the types that should be used to create datasets as provided in the Yaml file | ||
| struct Dataset_explicit_type { | ||
jmorice91 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| std::string m_definition; ///< definition from the YAML as a string for debugging purpose | ||
| std::regex m_regex; ///< the parsed regex that determines if the provided type applies (depend only on m_definition and regex grammar) | ||
| int m_begin_line; ///< begin line number in the YAML for debugging purposes | ||
| int m_end_line; ///< end line number in the YAML for debugging purposes | ||
| PDI::Datatype_template_sptr m_type; ///< the type to use for the dataset in case the regex matches | ||
jbigot marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Dataset_explicit_type() = default; | ||
jbigot marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Dataset_explicit_type(std::string def, int b_line, int e_line, std::regex regex, PDI::Datatype_template_sptr type) | ||
jbigot marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| : m_definition(def) | ||
| , m_begin_line(b_line) | ||
| , m_end_line(e_line) | ||
| , m_regex(regex) | ||
| , m_type(type) | ||
| {} | ||
|
|
||
| /// function to get the line where the dataset is defined in Yaml file | ||
| std::string get_msg_err_line() const | ||
| { | ||
| std::string result; | ||
| if (m_begin_line == m_end_line) { | ||
| result = " defined in line " + std::to_string(m_begin_line + 1); | ||
| } else { | ||
| result = " defined in lines " + std::to_string(m_begin_line + 1) + " - " + std::to_string(m_end_line); | ||
| } | ||
| return result; | ||
| } | ||
| }; | ||
|
|
||
| } // namespace decl_hdf5 | ||
|
|
||
| #endif // DECL_HDF5_DATASET_EXPLICIT_TYPE_H_ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.