56MMALeastSquareProjection :: ~MMALeastSquareProjection() { }
73 if ( !sourceElement ) {
79 if ( egt == EGT_line_1 ) {
81 }
else if ( ( egt == EGT_triangle_1 ) || ( egt == EGT_quad_1 ) ) {
96 sourceElement->
giveIPValue(dam, gp, IST_PrincipalDamageTensor, tStep);
114 while ( ( actualNumberOfPoints < minNumberOfPoints ) && ( nite <= 2 ) ) {
119 actualNumberOfPoints = 0;
120 for (
int i = 1; i <= neighborList.
giveSize(); i++ ) {
131 element->
giveIPValue(dam, gp, IST_PrincipalDamageTensor, tStep);
133 actualNumberOfPoints++;
135 }
else if ( ( state == 0 ) && ( dam.
computeNorm() < 1.e-3 ) ) {
136 actualNumberOfPoints++;
171#ifdef MMALSP_ONLY_CLOSEST_POINTS
174 FloatArray dist(actualNumberOfPoints), srcgpcoords;
177 if ( gpList == NULL ) {
181 for (
int ielem = 1; ielem <= patchList.
giveSize(); ielem++ ) {
184 for (
auto &srcgp: *iRule ) {
186 element->
giveIPValue(dam, srcgp, IST_PrincipalDamageTensor, tStep);
189 if ( ( ( state == 1 ) && (
norm(dam) > 1.e-3 ) ) || ( ( ( state == 0 ) &&
norm(dam) < 1.e-3 ) ) ) {
191 dist.at(npoints) =
distance(coords, srcgpcoords);
192 gpList [ npoints - 1 ] = srcgp;
197 dist.at(npoints) =
distance(coords, srcgpcoords);
198 gpList [ npoints - 1 ] = srcgp;
206 if ( npoints != actualNumberOfPoints ) {
215 double swap, minDist;
218 for (
int i = 1; i <= minNumberOfPoints; i++ ) {
219 minDist = dist.at(i);
222 for ( j = i + 1; j <= actualNumberOfPoints; j++ ) {
223 if ( dist.at(j) < minDist ) {
224 minDist = dist.at(j);
230 patchGPList.push_front(gpList [ minDistIndx - 1 ]);
232 dist.at(i) = dist.at(minDistIndx);
233 dist.at(minDistIndx) = swap;
234 srcgp = gpList [ i - 1 ];
235 gpList [ i - 1 ] = gpList [ minDistIndx - 1 ];
236 gpList [ minDistIndx - 1 ] = srcgp;
250 for (
int ielem = 1; ielem <= patchList.
giveSize(); ielem++ ) {
287 }
else if ( size < neq ) {
291 element = srcgp->giveElement();
302 for (
int j = 1; j <= neq; j++ ) {
303 for (
int k = 1; k <= nval; k++ ) {
304 rhs.
at(j, k) += P.
at(j) * ipVal.
at(k);
307 for (
int k = 1; k <= neq; k++ ) {
308 a.
at(j, k) += P.
at(j) * P.
at(k);
325 for ( j = 1; j <= neq; j++ ) {
326 for ( k = 1; k <= nval; k++ ) {
327 if ( fabs( tmp.
at(j, k) - rhs.
at(j, k) ) > 1.e-3 ) {
341 for (
int i = 1; i <= nval; i++ ) {
342 for (
int j = 1; j <= neq; j++ ) {
343 answer.
at(i) += P.
at(j) * x.
at(j, i);
383 P.
at(2) = coords.
at(1);
384 P.
at(3) = coords.
at(2);
385 P.
at(4) = coords.
at(1) * coords.
at(2);
386 P.
at(5) = coords.
at(1) * coords.
at(1);
387 P.
at(6) = coords.
at(2) * coords.
at(2);
390 P.
at(1) = coords.
at(1) * coords.
at(1);
391 P.
at(2) = coords.
at(1);
#define REGISTER_MaterialMappingAlgorithm(class, type)
void giveElementNeighbourList(IntArray &answer, const IntArray &elemList)
SpatialLocalizer * giveSpatialLocalizer()
ConnectivityTable * giveConnectivityTable()
virtual int computeGlobalCoordinates(FloatArray &answer, const FloatArray &lcoords)
virtual IntegrationRule * giveDefaultIntegrationRulePtr()
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
virtual Element_Geometry_Type giveGeometryType() const =0
double computeNorm() const
Index giveSize() const
Returns the size of receiver.
void zero()
Zeroes all coefficients of receiver.
void subtract(const FloatArray &src)
void resize(Index rows, Index cols)
void beProductOf(const FloatMatrix &a, const FloatMatrix &b)
void zero()
Zeroes all coefficient of receiver.
double at(std::size_t i, std::size_t j) const
bool solveForRhs(const FloatArray &b, FloatArray &answer, bool transpose=false)
Element * giveElement()
Returns corresponding element to receiver.
void followedBy(const IntArray &b, int allocChunk=0)
int giveNumberOfIntegrationPoints() const
int regionFilter
If set, then only IP in the same region are taken into account.
std ::list< GaussPoint * > patchGPList
List of Gp participating in patch.
MMALeastSquareProjectionPatchType patchType
Type of patch.
int giveNumberOfUnknownPolynomialCoefficients(MMALeastSquareProjectionPatchType regType)
int stateFilter
If set, then only IP in the neighbourhood with same state can be used to interpolate the values.
Domain * patchDomain
Patch domain.
void computePolynomialTerms(FloatArray &P, const FloatArray &coords, MMALeastSquareProjectionPatchType type)
MaterialMappingAlgorithm()
Constructor.
bool hasElement(int elem) const
Return True if given element is contained.
virtual GaussPoint * giveClosestIP(const FloatArray &coords, int region, bool iCohesiveZoneGP=false)=0
virtual Element * giveElementContainingPoint(const FloatArray &coords, const IntArray *regionList=nullptr)=0
#define _IFT_MMALeastSquareProjection_statefilter
#define _IFT_MMALeastSquareProjection_regionfilter
double norm(const FloatArray &x)
MMALeastSquareProjectionPatchType
double distance(const FloatArray &x, const FloatArray &y)