OOFEM 3.0
Loading...
Searching...
No Matches
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 - 2025 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
43namespace oofem {
44MMAContainingElementProjection :: MMAContainingElementProjection() : MaterialMappingAlgorithm()
45{ }
46
47void
48MMAContainingElementProjection :: __init(Domain *dold, IntArray &type, const FloatArray &coords, Set &elemSet, TimeStep *tStep, bool iCohesiveZoneGP)
49{
51 FloatArray jGpCoords;
52 double minDist = 1.e6;
53 Element *srcElem;
54
55 if ( ( srcElem = sl->giveElementContainingPoint(coords, elemSet) ) ) {
56 this->source = nullptr;
57 for ( auto &jGp: *srcElem->giveDefaultIntegrationRulePtr() ) {
58 if ( srcElem->computeGlobalCoordinates( jGpCoords, jGp->giveNaturalCoordinates() ) ) {
59 double dist = distance(coords, jGpCoords);
60 if ( dist < minDist ) {
61 minDist = dist;
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
75int
76MMAContainingElementProjection :: __mapVariable(FloatArray &answer, const FloatArray &coords,
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
87int
88MMAContainingElementProjection :: mapStatus(MaterialStatus &oStatus) const
89{
90 OOFEM_ERROR("mapStatus() is not implemented yet.")
91}
92} // end namespace oofem
SpatialLocalizer * giveSpatialLocalizer()
Definition domain.C:1255
virtual int computeGlobalCoordinates(FloatArray &answer, const FloatArray &lcoords)
Definition element.C:1225
virtual IntegrationRule * giveDefaultIntegrationRulePtr()
Definition element.h:886
virtual Element * giveElementContainingPoint(const FloatArray &coords, const IntArray *regionList=nullptr)=0
#define OOFEM_ERROR(...)
Definition error.h:79
double distance(const FloatArray &x, const FloatArray &y)

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011