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 virtual ~ContactModelMechanicalNull();
21        virtual void        copy(const ContactModel *) override { }
22        virtual ContactModelMechanicalNull *clone() const override { return NEW ContactModelMechanicalNull(); }
23        virtual QString     getName() const { return "null"; }
24        virtual void        setIndex(int i) { index_=i;}
25        virtual int         getIndex() const {return index_;}
26        virtual QString     getProperties() const { return QString(); }
27        virtual QVariant    getProperty(uint32 ,const IContact * =0) const {return QVariant();}
28        virtual bool        setProperty(uint32 ,const QVariant &,IContact * =0) {return false;}
29        virtual uint32        getMinorVersion() const;
30        virtual bool        validate(ContactModelMechanicalState *,const double &) {return false;}
31        virtual bool        endPropertyUpdated(const QString &,const IContactMechanical *) {return false;}
32        virtual bool        forceDisplacementLaw(ContactModelMechanicalState *,const double &) {return false;}
33        virtual double      getActivityDistance() const {return 0.0;}
34        virtual void        resetForcesAndMoments() { }
35        virtual void        setForce(const DVect &,IContact *) { }
36        virtual void        setArea(const double &) { }
37        virtual double      getArea() const { return 0.0; }
38
39    private:
40        static int index_;
41
42    };
43} // namespace itascaxd
44// 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() {}
44} // namespace itascaxd
45// EoF

Top