22 template<
typename Model,
typename Component>
26 if(
auto i = componentNames_.findi(name); i == -1)
32 indx =
static_cast<uint32>(i);
38 template<
typename Model,
typename Component>
42 if(i < numComponents_ )
44 name = componentNames_[i];
53 template<
typename Model,
typename Component>
61 auto modelName = dict.
getVal<
word>(
"motionModel");
63 if(modelName != getTypeName<ModelComponent>())
66 " motionModel should be "<<
Yellow_Text(getTypeName<ModelComponent>())<<
71 auto& motionInfo = dict.
subDict(modelName+
"Info");
75 "Read::modelComponent",
80 componentNames_.clear();
83 for(
auto& cName: compNames)
85 auto& compDict = motionInfo.subDict(cName);
87 if(
auto compPtr = makeUnique<ModelComponent>(compDict); compPtr)
89 components.push_back(compPtr());
90 componentNames_.push_back(cName);
94 if( !componentNames_.search(
"none") )
100 componentNames_.push_back(
"none");
103 motionComponents_.assign(components);
104 numComponents_ = motionComponents_.
size();
110 template<
typename Model,
typename Component>
117 word modelName = getTypeName<ModelComponent>();
119 dict.
add(
"motionModel", modelName );
121 auto modelDictName = modelName+
"Info";
124 auto hostComponents = motionComponents_.hostView();
126 ForAll(i, motionComponents_)
129 auto& axDict = motionInfo.subDictOrCreate(componentNames_[i]);
130 if( !hostComponents[i].write(axDict))
133 " error in writing axis "<< componentNames_[i] <<
" to dicrionary "
134 << motionInfo.globalName()<<
endl;
143 template<
typename Model,
typename Component>
146 motionComponents_(
"motionComponents")