OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
contactmanager.C
Go to the documentation of this file.
1 /*
2  *
3  * ##### ##### ###### ###### ### ###
4  * ## ## ## ## ## ## ## ### ##
5  * ## ## ## ## #### #### ## # ##
6  * ## ## ## ## ## ## ## ##
7  * ## ## ## ## ## ## ## ##
8  * ##### ##### ## ###### ## ##
9  *
10  *
11  * OOFEM : Object Oriented Finite Element Code
12  *
13  * Copyright (C) 1993 - 2013 Borek Patzak
14  *
15  *
16  *
17  * Czech Technical University, Faculty of Civil Engineering,
18  * Department of Structural Mechanics, 166 29 Prague, Czech Republic
19  *
20  * This library is free software; you can redistribute it and/or
21  * modify it under the terms of the GNU Lesser General Public
22  * License as published by the Free Software Foundation; either
23  * version 2.1 of the License, or (at your option) any later version.
24  *
25  * This program is distributed in the hope that it will be useful,
26  * but WITHOUT ANY WARRANTY; without even the implied warranty of
27  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28  * Lesser General Public License for more details.
29  *
30  * You should have received a copy of the GNU Lesser General Public
31  * License along with this library; if not, write to the Free Software
32  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33  */
34 
35 #include "contact/contactmanager.h"
37 #include "classfactory.h"
38 #include "numericalcmpn.h"
39 #include "error.h"
40 
41 namespace oofem {
43 
45 {
46  this->domain = domain;
47  numberOfContactDefinitions = -1;
48 }
49 
51 {
52 }
53 
54 
57 {
58 
59  IRResultType result; // Required by IR_GIVE_FIELD macro
60 
63 
64 
66 #if 0
67  for ( int i = 1; i <= numberOfContactDefinitions; i++ ) {
68  std::string name;
69  result = ir->giveRecordKeywordField(name);
70  this->contactDefinitionList[i-1] = new ContactDefinition(this);
71  this->contactDefinitionList[i-1] = classFactory.createContactDefinition( name.c_str(), this );
72  }
73 #endif
74 
75  return IRRT_OK;
76 }
77 
78 
79 int
81 {
82  IRResultType result = IRRT_OK; // Required by IR_GIVE_FIELD macro
83  std :: string name;
84 
85  // Create and instantiate contact definitions
86  for ( int i = 1; i <= this->giveNumberOfContactDefinitions(); i++ ) {
88  result = ir->giveRecordKeywordField(name);
89  this->contactDefinitionList[i-1].reset( classFactory.createContactDefinition( name.c_str(), this ) );
90  if ( this->contactDefinitionList[i-1] ) {
91  this->contactDefinitionList[i-1]->initializeFrom(ir);
92  this->contactDefinitionList[i-1]->instanciateYourself(dr);
93  } else {
94  OOFEM_ERROR("Failed to create contact definition (%s)", name.c_str() );
95  }
96  }
97 
98  return result;
99 }
100 
101 
102 void
104  const UnknownNumberingScheme &s, Domain *domain, FloatArray *eNorms)
105 {
106  if ( type == InternalForcesVector) {
107  //printf("\n Add forces due to contact... \n");
108  for ( auto &cDef : contactDefinitionList ) {
109  cDef->computeContactForces(answer, tStep, mode, s, domain, eNorms);
110  }
111  }
112 }
113 
114 
115 void
117  CharType type, const UnknownNumberingScheme &r_s, const UnknownNumberingScheme &c_s)
118 {
119  if ( type == TangentStiffnessMatrix ) {
120  //printf("\n Add tangents due to contact... \n");
121  for ( auto &cDef : contactDefinitionList ) {
122  cDef->computeContactTangent(answer, tStep, r_s, c_s);
123  }
124  }
125 }
126 
127 
128 void
130 {
131  // Creates new dofs contacts and appends them to the dof managers
132  for ( auto &cDef : contactDefinitionList ) {
133  cDef->createContactDofs();
134  }
135 }
136 
137 }
ContactDefinition * createContactDefinition(const char *name, ContactManager *cMan)
Definition: classfactory.C:396
Class and object Domain.
Definition: domain.h:115
Base class for all matrices stored in sparse format.
Definition: sparsemtrx.h:60
ValueModeType
Type representing the mode of UnknownType or CharType, or similar types.
Definition: valuemodetype.h:78
#define _IFT_ContactManager_NumberOfContactDefinitions
Class representing the abstraction for input data source.
Definition: datareader.h:50
std::vector< std::unique_ptr< ContactDefinition > > contactDefinitionList
int giveNumberOfContactDefinitions() const
virtual IRResultType giveRecordKeywordField(std::string &answer, int &value)=0
Reads the record id field (type of record) and its corresponding number.
void assembleVectorFromContacts(FloatArray &answer, TimeStep *tStep, CharType type, ValueModeType mode, const UnknownNumberingScheme &s, Domain *domain, FloatArray *eNorms=NULL)
#define OOFEM_ERROR(...)
Definition: error.h:61
Abstract base class allowing to control the way, how equations are assigned to individual DOFs...
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
virtual ~ContactManager()
Destructor.
This class manages all the contacts in a domain.
virtual InputRecord * giveInputRecord(InputRecordType irType, int recordId)=0
Returns input record corresponding to given InputRecordType value and its record_id.
Class representing vector of real numbers.
Definition: floatarray.h:82
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
CharType
Definition: chartype.h:87
Class representing the general Input Record.
Definition: inputrecord.h:101
virtual int instanciateYourself(DataReader &dr)
ClassFactory & classFactory
Definition: classfactory.C:59
This class manages a particular contact definition.
REGISTER_ContactManager(ContactManager)
void assembleTangentFromContacts(SparseMtrx &answer, TimeStep *tStep, CharType type, const UnknownNumberingScheme &r_s, const UnknownNumberingScheme &c_s)
the oofem namespace is to define a context or scope in which all oofem names are defined.
#define IR_GIVE_FIELD(__ir, __value, __id)
Macro facilitating the use of input record reading methods.
Definition: inputrecord.h:69
Class representing solution step.
Definition: timestep.h:80

This page is part of the OOFEM documentation. Copyright (c) 2011 Borek Patzak
Project e-mail: info@oofem.org
Generated at Tue Jan 2 2018 20:07:28 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011