44 logger(
DEBUG,
"BaseWall::BaseWall(const BaseWall &p) finished");
54 logger(
DEBUG,
"BaseWall::clear(), this function shouldn't be called");
102 logger(
ERROR,
"setIndSpecies called on a particle with no particle handler.\n"
103 "Therefore I can't request the given species from the species handler.\n"
104 " PartID = %",
getId());
133 if (fabs(denominator)>=1e-10)
136 if (t<1+1e-12&&t>-1e-12)
137 intersect = p0 + t * (p1-p0);
145 return Vec3D::dot(position-point,normal)<-1e-12;
155 Vec3D dPoint = point1-point0;
166 std::vector<Vec3D>::iterator firstIn=points.begin();
167 for (;firstIn!=points.end(); firstIn++) {
175 if (firstIn==points.end()) {
176 logger(
DEBUG,
"BaseWall::intersectVTK: all points out of wall");
181 std::vector<Vec3D>::iterator firstOut=firstIn+1;
182 for (;firstOut!=points.end(); firstOut++) {
189 if (firstOut==points.end()&&firstIn==points.begin()) {
190 logger(
DEBUG,
"BaseWall::intersectVTK: points completely in wall; removing points");
198 if (firstIn!=points.begin() || !
isInsideWallVTK(points.back(),normal,position)) {
201 if (firstOut-firstIn>2) {
202 logger(
DEBUG,
"BaseWall::intersectVTK: remove unnessesary points in the wall");
204 points.erase(firstIn+1,firstOut-1);
205 firstOut = firstIn+2;
210 if (firstOut==firstIn+1) {
211 logger(
DEBUG,
"BaseWall::intersectVTK: there is only one point in the wall, make it two");
213 unsigned in = firstIn-points.begin();
214 points.insert(firstIn+1,*firstIn);
215 firstIn = points.begin()+in;
216 firstOut = firstIn+2;
222 if (firstIn!=points.begin()) {
223 logger(
DEBUG,
"BaseWall::intersectVTK: move first point onto the surface of the wall");
226 logger(
DEBUG,
"BaseWall::intersectVTK: move first point (at the beginning of the list) onto the surface of the wall");
230 if (firstOut!=points.end()) {
231 logger(
DEBUG,
"BaseWall::intersectVTK: move second point onto the surface of the wall");
234 logger(
DEBUG,
"BaseWall::intersectVTK: move second point (at the end of the list) onto the surface of the wall");
239 logger(
DEBUG,
"BaseWall::intersectVTK: sequence starts and ends with a point in the wall");
242 for (firstIn=firstOut+1;firstIn!=points.end(); firstIn++) {
250 points.erase(firstIn+1,points.end());
251 points.erase(points.begin(),firstOut-1);
270 std::vector<BaseInteraction*> interactions;
279 interactions.push_back(c);
291 if (points.size()!=0) {
293 vtk.
points.insert(vtk.
points.end(), points.begin(), points.end());
296 std::vector<double> cell;
297 cell.reserve(vtk.
points.size()+1);
298 cell.push_back(vtk.
points.size()-1);
299 for (
unsigned i=vtk.
points.size()-points.size(); i<vtk.
points.size(); i++) {
Container to store all ParticleSpecies.
unsigned int getId() const
Returns the unique identifier of any particular object.
unsigned int getIndex() const
Returns the index of the object in the handler.
The DPMBase header includes quite a few header files, defining all the handlers, which are essential...
void setNormal(Vec3D normal)
Sets the normal vector between the two interacting objects.
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
void setOverlap(Mdouble overlap)
Set the overlap between the two interacting object.
virtual void writeVTK(VTKContainer &vtk) const
virtual MERCURY_DEPRECATED void clear()
A function that removes all data from this BaseWall, so sets handler_ to nullptr. ...
BaseInteraction * getInteraction(BaseInteractable *P, BaseInteractable *I, Mdouble timeStamp)
Returns the Interaction between the BaseInteractable's P and I.
void setIndSpecies(unsigned int indSpecies)
Define the species of this wall using the index of the species in the SpeciesHandler in this DPMBase...
virtual void setHandler(WallHandler *handler)
A function which sets the WallHandler for this BaseWall.
static void addToVTK(const std::vector< Vec3D > &points, VTKContainer &vtk)
void setContactPoint(Vec3D contactPoint)
Set the location of the contact point between the two interacting objects.
void intersectVTK(std::vector< Vec3D > &points, const Vec3D normal, const Vec3D position) const
static Mdouble dot(const Vec3D &a, const Vec3D &b)
Calculates the dot product of two Vec3D: .
void setDistance(Mdouble distance)
Sets the interaction distance between the two interacting objects.
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Stores information about interactions between two interactable objects; often particles but could be ...
virtual std::vector< BaseInteraction * > getInteractionWith(BaseParticle *p, Mdouble timeStamp, InteractionHandler *interactionHandler)
SpeciesHandler * getHandler() const
Returns the pointer to the handler to which this species belongs.
WallHandler * getHandler() const
A function which returns the WallHandler that handles this BaseWall.
void setSpecies(const ParticleSpecies *species)
Sets the species of this BaseInteractable.
virtual void read(std::istream &is)=0
Reads a BaseInteractable from an input stream.
virtual std::string getName() const =0
A purely virtual function.
virtual bool getDistanceAndNormal(const BaseParticle &P, Mdouble &distance, Vec3D &normal_return) const =0
Pure virtual function that computes the distance of a BaseParticle to this wall and returns the norma...
std::vector< std::vector< double > > triangleStrips
Container to store Interaction objects.
const Vec3D & getNormal() const
Gets the normal vector between the two interacting objects.
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
bool isInsideWallVTK(const Vec3D &point, const Vec3D &normal, const Vec3D &position) const
Mdouble getRadius() const
Returns the particle's radius_.
BaseWall()
Default constructor. It makes an empty BaseWall.
Mdouble getOverlap() const
Returns a Mdouble with the current overlap between the two interacting objects.
virtual void setIndSpecies(unsigned int indSpecies)
Sets the index of the Species of this BaseInteractable.
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Container to store all BaseWall.
std::vector< Vec3D > points
Defines the basic properties that a interactable object can have.
unsigned int getIndSpecies() const
Returns the index of the Species of this BaseInteractable.
virtual void write(std::ostream &os) const =0
Write a BaseInteractable to an output stream.
Implementation of a 3D vector (by Vitaliy).
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
void write(std::ostream &os) const
Function that writes a BaseWall to an output stream, usually a restart file.
void projectOntoWallVTK(Vec3D &point0, const Vec3D &point1, const Vec3D &normal, const Vec3D &position) const
bool getLinePlaneIntersect(Vec3D &intersect, const Vec3D &p0, const Vec3D &p1, const Vec3D &n, const Vec3D &p)
virtual ~BaseWall()
Default destructor.
void read(std::istream &is)
Function that reads a BaseWall from an input stream, usually a restart file.
void setSpecies(const ParticleSpecies *species)
Define the species of this wall.