-
Notifications
You must be signed in to change notification settings - Fork 101
feat: support non-scalar valued field specifications #4034
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
base: develop
Are you sure you want to change the base?
Changes from all commits
c8adaac
67da13f
e133dd2
7c18352
2dc1751
d5fbc7f
e7af0f5
663a168
7e4f6a5
839d653
b0ae8d2
e073b5f
156ffc7
bfb53d5
d74a3d1
f684f70
28dbcff
0ecdd93
76d2297
27a5eb8
d766df1
0013c0a
4c708e0
b0b3df9
7267a4d
aef69ab
bd0fbab
9664351
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,8 @@ | |
|
|
||
| #include "FieldSpecificationBase.hpp" | ||
|
|
||
| #include "common/format/StringUtilities.hpp" | ||
| #include "common/logger/Logger.hpp" | ||
| #include "fieldSpecification/FieldSpecificationManager.hpp" | ||
|
|
||
| namespace geos | ||
|
|
@@ -39,6 +41,11 @@ FieldSpecificationBase::FieldSpecificationBase( string const & name, Group * par | |
| setInputFlag( InputFlags::OPTIONAL ). | ||
| setDescription( "Path to the target field" ); | ||
|
|
||
| registerWrapper( viewKeyStruct::regionNamesString(), &m_regionNames ). | ||
| setRTTypeName( rtTypes::CustomTypes::groupNameRefArray ). | ||
| setInputFlag( InputFlags::OPTIONAL ). | ||
| setDescription( "Names of the regions where the field specification is applied." ); | ||
|
|
||
| registerWrapper( viewKeyStruct::fieldNameString(), &m_fieldName ). | ||
| setRTTypeName( rtTypes::CustomTypes::groupNameRef ). | ||
| setInputFlag( InputFlags::OPTIONAL ). | ||
|
|
@@ -61,6 +68,13 @@ FieldSpecificationBase::FieldSpecificationBase( string const & name, Group * par | |
| setInputFlag( InputFlags::OPTIONAL ). | ||
| setDescription( "Name of function that specifies variation of the boundary condition." ); | ||
|
|
||
| registerWrapper( viewKeyStruct::functionNamesString(), &m_functionNames ). | ||
| setRTTypeName( rtTypes::CustomTypes::groupNameRefArray ). | ||
| setInputFlag( InputFlags::OPTIONAL ). | ||
| setSizedFromParent( 0 ). | ||
| setDescription( "Names of per-component functions that specifies variation of the boundary condition.\n" | ||
| "Either left empty or sized exactly like 'scales'." ); | ||
|
|
||
|
Comment on lines
+71
to
+77
Member
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. similar to the |
||
| registerWrapper( viewKeyStruct::bcApplicationTableNameString(), &m_bcApplicationFunctionName ). | ||
| setRTTypeName( rtTypes::CustomTypes::groupNameRef ). | ||
| setInputFlag( InputFlags::OPTIONAL ). | ||
|
|
@@ -71,6 +85,11 @@ FieldSpecificationBase::FieldSpecificationBase( string const & name, Group * par | |
| setInputFlag( InputFlags::OPTIONAL ). | ||
| setDescription( "Apply a scaling factor for the value of the boundary condition." ); | ||
|
|
||
| registerWrapper( viewKeyStruct::scalesString(), &m_scales ). | ||
| setInputFlag( InputFlags::OPTIONAL ). | ||
| setSizedFromParent( 0 ). | ||
| setDescription( "Apply scaling factors for the values of every component of the boundary condition." ); | ||
|
|
||
|
Comment on lines
+88
to
+92
Member
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. What is the driver to make a new |
||
| registerWrapper( viewKeyStruct::initialConditionString(), &m_initialCondition ). | ||
| setApplyDefaultValue( 0 ). | ||
| setInputFlag( InputFlags::OPTIONAL ). | ||
|
|
@@ -110,22 +129,66 @@ FieldSpecificationBase::getCatalog() | |
| } | ||
|
|
||
|
|
||
| void FieldSpecificationBase::postInputInitialization() | ||
| { | ||
| GEOS_THROW_IF( !m_functionNames.empty() && | ||
| m_functionNames.size() != static_cast< string_array::size_type >( m_scales.size() ), | ||
| GEOS_FMT ( "Size mismatch: '{}' has {} entries but '{}' has {}. " | ||
| "Either leave '{}' empty or size it exactly like '{}'", | ||
| viewKeyStruct::functionNamesString(), m_functionNames.size(), | ||
| viewKeyStruct::scalesString(), m_scales.size(), | ||
| viewKeyStruct::functionNamesString(), viewKeyStruct::scalesString() ), | ||
| InputError, | ||
| getDataContext() ); | ||
|
|
||
| if( usesNonScalarValues() ) | ||
| { | ||
| GEOS_THROW_IF( m_component != -1, | ||
| GEOS_FMT ( "'{}' must not be set when '{}' is set.", | ||
| viewKeyStruct::componentString(), | ||
| viewKeyStruct::scalesString() ), | ||
| InputError, | ||
| getDataContext() ); | ||
|
|
||
| GEOS_THROW_IF( !m_functionName.empty(), | ||
| GEOS_FMT ( "'{}' must not be set when '{}' is set." | ||
| "Use '{}' to provide one function per component instead", | ||
| viewKeyStruct::functionNameString(), | ||
| viewKeyStruct::scalesString(), | ||
| viewKeyStruct::functionNamesString() ), | ||
| InputError, | ||
| getDataContext() ); | ||
| } | ||
|
|
||
| if( !m_regionNames.empty() ) | ||
| { | ||
| GEOS_THROW_IF( !m_objectPath.empty(), | ||
| GEOS_FMT ( "'{}' must not be set when '{}' is set.", | ||
| viewKeyStruct::objectPathString(), | ||
| viewKeyStruct::regionNamesString() ), | ||
| InputError, | ||
| getDataContext() ); | ||
| } | ||
| } | ||
|
|
||
| void FieldSpecificationBase::setMeshObjectPath( Group const & meshBodies ) | ||
| { | ||
| string const path = m_regionNames.empty() | ||
| ? m_objectPath | ||
| : "ElementRegions/{" + stringutilities::join( m_regionNames, ' ' ) + "}"; | ||
| try | ||
| { | ||
| m_meshObjectPaths = std::make_unique< MeshObjectPath >( m_objectPath, meshBodies ); | ||
| m_meshObjectPaths = std::make_unique< MeshObjectPath >( path, meshBodies ); | ||
| } | ||
| catch( std::exception const & e ) | ||
| { | ||
| ErrorLogger::global().modifyCurrentExceptionMessage() | ||
| .addToMsg( getWrapperDataContext( viewKeyStruct::objectPathString() ).toString() + | ||
| " is a wrong objectPath: " + m_objectPath + "\n" ) | ||
| " is a wrong objectPath: " + path + "\n" ) | ||
| .addContextInfo( getWrapperDataContext( viewKeyStruct::objectPathString() ).getContextInfo() | ||
| .setPriority( 2 ) ); | ||
| throw InputError( e, getWrapperDataContext( viewKeyStruct::objectPathString() ).toString() + | ||
| " is a wrong objectPath: " + m_objectPath + "\n" ); | ||
| " is a wrong objectPath: " + path + "\n" ); | ||
| } | ||
| } | ||
|
|
||
|
|
||
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.
you can just leave this as scale?