diff --git a/src/Particles/CMakeLists.txt b/src/Particles/CMakeLists.txt index 42ac0ea8..1b01ef94 100644 --- a/src/Particles/CMakeLists.txt +++ b/src/Particles/CMakeLists.txt @@ -1,10 +1,12 @@ set(SourceFiles dynamicPointStructure/dynamicPointStructure.cpp +particles/baseShapeNames.cpp +particles/shape.cpp particles/particles.cpp #particles/particleIdHandler.cpp -#SphereParticles/sphereShape/sphereShape.cpp -#SphereParticles/sphereParticles/sphereParticles.cpp +SphereParticles/sphereShape/sphereShape.cpp +SphereParticles/sphereParticles/sphereParticles.cpp #Insertion/shapeMixture/shapeMixture.cpp #Insertion/insertion/insertion.cpp #Insertion/Insertion/Insertions.cpp diff --git a/src/Particles/SphereParticles/sphereParticles/sphereParticles.cpp b/src/Particles/SphereParticles/sphereParticles/sphereParticles.cpp index f1d71012..04f4f19c 100644 --- a/src/Particles/SphereParticles/sphereParticles/sphereParticles.cpp +++ b/src/Particles/SphereParticles/sphereParticles/sphereParticles.cpp @@ -19,10 +19,12 @@ Licence: -----------------------------------------------------------------------------*/ #include "sphereParticles.hpp" -#include "setFieldList.hpp" -#include "sphereParticlesKernels.hpp" +#include "systemControl.hpp" +#include "vocabs.hpp" +//#include "setFieldList.hpp" +//#include "sphereParticlesKernels.hpp" -pFlow::uniquePtr> +/*pFlow::uniquePtr> pFlow::sphereParticles::getFieldObjectList()const { auto objListPtr = particles::getFieldObjectList(); @@ -78,10 +80,10 @@ bool pFlow::sphereParticles::initializeParticles() static_cast(shapeName_.size())); return insertSphereParticles(shapeName_, indices, false); -} +}*/ -bool pFlow::sphereParticles::beforeIteration() +/*bool pFlow::sphereParticles::beforeIteration() { particles::beforeIteration(); @@ -98,45 +100,19 @@ bool pFlow::sphereParticles::beforeIteration() intPredictTimer_.end(); return true; -} +}*/ -bool pFlow::sphereParticles::iterate() -{ - - accelerationTimer_.start(); - //INFO<<"before accelerationTimer_ "<dt(), accelertion_); - - rVelIntegration_().correct(this->dt(), rVelocity_, rAcceleration_); - - intCorrectTimer_.end(); - - return true; -} -bool pFlow::sphereParticles::afterIteration() + +/*bool pFlow::sphereParticles::afterIteration() { return true; -} +}*/ -bool pFlow::sphereParticles::insertSphereParticles( +/*bool pFlow::sphereParticles::insertSphereParticles( const wordVector& names, const int32IndexContainer& indices, bool setId @@ -219,6 +195,39 @@ bool pFlow::sphereParticles::insertSphereParticles( return true; +}*/ + +bool pFlow::sphereParticles::initInertia() +{ + + using exeSpace = typename realPointField_D::execution_space; + using policy = Kokkos::RangePolicy< + exeSpace, + Kokkos::IndexType>; + + auto aPointsMask = dynPointStruct().activePointsMaskDevice(); + auto aRange = aPointsMask.activeRange(); + + auto field_I = I_.fieldDevice(); + auto field_shapeIndex = shapeIndex().fieldDevice(); + + const auto& shp = getShapes(); + realVector_D I ("I", shp.Inertia()); + auto d_I = I.deviceVector(); + + Kokkos::parallel_for( + "particles::initInertia", + policy(aRange.start(), aRange.end()), + LAMBDA_HD(uint32 i) + { + if(aPointsMask(i)) + { + uint32 index = field_shapeIndex[i]; + field_I[i] = d_I[index]; + } + }); + Kokkos::fence(); + return true; } @@ -227,78 +236,67 @@ pFlow::sphereParticles::sphereParticles( const property& prop ) : - particles( - control, - control.settingsDict().getValOrSet( - "integrationMethod", - word("AdamsBashforth3") - ) + particles(control), + spheres_ + ( + shapeFile__, + &control.caseSetup(), + prop + ), + I_ + ( + objectFile + ( + "I", + "", + objectFile::READ_NEVER, + objectFile::WRITE_NEVER ), - property_(prop), - shapes_( - control.caseSetup().emplaceObjectOrGet( - objectFile( - sphereShapeFile__, - "", - objectFile::READ_ALWAYS, - objectFile::WRITE_NEVER - ) - ) - ), - I_( - this->time().emplaceObject( - objectFile( - "I", - "", - objectFile::READ_NEVER, - objectFile::WRITE_ALWAYS - ), - pStruct(), - static_cast(0.0000000001) - ) - ), - rVelocity_( - this->time().emplaceObject( - objectFile( - "rVelocity", - "", - objectFile::READ_IF_PRESENT, - objectFile::WRITE_ALWAYS - ), - pStruct(), - zero3 - ) - ), - rAcceleration_( - this->time().emplaceObject( - objectFile( - "rAcceleration", - "", - objectFile::READ_IF_PRESENT, - objectFile::WRITE_ALWAYS - ), - pStruct(), - zero3 - ) + dynPointStruct(), + static_cast(0.0000000001) + ), + rVelocity_ + ( + objectFile + ( + "rVelocity", + "", + objectFile::READ_IF_PRESENT, + objectFile::WRITE_ALWAYS ), + dynPointStruct(), + zero3 + ), + rAcceleration_ + ( + objectFile( + "rAcceleration", + "", + objectFile::READ_IF_PRESENT, + objectFile::WRITE_ALWAYS + ), + dynPointStruct(), + zero3 + ), accelerationTimer_( "Acceleration", &this->timers() ), intPredictTimer_( "Integration-predict", &this->timers() ), intCorrectTimer_( "Integration-correct", &this->timers() ) - { - REPORT(1)<<"Creating integration method "<integrationMethod()) - << " for rotational velocity."<("integrationMethod"); + REPORT(1)<<"Creating integration method "<time().integration(), - this->pStruct(), - this->integrationMethod()); + dynPointStruct(), + intMethod, + rVelocity_.field() + ); if( !rVelIntegration_ ) { @@ -307,7 +305,8 @@ pFlow::sphereParticles::sphereParticles( fatalExit; } - if(rVelIntegration_->needSetInitialVals()) + WARNING<<"setFields for rVelIntegration_"<needSetInitialVals()) { auto [minInd, maxInd] = pStruct().activeRange(); @@ -327,17 +326,17 @@ pFlow::sphereParticles::sphereParticles( REPORT(2)<< "Initializing the required vectors for rotational velocity integratoin\n "<setInitialVals(indexHD, rvel); - } + }*/ - if(!initializeParticles()) + if(!initInertia()) { fatalExit; } } -bool pFlow::sphereParticles::update(const eventMessage& msg) +/*bool pFlow::sphereParticles::update(const eventMessage& msg) { if(rVelIntegration_->needSetInitialVals()) @@ -362,9 +361,9 @@ bool pFlow::sphereParticles::update(const eventMessage& msg) } return true; -} +}*/ -bool pFlow::sphereParticles::insertParticles +/*bool pFlow::sphereParticles::insertParticles ( const realx3Vector& position, const wordVector& shapes, @@ -419,4 +418,70 @@ bool pFlow::sphereParticles::insertParticles return true; -} \ No newline at end of file +}*/ + +bool pFlow::sphereParticles::beforeIteration() +{ + particles::beforeIteration(); + intPredictTimer_.start(); + dynPointStruct().predict(dt(), accelertion()); + rVelIntegration_().predict(dt(),rVelocity_, rAcceleration_); + intPredictTimer_.end(); + + WARNING<<"pFlow::sphereParticles::beforeIteration()"< rVelIntegration_ = nullptr; @@ -73,9 +72,9 @@ protected: /// timer for integration computations (correction step) Timer intCorrectTimer_; - bool diameterMassInertiaPropId(const word& shName, real& diam, real& mass, real& I, int8& propIdx); + bool initInertia(); - bool initializeParticles(); + /*bool initializeParticles(); bool insertSphereParticles( const wordVector& names, @@ -83,25 +82,17 @@ protected: bool setId = true); virtual uniquePtr> getFieldObjectList()const override; + */ public: /// construct from systemControl and property - sphereParticles(systemControl &control, const property& prop); + sphereParticles( + systemControl &control, + const property& prop); - /// no copy constructor - sphereParticles(const sphereParticles&) = delete; - /// move constructor - sphereParticles(sphereParticles&&) = default; - - /// no copy-assignement - sphereParticles& operator=(const sphereParticles&) = delete; - - /// move-assignement - sphereParticles& operator=(sphereParticles&&) = default; - - virtual ~sphereParticles()=default; + ~sphereParticles()override=default; /** * Insert new particles in position with specified shapes @@ -112,17 +103,17 @@ public: * \param shape shape of new particles * \param setField initial value of the selected fields for new particles */ - bool insertParticles + /*bool insertParticles ( const realx3Vector& position, const wordVector& shapes, const setFieldList& setField - ) override ; + ) override ;*/ /// const reference to shapes object - const auto& shapes()const + const auto& spheres()const { - return shapes_; + return spheres_; } /// const reference to inertia pointField @@ -137,41 +128,29 @@ public: return I_; } - const realx3Vector_D rVelocity()const + const auto& rVelocity()const { return rVelocity_; } - const realVector_D& boundingSphere()const override - { - return this->diameter(); + auto& rVelocity() + { + return rVelocity_; } - word shapeTypeName() const override + bool hearChanges + ( + real t, + real dt, + uint32 iter, + const message& msg, + const anyList& varList + ) override { - return "sphere"; - } - - void boundingSphereMinMax( - real& minDiam, - real& maxDiam )const override - { - shapes_.diameterMinMax(minDiam, maxDiam); - } - - bool update(const eventMessage& msg) override; - - - realx3PointField_D& rAcceleration() override - { - return rAcceleration_; + notImplementedFunction; + return false; } - const realx3PointField_D& rAcceleration() const override - { - return rAcceleration_; - } - /// before iteration step bool beforeIteration() override; @@ -180,8 +159,25 @@ public: /// after iteration step bool afterIteration() override; - + realx3PointField_D& rAcceleration() override + { + return rAcceleration_; + } + + const realx3PointField_D& rAcceleration() const override + { + return rAcceleration_; + } + + const realPointField_D& boundingSphere()const override + { + return diameter(); + } + + word shapeTypeName()const override; + + const shape& getShapes()const override; }; //sphereParticles diff --git a/src/Particles/SphereParticles/sphereShape/sphereShape.cpp b/src/Particles/SphereParticles/sphereShape/sphereShape.cpp index 7723f039..f07942ce 100644 --- a/src/Particles/SphereParticles/sphereShape/sphereShape.cpp +++ b/src/Particles/SphereParticles/sphereShape/sphereShape.cpp @@ -19,186 +19,177 @@ Licence: -----------------------------------------------------------------------------*/ #include "sphereShape.hpp" -#include "dictionary.hpp" -#include "vocabs.hpp" -#include "streams.hpp" -bool pFlow::sphereShape::insertNames -( - const wordVector& names -) +bool pFlow::sphereShape::readDictionary() { - names_.clear(); - uint32 i=0; - for(const auto& nm:names) - { - if(!names_.insertIf(nm, i)) - { - fatalErrorInFunction<< - " repeated name in the list of sphere names: " << names; - return false; - } - i++; - } - names_.rehash(0); - numShapes_ = names_.size(); - - return true; -} + diameters_ = getVal("diameters"); - -bool pFlow::sphereShape::readDictionary -( - const dictionary& dict -) -{ - diameters_ = dict.getVal("diameters"); - materials_ = dict.getVal("materials"); - auto names = dict.getVal("names"); - - if(diameters_.size() != materials_.size() ) + if(diameters_.size() != numShapes() ) { - fatalErrorInFunction<< - " number of elements in diameters and properties are not the same in "<< dict.globalName()< names_; +protected: - size_t numShapes_; - - - bool insertNames(const wordVector& names); - - bool readDictionary(const dictionary& dict); - - bool writeDictionary(dictionary& dict)const; + bool writeToDict(dictionary& dict)const override; public: // - type info - TypeInfoNV("sphereShape"); + TypeInfo("shape"); + sphereShape( + const word& fileName, + repository* owner, + const property& prop); - sphereShape(){} - - sphereShape( - const realVector& diameter, - const wordVector& property, - const wordVector& name - ); - - sphereShape(const sphereShape&) = default; - - sphereShape(sphereShape&&) = default; - - sphereShape& operator=(const sphereShape&) = default; - - sphereShape& operator=(sphereShape&&) = default; - - auto clone()const - { - return makeUnique(*this); - } - - sphereShape* clonePtr()const - { - return new sphereShape(*this); - } - - ~sphereShape() = default; + + ~sphereShape() override = default; //// - Methods - const auto& names()const{ - return names_; - } - const auto& diameters()const{ - return diameters_; - } + real maxBoundingSphere()const override; - const auto& materials()const{ - return materials_; - } + real minBoundingSphere()const override; - const auto diameter(label i)const{ - return diameters_[i]; - } + bool boundingDiameter(uint32 index, real& bDiam)const override; - const auto material(label i)const{ - return materials_[i]; - } + real boundingDiameter(uint32 index)const override; + realVector boundingDiameter()const override; - // name to index - bool nameToIndex(const word& name, uint32& index)const - { - if(auto[iter, found] = names_.findIf(name); found ) - { - index = iter->second; - return true; - } - else - { - index = 0; - return false; - } - } + bool mass(uint32 index, real& m)const override; - uint32 nameToIndex(const word& name)const - { - return names_.at(name); - } + real mass(uint32 index) const override; - bool indexToName(uint32 i, word& name)const - { - for(auto& nm: names_) - { - if(nm.second == i) - { - name = nm.first; - return true; - } - } - name = ""; - return false; - } + realVector mass()const override; - bool shapeToDiameter(wordVector& names, realVector& diams)const; + realVector density() const override; - void diameterMinMax(real& minD, real& maxD)const - { - minD = min(diameters_); - maxD = max(diameters_); - } + bool Inertia(uint32 index, real& I)const override; - //// - IO operatoin + real Inertia(uint32 index)const override; - // - read from stream/file - bool read(iIstream& is); + realVector Inertia()const override; + + bool Inertia_xx(uint32 index, real& Ixx)const override; - // - write to stream/file - bool write(iOstream& os)const; + real Inertial_xx(uint32 index)const override; + + bool Inertia_yy(uint32 index, real& Iyy)const override; - // - read from dictionary - bool read(const dictionary& dict) - { - return readDictionary(dict); - } + real Inertial_yy(uint32 index)const override; - // - write to dictionary - bool write(dictionary& dict)const - { - return writeDictionary(dict); - } + bool Inertia_zz(uint32 index, real& Izz)const override; + real Inertial_zz(uint32 index)const override; }; diff --git a/src/Particles/particles/baseShapeNames.cpp b/src/Particles/particles/baseShapeNames.cpp new file mode 100644 index 00000000..c8200f0c --- /dev/null +++ b/src/Particles/particles/baseShapeNames.cpp @@ -0,0 +1,114 @@ +/*------------------------------- 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 "baseShapeNames.hpp" + +bool pFlow::baseShapeNames::createHashNames() +{ + hashNames_.clear(); + uint32 i=0; + for(const auto& nm:shapeNames_) + { + if(!hashNames_.insertIf(nm, i)) + { + fatalErrorInFunction<< + " repeated name in the list of shape names: " << shapeNames_; + return false; + } + i++; + } + hashNames_.rehash(0); + + return true; +} + + +bool pFlow::baseShapeNames::readFromDictionary() +{ + + shapeNames_ = getVal("names"); + numShapes_ = shapeNames_.size(); + + return true; +} + + +pFlow::baseShapeNames::baseShapeNames +( + const word &fileName, + repository *owner +) +: + fileDictionary + ( + objectFile + ( + fileName, + "", + objectFile::READ_ALWAYS, + objectFile::WRITE_ALWAYS + ), + owner + ) +{ + + if( !readFromDictionary() ) + { + fatalExit; + } + + if( !createHashNames()) + { + fatalExit; + } + +} + +bool pFlow::baseShapeNames::writeToDict(dictionary &dict)const +{ + + if( !dict.add("names", shapeNames_) ) + { + fatalErrorInFunction<< + " Error in writing names to dictionary "<< dict.globalName()< hashNames_; + + /// list of shape names + wordVector shapeNames_; + + bool createHashNames(); + + bool readFromDictionary(); + +protected: + + virtual + bool writeToDict(dictionary& dict)const; + +public: + + TypeInfo("baseShapeNames"); + + baseShapeNames( + const word& fileName, + repository* owner); + + ~baseShapeNames() override=default; + + + inline + const wordVector& shapeNames()const + { + return shapeNames_; + } + + inline + wordList shapeNameList()const + { + wordList wl; + wl.insert(wl.begin(), shapeNames_.begin(), shapeNames_.end()); + return wl; + } + + inline + size_t numShapes()const + { + return numShapes_; + } + + // name to index + inline + bool shapeNameToIndex(const word& name, uint32& index)const + { + if(auto[iter, found] = hashNames_.findIf(name); found ) + { + index = iter->second; + return true; + } + else + { + index = 0; + return false; + } + } + + inline + bool indexToShapeName(uint32 i, word& name)const + { + if( i < numShapes_) + { + name = shapeNames_[i]; + return true; + } + return false; + } + + inline + bool indexValid(uint32 index)const + { + return index < numShapes_; + } + + // - IO + + bool write(iOstream& os)const override; + +}; + +} + +#endif //__shapeNames_hpp__ \ No newline at end of file diff --git a/src/Particles/particles/particles.cpp b/src/Particles/particles/particles.cpp index 23250718..ff32aa4f 100644 --- a/src/Particles/particles/particles.cpp +++ b/src/Particles/particles/particles.cpp @@ -21,17 +21,71 @@ Licence: #include "particles.hpp" +bool pFlow::particles::initMassDiameter()const +{ + + auto [minIndex, maxIndex] = minMax(shapeIndex_.internal()); + + const auto& shp = getShapes(); + + if( !shp.indexValid(maxIndex) ) + { + fatalErrorInFunction<< + "the maximum value of shape index is "<< maxIndex << + " which is not valid."<>; + + auto field_diameter = diameter_.fieldDevice(); + auto field_mass = mass_.fieldDevice(); + auto field_propId = propertyId_.fieldDevice(); + auto field_shapeIndex = shapeIndex_.fieldDevice(); + + auto d_d = d.deviceVector(); + auto d_mass = mass.deviceVector(); + auto d_propId = propId.deviceVector(); + + Kokkos::parallel_for( + "particles::initMassDiameter", + policy(aRange.start(), aRange.end()), + LAMBDA_HD(uint32 i) + { + if(aPointsMask(i)) + { + uint32 index = field_shapeIndex[i]; + field_diameter[i] = d_d[index]; + field_mass[i] = d_mass[index]; + field_propId[i] = d_propId[index]; + } + }); + Kokkos::fence(); + + return true; +} pFlow::particles::particles ( - systemControl& control + systemControl &control ) -: - observer(), +: + observer(defaultMessage_), demComponent("particles", control), dynPointStruct_(control), id_ - ( + ( objectFile ( "id", @@ -48,127 +102,108 @@ pFlow::particles::particles ( "propertyId", "", - objectFile::READ_NEVER, + objectFile::READ_ALWAYS, objectFile::WRITE_NEVER ), dynPointStruct_, static_cast(0) ), - diameter_ + shapeIndex_ ( objectFile ( + "shapeIndex", + "", + objectFile::READ_ALWAYS, + objectFile::WRITE_ALWAYS + ), + dynPointStruct_, + 0 + ), + diameter_ + ( + objectFile( "diameter", "", objectFile::READ_NEVER, - objectFile::WRITE_ALWAYS - ), + objectFile::WRITE_NEVER), dynPointStruct_, 0.00000000001 ), mass_ ( - objectFile - ( + objectFile( "mass", "", objectFile::READ_NEVER, - objectFile::WRITE_ALWAYS - ), + objectFile::WRITE_NEVER), dynPointStruct_, 0.0000000001 ), accelertion_ ( - objectFile - ( + objectFile( "accelertion", "", objectFile::READ_IF_PRESENT, - objectFile::WRITE_ALWAYS - ), + objectFile::WRITE_ALWAYS), dynPointStruct_, zero3 ), - contactForce_ - ( - objectFile - ( + contactForce_( + objectFile( "contactForce", "", objectFile::READ_IF_PRESENT, - objectFile::WRITE_ALWAYS - ), + objectFile::WRITE_ALWAYS), dynPointStruct_, - zero3 - ), - contactTorque_ - ( - - objectFile - ( + zero3), + contactTorque_( + objectFile( "contactTorque", "", objectFile::READ_IF_PRESENT, - objectFile::WRITE_ALWAYS - ), + objectFile::WRITE_ALWAYS), dynPointStruct_, - zero3 - ) + zero3) { - WARNING<<"Subscribe particles"<subscribe(pStruct()); + this->addToSubscriber(dynPointStruct_); + + if(!initMassDiameter()) + { + fatalExit; + } } bool pFlow::particles::beforeIteration() { - /*auto domain = this->control().domain(); - - auto numMarked = dynPointStruct_.markDeleteOutOfBox(domain); - if(time_.sortTime()) - { - real min_dx, max_dx; - boundingSphereMinMax(min_dx, max_dx); - Timer t; - t.start(); - REPORT(0)<<"Performing morton sorting on particles ...."<zeroForce(); - this->zeroTorque();*/ + dynPointStruct_.beforeIteration(); + zeroForce(); + zeroTorque(); return true; } -/*pFlow::uniquePtr> -pFlow::particles::getFieldObjectList()const +bool pFlow::particles::iterate() { - auto objListPtr = makeUnique>(); - objListPtr().push_back( - static_cast(&id_) ); - - objListPtr().push_back( - static_cast(&propertyId_) ); + return dynPointStruct_.iterate(); +} - objListPtr().push_back( - static_cast(&diameter_) ); +bool pFlow::particles::afterIteration() +{ + return dynPointStruct_.afterIteration(); +} - objListPtr().push_back( - static_cast(&mass_) ); - - objListPtr().push_back( - static_cast(&shapeName_) ); - - return objListPtr; -}*/ +void pFlow::particles::boundingSphereMinMax +( + real &minDiam, + real &maxDiam +) const +{ + auto& shp = getShapes(); + minDiam = shp.minBoundingSphere(); + maxDiam = shp.maxBoundingSphere(); +} \ No newline at end of file diff --git a/src/Particles/particles/particles.hpp b/src/Particles/particles/particles.hpp index 554c9a85..5f9e7ea8 100644 --- a/src/Particles/particles/particles.hpp +++ b/src/Particles/particles/particles.hpp @@ -24,6 +24,7 @@ Licence: #include "dynamicPointStructure.hpp" #include "demComponent.hpp" +#include "shape.hpp" namespace pFlow { @@ -39,43 +40,51 @@ private: /// dynamic point structure for particles center mass dynamicPointStructure dynPointStruct_; - // - name of shapes - this is managed by particles - //wordPointField& shapeName_; + /// id of particles on host + uint32PointField_D id_; - // id of particles on host - int32PointField_D id_; + /// property id on device + uint8PointField_D propertyId_; - // property id on device - int8PointField_D propertyId_; + /// property id on device + uint32PointField_D shapeIndex_; - // diameter / boundig sphere size of particles on device + /// diameter / boundig sphere size of particles on device realPointField_D diameter_; - // mass of particles field + /// mass of particles field realPointField_D mass_; - // - acceleration on device - realx3PointField_D accelertion_; + /// acceleration on device + realx3PointField_D accelertion_; /// contact force field realx3PointField_D contactForce_; /// contact torque field - realx3PointField_D contactTorque_; + realx3PointField_D contactTorque_; + static inline + const message defaultMessage_ = + ( + message::CAP_CHANGED+ + message::SIZE_CHANGED+ + message::ITEM_INSERT+ + message::ITEM_DELETE + ); + bool initMassDiameter()const; void zeroForce() { - WARNING<<"fill contactTorque"<(propId); + } + else + { + fatalErrorInFunction<<"Material name "<< materialNames_[i]<< + "is not valid in dictionary "<("materials"); + + if(materialNames_.size() != numShapes() ) + { + fatalErrorInFunction<< + " number of elements in materials and names are not the same in "<< globalName()<(propId) < property_.numMaterials(); + } + + + inline + bool indexToDensity(uint32 index, real& rho)const + { + if(indexValid(index)) + return property_.density(shapePropertyIds_[index], rho); + return false; + } + + inline + real indexToDensity(uint32 index)const + { + if(indexValid(index)) + { + return property_.density(shapePropertyIds_[index]); + } + + fatalExit; + return 0.0; + } + + virtual + real maxBoundingSphere()const = 0; + + virtual + real minBoundingSphere()const = 0; + + virtual + bool boundingDiameter(uint32 index, real& bDiam)const =0; + + virtual + real boundingDiameter(uint32 index)const = 0; + + virtual + realVector boundingDiameter()const = 0; + + virtual + bool mass(uint32 index, real& m)const = 0; + + virtual + real mass(uint32 index) const =0; + + virtual + realVector mass()const =0; + + virtual + realVector density()const =0; + + virtual + bool Inertia(uint32 index, real& I)const = 0; + + virtual + real Inertia(uint32 index)const = 0; + + virtual + realVector Inertia()const=0; + + virtual + bool Inertia_xx(uint32 index, real& Ixx)const = 0; + + virtual + real Inertial_xx(uint32 index)const =0; + + virtual + bool Inertia_yy(uint32 index, real& Iyy)const = 0; + + virtual + real Inertial_yy(uint32 index)const = 0; + + virtual + bool Inertia_zz(uint32 index, real& Izz)const = 0; + + virtual + real Inertial_zz(uint32 index)const = 0; + +}; + +} + +#endif //__shape_hpp__ \ No newline at end of file