Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Modernization/keywords #1183

Merged
merged 22 commits into from
Feb 3, 2025
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
79d2d40
Setting typo-safe types for keyword type and datatype for keywords
Iximiel Dec 18, 2024
02fe684
removed some friend declaration to hide implementation details
Iximiel Jan 20, 2025
65d52f2
made compontne in a struct, rempoved copyData
Iximiel Jan 20, 2025
7725fcf
structured also the keyword informations
Iximiel Jan 20, 2025
c525472
reorganization of some comments
Iximiel Jan 20, 2025
6b3a04a
Documenting better the bitmask enabler
Iximiel Jan 21, 2025
7c1a69d
adjusting the documentation
Iximiel Jan 21, 2025
fe51d70
using algorithms for isActionSuffixed
Iximiel Jan 21, 2025
dc2de18
adding constexpr to BitmaskEnum operations
Iximiel Jan 21, 2025
cb3e31e
added an example in Distance, modernized also Components declaration
Iximiel Jan 21, 2025
2f76d65
restoring the flavour of removeOutputComponent with no existance checks
Iximiel Jan 21, 2025
2705408
found some merge errors
Iximiel Jan 22, 2025
ebef017
Some small adjustments for reserveFlag
Iximiel Jan 22, 2025
46dc248
adding the erase/remove shortcut
Iximiel Jan 22, 2025
65e6864
grammar fix
Iximiel Jan 22, 2025
075f8a3
compacted the argument_type into the key struct
Iximiel Jan 22, 2025
a6a55af
compacted the add and reserve methods to simplify the life of future us
Iximiel Jan 22, 2025
0afe1f4
compacting also the atomtag into keyinfo
Iximiel Jan 22, 2025
1afbafb
updating the documentation
Iximiel Jan 23, 2025
eaebbfd
Now plumed check should not hang anymore
Iximiel Jan 27, 2025
96f5041
checked that the json did not change and that cppcheck passes
Iximiel Jan 27, 2025
a9c09f2
removing removeComponet
Iximiel Feb 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
restoring the flavour of removeOutputComponent with no existance checks
  • Loading branch information
Iximiel committed Jan 27, 2025
commit 2f76d653847d949d79dc835d95d2982da674b23d
41 changes: 2 additions & 39 deletions src/tools/Keywords.cpp
Original file line number Diff line number Diff line change
@@ -1094,10 +1094,8 @@ std::string Keywords::getOutputComponentDescription( const std::string& name ) c

///////////DUPLICATED??????????///////
void Keywords::removeOutputComponent( const std::string& name ) {
if(components.find(name)!=components.end()) {
components.erase(name);
cnames.erase(std::remove(cnames.begin(), cnames.end(), name), cnames.end());
}
components.erase(name);
cnames.erase(std::remove(cnames.begin(), cnames.end(), name), cnames.end());
}

void Keywords::removeComponent( const std::string& name ) {
@@ -1109,41 +1107,6 @@ void Keywords::removeComponent( const std::string& name ) {
}
}


/*
//ORIGINALS
DIFFERENCES:
removeOutputComponent does not clean the keys and don't cares if you try remove something that doesn't exist
removeComponent does clean keys and cares if you try to remove something that doesn't exist

void Keywords::removeOutputComponent( const std::string& name ) {
unsigned j=0;
while(true) {
for(j=0; j<cnames.size(); j++) if(cnames[j]==name)break;
if(j<cnames.size()) cnames.erase(cnames.begin()+j);
else break;
}
cdocs.erase(name);
}

void Keywords::removeComponent( const std::string& name ) {
bool found=false;

while(true) {
unsigned j;
for(j=0; j<cnames.size(); j++) if(cnames[j]==name)break;
if(j<cnames.size()) {
cnames.erase(cnames.begin()+j);
found=true;
} else break;
}
// Delete documentation, type and so on from the description
cdocs.erase(name); ckey.erase(name);
plumed_massert(found,"You are trying to remove " + name + " a component that isn't there");
}

*/

std::string Keywords::getKeywordDescription( const std::string& key ) const {
plumed_assert( exists( key ) );
return keywords.at(key).docstring;