-
Notifications
You must be signed in to change notification settings - Fork 97
feat: Input error when a box does not select anything #3808
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
Changes from 1 commit
2c3a2a7
bfe7b49
82055c1
94104fb
c125ae2
b1fe1a0
37bc92d
bb3a1ac
5f84879
d93c3d8
ed02e2b
1de66c8
c19069f
59d2d7a
3dca3c4
9054c64
0fbd101
7db4040
5599217
3d89422
82359ae
f6bd260
26fba63
af62cbc
58e284c
f09ef8d
5521545
e993c6e
3fe65b0
30e85fd
2d8ea45
e469dfd
abedcc5
97bc914
03f061d
869ddaf
d7a3aea
4a83b8e
02e981e
03d280e
7433d26
0fe2c58
1017ecd
13b012c
ec86c38
8840280
39675d7
88d9589
65ed1a0
a28b7c6
b95f304
3387d4a
308f0e8
54c013a
4ee688e
a5f2a43
874186b
2886078
4b3161a
562842f
181e571
03c20b2
7c79821
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -16,6 +16,8 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| #include "FieldSpecificationManager.hpp" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #include "mesh/DomainPartition.hpp" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #include "mesh/MeshBody.hpp" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #include "mesh/MeshObjectPath.hpp" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| namespace geos | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -67,8 +69,53 @@ void FieldSpecificationManager::expandObjectCatalogs() | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using SetNameToTypesMap = std::map< std::string, std::vector< MeshObjectPath::ObjectTypes > >; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| template< typename TYPE, typename ... NEXT_TYPES > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| void forTypes( FieldSpecificationBase const & fs, MeshLevel const & mesh, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MeshObjectPath::ObjectTypes const targetType, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| string const & setName, SetNameToTypesMap & setTypesMap ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mesh.forSubGroups< TYPE >( [&]( Group const & targetManager ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TYPE const * manager = dynamic_cast< TYPE const * >( &targetManager ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if( manager != nullptr ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if( manager->sets().hasWrapper( setName )) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| auto const & targetSet = manager->getSet( setName ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if( std::is_same_v< TYPE, NodeManager > && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| targetType != MeshObjectPath::ObjectTypes::nodes && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| targetSet.size() > 0 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| setTypesMap[setName].push_back( MeshObjectPath::ObjectTypes::nodes ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else if( std::is_same_v< TYPE, EdgeManager > && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| targetType != MeshObjectPath::ObjectTypes::edges && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| targetSet.size() > 0 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| setTypesMap[setName].push_back( MeshObjectPath::ObjectTypes::edges ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else if( std::is_same_v< TYPE, FaceManager > && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| targetType != MeshObjectPath::ObjectTypes::faces && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| targetSet.size() > 0 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| setTypesMap[setName].push_back( MeshObjectPath::ObjectTypes::faces ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if constexpr ( sizeof...(NEXT_TYPES) > 0 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| forTypes< NEXT_TYPES... >( fs, mesh, targetType, setName, setTypesMap ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| void FieldSpecificationManager::validateBoundaryConditions( MeshLevel & mesh ) const | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DomainPartition const & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Group const & meshBodies = domain.getMeshBodies(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed the duplication and let this one |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // loop over all the FieldSpecification of the XML file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this->forSubGroups< FieldSpecificationBase >( [&] ( FieldSpecificationBase const & fs ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -77,6 +124,11 @@ void FieldSpecificationManager::validateBoundaryConditions( MeshLevel & mesh ) c | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| map< string, localIndex > isTargetSetEmpty; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // map from set name to a flag (1 if targetSet has been created, 0 otherwise) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| map< string, localIndex > isTargetSetCreated; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // map from setName where we store the derived class of objectManager (if exist) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SetNameToTypesMap setTypesMap; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // The target type of objectPath | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MeshObjectPath::ObjectTypes expectedSetType = fs.getMeshObjectPaths().getObjectType(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Step 1: collect all the set names in a map (this is made necessary by the "apply" loop pattern | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -85,6 +137,7 @@ void FieldSpecificationManager::validateBoundaryConditions( MeshLevel & mesh ) c | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isTargetSetEmpty[setNames[i]] = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isTargetSetCreated[setNames[i]] = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| setTypesMap[setNames[i]].push_back( expectedSetType ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // We have to make sure that the meshLevel is in the target of the boundary conditions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -96,7 +149,6 @@ void FieldSpecificationManager::validateBoundaryConditions( MeshLevel & mesh ) c | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Step 2: apply the boundary condition | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fs.apply< Group >( mesh, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [&]( FieldSpecificationBase const &, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| string const & setName, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -105,31 +157,20 @@ void FieldSpecificationManager::validateBoundaryConditions( MeshLevel & mesh ) c | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| string const fieldName ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| InputFlags const flag = fs.getWrapper< string >( FieldSpecificationBase::viewKeyStruct::fieldNameString() ).getInputFlag(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 2.a) If we enter this loop, we know that the set has been created | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Fracture/fault sets are created later and the "apply" call silently ignores them | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isTargetSetCreated.at( setName ) = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 2.b) If the fieldName is registered on this target, we record it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Unfortunately, we need two exceptions: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // - FieldSpecification that do not target a field, like Aquifer, Traction, Equilibrium, etc. For these, the check is not | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // necessary (the user cannot mess up) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // - Face boundary conditions that target cell-based quantities, like the face BC of the flow solvers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if( targetGroup.hasWrapper( fieldName ) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| flag == InputFlags::FALSE || // no need to check input if the input flag is false (Aquifer, Traction, Equilibrium do not target a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // field) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| targetGroup.getName() == MeshLevel::groupStructKeys::faceManagerString() ) // the field names of the face BCs are not always | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // registered on | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // the faceManager... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if( targetGroup.hasWrapper( fieldName ) ||flag == InputFlags::FALSE || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| targetGroup.getName() == MeshLevel::groupStructKeys::faceManagerString() ) // the field names of the face BCs are not always | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // registered on | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // the faceManager... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| InputFlags const flag = fs.getWrapper< string >( FieldSpecificationBase::viewKeyStruct::fieldNameString() ).getInputFlag(); | |
| // 2.a) If we enter this loop, we know that the set has been created | |
| // Fracture/fault sets are created later and the "apply" call silently ignores them | |
| isTargetSetCreated.at( setName ) = 1; | |
| // 2.b) If the fieldName is registered on this target, we record it | |
| // Unfortunately, we need two exceptions: | |
| // - FieldSpecification that do not target a field, like Aquifer, Traction, Equilibrium, etc. For these, the check is not | |
| // necessary (the user cannot mess up) | |
| // - Face boundary conditions that target cell-based quantities, like the face BC of the flow solvers | |
| if( targetGroup.hasWrapper( fieldName ) || | |
| flag == InputFlags::FALSE || // no need to check input if the input flag is false (Aquifer, Traction, Equilibrium do not target a | |
| // field) | |
| targetGroup.getName() == MeshLevel::groupStructKeys::faceManagerString() ) // the field names of the face BCs are not always | |
| // registered on | |
| // the faceManager... | |
| if( targetGroup.hasWrapper( fieldName ) ||flag == InputFlags::FALSE || | |
| targetGroup.getName() == MeshLevel::groupStructKeys::faceManagerString() ) // the field names of the face BCs are not always | |
| // registered on | |
| // the faceManager... | |
| InputFlags const flag = fs.getWrapper< string >( FieldSpecificationBase::viewKeyStruct::fieldNameString() ).getInputFlag(); | |
| isTargetSetCreated.at( setName ) = 1; | |
| if( targetGroup.hasWrapper( fieldName ) ||flag == InputFlags::FALSE || | |
| targetGroup.getName() == MeshLevel::groupStructKeys::faceManagerString() ) // the field names of the face BCs are not always | |
| // registered on the faceManager... |
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.
add spaces to keep formatting consistent