/*------------------------------- phasicFlow --------------------------------- O C enter of O O E ngineering and O O M ultiscale modeling of OOOOOOO F luid flow ------------------------------------------------------------------------------ Copyright (C): www.cemf.ir email: hamid.r.norouzi AT gmail.com ------------------------------------------------------------------------------ Licence: This file is part of phasicFlow code. It is a free software for simulating granular and multiphase flows. You can redistribute it and/or modify it under the terms of GNU General Public License v3 or any other later versions. phasicFlow is distributed to help others in their research in the field of granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -----------------------------------------------------------------------------*/ #include "multiRotatingAxisMotion.hpp" #include "dictionary.hpp" #include "vocabs.hpp" bool pFlow::multiRotatingAxisMotion::readDictionary ( const dictionary& dict ) { auto motionModel = dict.getVal("motionModel"); if(motionModel != "multiRotatingAxisMotion") { fatalErrorInFunction<< " motionModel should be multiRotatingAxisMotion, but found " << motionModel <(axDict); axPtr) { rotationAxis.push_back( axDict.getValOrSet("rotationAxis", "none")); } else { fatalErrorInFunction<< "could not read rotating axis from "<< axDict.globalName()<; std::vector numRotAxis; for(size_t i=0; i< axisNames.size(); i++) { word rotAxis = rotationAxis[i]; int32 n=0; while(rotAxis != "none") { n++; if(int32 iAxis = axisNames.findi(rotAxis) ; iAxis != -1) { rotAxis = rotationAxis[iAxis]; }else { fatalErrorInFunction<< "rotation axis name "<< rotAxis << "is does not exist!"< b.first; }; algorithms::STD::sort(numRotAxis.data(), numRotAxis.size(), compareFunc); sortedIndex_.clear(); axisName_.clear(); for(auto ax:numRotAxis) { axisName_.push_back(axisNames[ax.second]); sortedIndex_.push_back(ax.second); } numAxis_ = axisName_.size(); axis_.clear(); axis_.reserve(numAxis_); // create the actual axis vector for(auto& aName: axisName_) { if(aName != "none") { auto& axDict = motionInfo.subDict(aName); axis_.push_back( multiRotatingAxis(this, axDict)); } else { axis_.push_back( multiRotatingAxis(this)); } } return true; } bool pFlow::multiRotatingAxisMotion::writeDictionary ( dictionary& dict )const { dict.add("motionModel", "multiRotatingAxisMotion"); auto& motionInfo = dict.subDictOrCreate("multiRotatingAxisMotionInfo"); ForAll(i, axis_) { auto& axDict = motionInfo.subDictOrCreate(axisName_[i]); if( !axis_.hostVectorAll()[i].write(this,axDict)) { fatalErrorInFunction<< " error in writing axis "<< axisName_[i] << " to dicrionary " << motionInfo.globalName()<