Null Contact Model Implementation

See this page for the documentation of this contact model.

contactmodelmechanicalnull.h

 1#pragma once
 2// contactmodelmechanicalnull.h
 3
 4#include "contactmodel/src/contactmodelmechanical.h"
 5
 6#ifdef NULL_LIB
 7#  define NULL_EXPORT EXPORT_TAG
 8#elif defined(NO_MODEL_IMPORT)
 9#  define NULL_EXPORT
10#else
11#  define NULL_EXPORT IMPORT_TAG
12#endif
13
14namespace cmodelsxd {
15    using namespace itasca;
16
17    class  ContactModelMechanicalNull : public ContactModelMechanical {
18    public:
19        NULL_EXPORT ContactModelMechanicalNull();
20        NULL_EXPORT ContactModelMechanicalNull(const ContactModelMechanicalNull &) noexcept;
21        NULL_EXPORT const ContactModelMechanicalNull & operator=(const ContactModelMechanicalNull &);
22        NULL_EXPORT void   addToStorage(poly::vector<ContactModelMechanical> *s,int ww = -1) override;
23        NULL_EXPORT virtual ~ContactModelMechanicalNull();
24        virtual void        copy(const ContactModel *) override { }
25        virtual ContactModelMechanicalNull *clone() const override { return NEW ContactModelMechanicalNull(); }
26        virtual QString     getName() const { return "null"; }
27        virtual void        setIndex(int i) { index_=i;}
28        virtual int         getIndex() const {return index_;}
29        virtual QString     getProperties() const { return QString(); }
30        virtual QVariant    getProperty(uint32 ,const IContact * =0) const {return QVariant();}
31        virtual bool        setProperty(uint32 ,const QVariant &,IContact * =0) {return false;}
32        virtual uint32        getMinorVersion() const;
33        virtual bool        validate(ContactModelMechanicalState *,const double &) {return false;}
34        virtual bool        endPropertyUpdated(const QString &,const IContactMechanical *) {return false;}
35        virtual bool        forceDisplacementLaw(ContactModelMechanicalState *,const double &) {return false;}
36        virtual double      getActivityDistance() const {return 0.0;}
37        virtual void        resetForcesAndMoments() { }
38        virtual void        setForce(const DVect &,IContact *) { }
39        virtual void        setArea(const double &) { }
40        virtual double      getArea() const { return 0.0; }
41
42    private:
43        static int index_;
44
45    };
46} // namespace itascaxd
47// EoF

Top

contactmodelmechanicalnull.cpp

 1// contactmodelmechanicalnull.cpp
 2#include "contactmodelmechanicalnull.h"
 3#include "../version.txt"
 4
 5#ifdef NULL_LIB
 6#ifdef _WIN32
 7  int __stdcall DllMain(void *,unsigned, void *)
 8  {
 9    return 1;
10  }
11#endif
12
13  extern "C" EXPORT_TAG const char *getName() 
14  {
15#if DIM==3
16    return "contactmodelmechanical3dnull";
17#else
18    return "contactmodelmechanical2dnull";
19#endif
20  }
21
22  extern "C" EXPORT_TAG unsigned getMajorVersion()
23  {
24    return MAJOR_VERSION;
25  }
26
27  extern "C" EXPORT_TAG unsigned getMinorVersion()
28  {
29    return MINOR_VERSION;
30  }
31
32  extern "C" EXPORT_TAG void *createInstance() 
33  {
34    cmodelsxd::ContactModelMechanicalNull *m = NEW cmodelsxd::ContactModelMechanicalNull();
35    return (void *)m;
36  }
37#endif // NULL_LIB
38
39namespace cmodelsxd {
40    int ContactModelMechanicalNull::index_ = -1;
41    uint32 ContactModelMechanicalNull::getMinorVersion() const { return MINOR_VERSION; }
42    ContactModelMechanicalNull::ContactModelMechanicalNull() {}
43    ContactModelMechanicalNull::ContactModelMechanicalNull(const ContactModelMechanicalNull &m) noexcept {
44        this->copy(&m);
45    }
46    
47    const ContactModelMechanicalNull & ContactModelMechanicalNull::operator=(const ContactModelMechanicalNull &m) {
48        this->copy(&m);
49        return *this;
50    }
51    
52    void ContactModelMechanicalNull::addToStorage(poly::vector<ContactModelMechanical> *s,int ww) { 
53        s->addToStorage<ContactModelMechanicalNull>(*this,ww);
54    }
55    ContactModelMechanicalNull::~ContactModelMechanicalNull() {}
56} // namespace itascaxd
57// EoF

Top