1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
5 \\ / A nd | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
25 Virtual base class for cohesive law.
27 \*---------------------------------------------------------------------------*/
29 #include "cohesiveLaw.H"
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 defineTypeNameAndDebug(cohesiveLaw, 0);
36 defineRunTimeSelectionTable(cohesiveLaw, dictionary);
40 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
42 Foam::autoPtr<Foam::cohesiveLaw> Foam::cohesiveLaw::New
44 const word& cohesiveLawName,
45 const dictionary& dict
48 Info << "Selecting cohesive law: " << cohesiveLawName << endl;
50 dictionaryConstructorTable::iterator cstrIter =
51 dictionaryConstructorTablePtr_->find(cohesiveLawName);
53 if (cstrIter == dictionaryConstructorTablePtr_->end())
57 "cohesiveLaw::New(const word& cohesiveLawName, "
58 "const dictionary& dict)"
59 ) << "Unknown cohesive law " << cohesiveLawName
61 << "Valid cohesive laws are :" << endl
62 << dictionaryConstructorTablePtr_->toc()
66 return autoPtr<cohesiveLaw>(cstrIter()(cohesiveLawName, dict));
70 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
72 // Construct from components
73 Foam::cohesiveLaw::cohesiveLaw
75 const word& cohesiveLawName,
76 const dictionary& dict
79 cohesiveLawCoeffs_(dict.subDict(cohesiveLawName + "Coeffs")),
80 GIc_(cohesiveLawCoeffs_.lookup("GIc")),
81 sigmaMax_(cohesiveLawCoeffs_.lookup("sigmaMax"))
85 Foam::cohesiveLaw::cohesiveLaw
91 cohesiveLawCoeffs_(cl.cohesiveLawCoeffs_),
93 sigmaMax_(cl.sigmaMax_)
97 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
99 Foam::cohesiveLaw::~cohesiveLaw()
102 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
104 void Foam::cohesiveLaw::writeDict(Ostream& os) const
106 os.writeKeyword(word(type() + "Coeffs"))
107 << cohesiveLawCoeffs();
111 // ************************************************************************* //