OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
mmacontainingelementprojection.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 
36 #include "spatiallocalizer.h"
37 #include "domain.h"
38 #include "element.h"
39 #include "material.h"
40 #include "integrationrule.h"
41 #include "gausspoint.h"
42 
43 namespace oofem {
45 { }
46 
47 void
48 MMAContainingElementProjection :: __init(Domain *dold, IntArray &type, const FloatArray &coords, Set &elemSet, TimeStep *tStep, bool iCohesiveZoneGP)
49 {
51  FloatArray jGpCoords;
52  double distance, minDist = 1.e6;
53  Element *srcElem;
54 
55  if ( ( srcElem = sl->giveElementContainingPoint(coords, elemSet) ) ) {
56  this->source = NULL;
57  for ( GaussPoint *jGp: *srcElem->giveDefaultIntegrationRulePtr() ) {
58  if ( srcElem->computeGlobalCoordinates( jGpCoords, jGp->giveNaturalCoordinates() ) ) {
59  distance = coords.distance(jGpCoords);
60  if ( distance < minDist ) {
61  minDist = distance;
62  this->source = jGp;
63  }
64  }
65  }
66 
67  if ( !source ) {
68  OOFEM_ERROR("no suitable source found");
69  }
70  } else {
71  OOFEM_ERROR("No suitable element found");
72  }
73 }
74 
75 int
77  InternalStateType type, TimeStep *tStep)
78 {
79  if ( source ) {
80  source->giveMaterial()->giveIPValue(answer, source, type, tStep);
81  return 1;
82  }
83 
84  return 0;
85 }
86 
87 int
89 {
90  OOFEM_ERROR("mapStatus() is not implemented yet.")
91 
92  return 0;
93 }
94 } // end namespace oofem
The base class for all spatial localizers.
InternalStateType
Type representing the physical meaning of element or constitutive model internal variable.
Class and object Domain.
Definition: domain.h:115
virtual IntegrationRule * giveDefaultIntegrationRulePtr()
Access method for default integration rule.
Definition: element.h:822
Abstract base class for all finite elements.
Definition: element.h:145
The class representing the general material model mapping algorithm.
Class implementing an array of integers.
Definition: intarray.h:61
double distance(const FloatArray &x) const
Computes the distance between position represented by receiver and position given as parameter...
Definition: floatarray.C:489
#define OOFEM_ERROR(...)
Definition: error.h:61
Set of elements, boundaries, edges and/or nodes.
Definition: set.h:66
SpatialLocalizer * giveSpatialLocalizer()
Returns receiver&#39;s associated spatial localizer.
Definition: domain.C:1184
Material * giveMaterial()
Returns reference to material associated to related element of receiver.
Definition: gausspoint.h:197
virtual Element * giveElementContainingPoint(const FloatArray &coords, const IntArray *regionList=NULL)=0
Returns the element, containing given point and belonging to one of the region in region list...
Abstract base class representing a material status information.
Definition: matstatus.h:84
Class representing vector of real numbers.
Definition: floatarray.h:82
virtual int mapStatus(MaterialStatus &oStatus) const
Initializes receiver according to object description stored in input record.
virtual void __init(Domain *dold, IntArray &type, const FloatArray &coords, Set &sourceElemSet, TimeStep *tStep, bool iCohesiveZoneGP=false)
Initializes the receiver state before mapping.
the oofem namespace is to define a context or scope in which all oofem names are defined.
virtual int __mapVariable(FloatArray &answer, const FloatArray &coords, InternalStateType type, TimeStep *tStep)
Maps and update the unknown of given type from old mesh oldd to new mesh to which gp belongs to...
Class representing integration point in finite element program.
Definition: gausspoint.h:93
Class representing solution step.
Definition: timestep.h:80
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
Returns the integration point corresponding value in Reduced form.
Definition: material.C:142
virtual int computeGlobalCoordinates(FloatArray &answer, const FloatArray &lcoords)
Computes the global coordinates from given element&#39;s local coordinates.
Definition: element.C:1207

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:30 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011