MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ReversibleAdhesiveSpecies.cc
Go to the documentation of this file.
1 //Copyright (c) 2013-2020, The MercuryDPM Developers Team. All rights reserved.
2 //For the list of developers, see <http://www.MercuryDPM.org/Team>.
3 //
4 //Redistribution and use in source and binary forms, with or without
5 //modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name MercuryDPM nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 //DISCLAIMED. IN NO EVENT SHALL THE MERCURYDPM DEVELOPERS TEAM BE LIABLE FOR ANY
19 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
27 #include "Logger.h"
28 #include "Species/BaseSpecies.h"
29 
31 {
34  //interaction distance not yet determined
35 #ifdef DEBUG_CONSTRUCTOR
36  std::cout<<"ReversibleAdhesiveSpecies::ReversibleAdhesiveSpecies() finished"<<std::endl;
37 #endif
38 }
39 
44 {
47 #ifdef DEBUG_CONSTRUCTOR
48  std::cout<<"ReversibleAdhesiveSpecies::ReversibleAdhesiveSpecies(const ReversibleAdhesiveSpecies &p) finished"<<std::endl;
49 #endif
50 }
51 
53 {
54 #ifdef DEBUG_DESTRUCTOR
55  std::cout<<"ReversibleAdhesiveSpecies::~ReversibleAdhesiveSpecies() finished"<<std::endl;
56 #endif
57 }
58 
62 void ReversibleAdhesiveSpecies::write(std::ostream& os) const
63 {
64  os << " adhesionForceMax " << adhesionForceMax_;
65  os << " adhesionStiffness " << adhesionStiffness_;
66 }
67 
71 void ReversibleAdhesiveSpecies::read(std::istream& is)
72 {
73  std::string dummy;
74  is >> dummy >> adhesionForceMax_;
75  is >> dummy >> adhesionStiffness_;
76 }
77 
82 {
83  return "ReversibleAdhesive";
84 }
85 
92 {
95 }
96 
99 {
100  logger.assert(adhesionStiffness_ != 0.0,"ReversibleAdhesiveSpecies::getInteractionDistance(): adhesionStiffness cannot be zero");
102 }
103 
106 {
107  logger.assert(adhesionStiffness >= 0,"Error in setAdhesionStiffness");
108  adhesionStiffness_ = adhesionStiffness;
110 }
111 
114 {
115  return adhesionStiffness_;
116 }
117 
120 {
121  logger.assert(adhesionForceMax >= 0,"Error in setAdhesionForceMax");
122  adhesionForceMax_ = adhesionForceMax;
124 }
125 
128 {
129  return adhesionForceMax_;
130 }
ReversibleAdhesiveSpecies()
The default constructor.
BaseSpecies * getBaseSpecies() const
Definition: BaseForce.h:35
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
double Mdouble
Definition: GeneralDefine.h:34
Mdouble getAdhesionForceMax() const
Allows the spring constant to be accessed.
void setAdhesionStiffness(Mdouble new_k0)
Allows the spring constant to be changed.
void setInteractionDistance(Mdouble interactionDistance)
Sets BaseSpecies::interactionDistance_.
Definition: BaseSpecies.cc:156
ReversibleAdhesiveSpecies contains the parameters used to describe a linear reversible short-range fo...
void setInteractionDistance()
returns the largest separation distance at which adhesive short-range forces can occur.
static Mdouble average(Mdouble a, Mdouble b)
Returns the harmonic mean of two variables.
Definition: BaseSpecies.cc:110
Mdouble adhesionStiffness_
stiffness of linear adhesion force
~ReversibleAdhesiveSpecies()
The default constructor.
Mdouble adhesionForceMax_
adhesion force at zero overlap
void read(std::istream &is)
Reads the species properties from an input stream.
Mdouble getAdhesionStiffness() const
Allows the spring constant to be accessed.
void mix(ReversibleAdhesiveSpecies *S, ReversibleAdhesiveSpecies *T)
creates default values for mixed species
void write(std::ostream &os) const
Writes the species properties to an output stream.
std::string getBaseName() const
Used in Species::getName to obtain a unique name for each Species.
void setAdhesionForceMax(Mdouble new_f0)
Allows the spring constant to be changed.