Files
phasicFlow/src/Particles/particles/particles.hpp

225 lines
4.4 KiB
C++
Raw Normal View History

/*------------------------------- phasicFlow
--------------------------------- O C enter of O O E
ngineering and O O M ultiscale modeling of OOOOOOO F luid
flow
2022-09-05 01:56:29 +04:30
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
2022-09-05 01:56:29 +04:30
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.
2022-09-05 01:56:29 +04:30
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.
2022-09-05 01:56:29 +04:30
-----------------------------------------------------------------------------*/
2022-09-05 01:56:29 +04:30
2022-12-10 01:32:54 +03:30
#ifndef __particles_hpp__
#define __particles_hpp__
2022-09-05 01:56:29 +04:30
2024-01-21 13:26:23 -08:00
#include "demComponent.hpp"
#include "dynamicPointStructure.hpp"
#include "particleIdHandler.hpp"
#include "shape.hpp"
2024-01-21 13:26:23 -08:00
2022-09-05 01:56:29 +04:30
namespace pFlow
{
class particles
: public observer
, public demComponent
2022-09-05 01:56:29 +04:30
{
2024-01-21 13:26:23 -08:00
private:
2022-09-05 01:56:29 +04:30
/// dynamic point structure for particles center mass
dynamicPointStructure dynPointStruct_;
2022-09-05 01:56:29 +04:30
/// shape index of each particle
uint32PointField_D shapeIndex_;
2022-09-05 01:56:29 +04:30
/// acceleration on device
realx3PointField_D accelertion_;
2022-09-05 01:56:29 +04:30
2024-01-21 13:26:23 -08:00
/// contact force field
realx3PointField_D contactForce_;
2022-09-05 01:56:29 +04:30
2024-01-21 13:26:23 -08:00
/// contact torque field
realx3PointField_D contactTorque_;
2022-09-05 01:56:29 +04:30
/// handling new ids for new particles
uniquePtr<particleIdHandler> idHandler_ = nullptr;
/// messages for this objects
static inline const message defaultMessage_{ message::DEFAULT };
protected:
2024-01-26 01:10:10 -08:00
2022-09-05 01:56:29 +04:30
void zeroForce()
{
contactForce_.fill(zero3);
2022-09-05 01:56:29 +04:30
}
void zeroTorque()
{
contactTorque_.fill(zero3);
2022-09-05 01:56:29 +04:30
}
2024-01-21 13:26:23 -08:00
inline auto& dynPointStruct()
2022-09-05 01:56:29 +04:30
{
2024-01-21 13:26:23 -08:00
return dynPointStruct_;
2022-09-05 01:56:29 +04:30
}
2024-01-21 13:26:23 -08:00
inline auto& pointPosition()
2022-09-05 01:56:29 +04:30
{
return dynPointStruct_.pointPosition();
2022-09-05 01:56:29 +04:30
}
inline auto& idHandler()
2022-09-05 01:56:29 +04:30
{
return idHandler_();
}
inline auto& shapeIndex()
{
return shapeIndex_;
}
2024-01-21 13:26:23 -08:00
public:
2022-09-05 01:56:29 +04:30
2024-01-21 13:26:23 -08:00
// type info
TypeInfo("particles");
explicit particles(systemControl& control);
inline const auto& dynPointStruct() const
{
return dynPointStruct_;
}
inline const pointStructure& pStruct() const
2024-01-21 13:26:23 -08:00
{
return dynPointStruct_;
}
inline const auto& simDomain() const
{
return dynPointStruct_.simDomain();
}
inline const auto& thisDomain() const
{
return dynPointStruct_.thisDomain();
}
2022-09-05 01:56:29 +04:30
inline const auto& extendedDomain() const
{
return dynPointStruct_.extendedDomain();
}
inline auto size() const
{
2024-01-21 13:26:23 -08:00
return dynPointStruct_.size();
2022-09-05 01:56:29 +04:30
}
inline auto capacity() const
{
2024-01-21 13:26:23 -08:00
return dynPointStruct_.capacity();
2022-09-05 01:56:29 +04:30
}
inline auto numActive() const
2022-09-05 01:56:29 +04:30
{
2024-01-21 13:26:23 -08:00
return dynPointStruct_.numActive();
2022-09-05 01:56:29 +04:30
}
inline bool isAllActive() const
2022-09-05 01:56:29 +04:30
{
2024-01-21 13:26:23 -08:00
return dynPointStruct_.isAllActive();
2022-09-05 01:56:29 +04:30
}
inline const auto& pointPosition() const
2024-01-21 13:26:23 -08:00
{
return dynPointStruct_.pointPosition();
2022-09-05 01:56:29 +04:30
}
inline const auto& velocity() const
2024-01-21 13:26:23 -08:00
{
return dynPointStruct_.velocity();
2022-09-05 01:56:29 +04:30
}
inline const auto& accelertion() const
2024-01-21 13:26:23 -08:00
{
2022-09-05 01:56:29 +04:30
return accelertion_;
}
inline auto& accelertion()
2024-01-21 13:26:23 -08:00
{
2022-09-05 01:56:29 +04:30
return accelertion_;
}
inline auto& contactForce()
2022-09-05 01:56:29 +04:30
{
return contactForce_;
}
inline const auto& contactForce() const
2022-09-05 01:56:29 +04:30
{
return contactForce_;
}
inline auto& contactTorque()
2022-09-05 01:56:29 +04:30
{
return contactTorque_;
}
inline const auto& contactTorque() const
2022-09-05 01:56:29 +04:30
{
return contactTorque_;
}
inline
uint maxId()const
{
return idHandler_().maxId();
}
bool beforeIteration() override;
2022-09-05 01:56:29 +04:30
bool iterate() override;
2022-09-05 01:56:29 +04:30
bool afterIteration() override;
2022-09-05 01:56:29 +04:30
virtual bool insertParticles(
const realx3Vector& position,
const wordVector& shapesNames,
const anyList& setVarList
) = 0;
2022-09-05 01:56:29 +04:30
virtual const uint32PointField_D& propertyId() const = 0;
2024-01-26 01:10:10 -08:00
virtual const realPointField_D& diameter() const = 0;
2022-09-05 01:56:29 +04:30
virtual const realPointField_D& mass() const = 0;
2022-09-05 01:56:29 +04:30
virtual realx3PointField_D& rAcceleration() = 0;
2022-09-05 01:56:29 +04:30
virtual const realx3PointField_D& rAcceleration() const = 0;
2022-09-05 01:56:29 +04:30
virtual const realPointField_D& boundingSphere() const = 0;
2022-09-05 01:56:29 +04:30
virtual word shapeTypeName() const = 0;
virtual const shape& getShapes() const = 0;
2022-09-05 01:56:29 +04:30
virtual void boundingSphereMinMax(real& minDiam, real& maxDiam) const = 0;
2022-09-05 01:56:29 +04:30
}; // particles
} // namespace pFlow
2022-09-05 01:56:29 +04:30
2022-12-10 01:32:54 +03:30
#endif //__particles_hpp__