MercuryDPM  Alpha
 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-2014, 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 
30 {
33 #ifdef DEBUG_CONSTRUCTOR
34  std::cout<<"ReversibleAdhesiveSpecies::ReversibleAdhesiveSpecies() finished"<<std::endl;
35 #endif
36 }
37 
42 {
45 #ifdef DEBUG_CONSTRUCTOR
46  std::cout<<"ReversibleAdhesiveSpecies::ReversibleAdhesiveSpecies(const ReversibleAdhesiveSpecies &p) finished"<<std::endl;
47 #endif
48 }
49 
51 {
52 #ifdef DEBUG_DESTRUCTOR
53  std::cout<<"ReversibleAdhesiveSpecies::~ReversibleAdhesiveSpecies() finished"<<std::endl;
54 #endif
55 }
56 
60 void ReversibleAdhesiveSpecies::write(std::ostream& os) const
61  {
62  os << " adhesionForceMax " << adhesionForceMax_;
63  os << " adhesionStiffness " << adhesionStiffness_;
64 }
65 
69 void ReversibleAdhesiveSpecies::read(std::istream& is)
70 {
71  std::string dummy;
72  is >> dummy >> adhesionForceMax_;
73  is >> dummy >> adhesionStiffness_;
74 }
75 
80 {
81  return "ReversibleAdhesive";
82 }
83 
90 {
93 }
94 
97 {
98  if (adhesionStiffness_ != 0.0)
100  else if (adhesionForceMax_==0.0) {
101  return 0.0;
102  } else {
103  logger(ERROR, "ReversibleAdhesiveSpecies::getInteractionDistance(): adhesionStiffness cannot be zero");
104  return 0.0;
105  }
106 }
107 
110 {
111  if (new_k0 >= 0)
112  adhesionStiffness_ = new_k0;
113  else
114  {
115  std::cerr << "Error in setAdhesionStiffness" << std::endl;
116  exit(-1);
117  }
118 }
121 {
122  return adhesionStiffness_;
123 }
124 
127 {
128  if (new_f0 >= 0)
129  adhesionForceMax_ = new_f0;
130  else
131  {
132  std::cerr << "Error in setBondForceMax" << std::endl;
133  exit(-1);
134  }
135 }
138 {
139  return adhesionForceMax_;
140 }
ReversibleAdhesiveSpecies()
The default constructor.
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Mdouble getAdhesionForceMax() const
Allows the spring constant to be accessed.
void setAdhesionStiffness(Mdouble new_k0)
Allows the spring constant to be changed.
double Mdouble
ReversibleAdhesiveSpecies contains the parameters used to describe a linear reversible short-range fo...
Mdouble getInteractionDistance() const
returns the largest separation distance at which adhesive short-range forces can occur.
Mdouble average(Mdouble a, Mdouble b)
defines the average of two variables by the harmonic mean.
Definition: BaseSpecies.cc:85
Mdouble adhesionStiffness_
stiffness of linear adhesion force
virtual ~ReversibleAdhesiveSpecies()
The default constructor.
void mix(ReversibleAdhesiveSpecies *const S, ReversibleAdhesiveSpecies *const T)
creates default values for mixed species
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 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.