void Sieve::SetUp(void) { #ifdef PRINT std::cout << "calculating factor base bound" << std::endl; CalculateB(); std::cout << "bound = " << B << std::endl; std::cout << "creating factor base" << std::endl; CreateFactorBase(); std::cout << "factor base length = " << factorbase.size() << std::endl; std::cout << "calculating offsets" << std::endl; CalculateOffsets2(); std::cout << offsets.size() << " offsets found" << std::endl; #endif #ifndef PRINT CalculateB(); CreateFactorBase(); CalculateOffsets2(); #endif numsmooth = 0; numtried = 0; numsmoothrequired = factorbase.size() + NUMEXTRA; matrixptr = new bitmatrix(factorbase.size(), numsmoothrequired); }
void TotalLagrangian::CalculateAll( MatrixType& rLeftHandSideMatrix, VectorType& rRightHandSideVector, ProcessInfo& rCurrentProcessInfo, bool CalculateStiffnessMatrixFlag, bool CalculateResidualVectorFlag ) { KRATOS_TRY const unsigned int number_of_nodes = GetGeometry().size(); const unsigned int dim = GetGeometry().WorkingSpaceDimension(); unsigned int StrainSize; if ( dim == 2 ) StrainSize = 3; else StrainSize = 6; Matrix B( StrainSize, number_of_nodes * dim ); Matrix F( dim, dim ); Matrix D( StrainSize, StrainSize ); Matrix C( dim, dim ); Vector StrainVector( StrainSize ); Vector StressVector( StrainSize ); Matrix DN_DX( number_of_nodes, dim ); //resizing as needed the LHS unsigned int MatSize = number_of_nodes * dim; if ( CalculateStiffnessMatrixFlag == true ) //calculation of the matrix is required { if ( rLeftHandSideMatrix.size1() != MatSize ) rLeftHandSideMatrix.resize( MatSize, MatSize, false ); noalias( rLeftHandSideMatrix ) = ZeroMatrix( MatSize, MatSize ); //resetting LHS } //resizing as needed the RHS if ( CalculateResidualVectorFlag == true ) //calculation of the matrix is required { if ( rRightHandSideVector.size() != MatSize ) rRightHandSideVector.resize( MatSize, false ); rRightHandSideVector = ZeroVector( MatSize ); //resetting RHS } //reading integration points and local gradients const GeometryType::IntegrationPointsArrayType& integration_points = GetGeometry().IntegrationPoints( mThisIntegrationMethod ); const GeometryType::ShapeFunctionsGradientsType& DN_De = GetGeometry().ShapeFunctionsLocalGradients( mThisIntegrationMethod ); const Matrix& Ncontainer = GetGeometry().ShapeFunctionsValues( mThisIntegrationMethod ); //calculating actual jacobian GeometryType::JacobiansType J; GetGeometry().Jacobian( J ); //KRATOS_WATCH(J) //auxiliary terms Vector BodyForce; for ( unsigned int PointNumber = 0; PointNumber < integration_points.size(); PointNumber++ ) { //Calculating the cartesian derivatives (it is avoided storing them to minimize storage) noalias( DN_DX ) = prod( DN_De[PointNumber], mInvJ0[PointNumber] ); //deformation gradient noalias( F ) = prod( J[PointNumber], mInvJ0[PointNumber] ); //strain calculation noalias( C ) = prod( trans( F ), F ); CalculateStrain( C, StrainVector ); Comprobate_State_Vector( StrainVector ); mConstitutiveLawVector[PointNumber]->CalculateMaterialResponse( StrainVector, F, StressVector, D, rCurrentProcessInfo, GetProperties(), GetGeometry(), row( Ncontainer, PointNumber ), true, CalculateStiffnessMatrixFlag, true ); //calculating operator B CalculateB( B, F, DN_DX, StrainVector.size() ); //calculating weights for integration on the reference configuration double IntToReferenceWeight = integration_points[PointNumber].Weight() * mDetJ0[PointNumber]; if ( dim == 2 ) IntToReferenceWeight *= GetProperties()[THICKNESS]; if ( CalculateStiffnessMatrixFlag == true ) //calculation of the matrix is required { //contributions to stiffness matrix calculated on the reference config noalias( rLeftHandSideMatrix ) += prod( trans( B ), ( IntToReferenceWeight ) * Matrix( prod( D, B ) ) ); //to be optimized to remove the temporary CalculateAndAddKg( rLeftHandSideMatrix, DN_DX, StressVector, IntToReferenceWeight ); } if ( CalculateResidualVectorFlag == true ) //calculation of the matrix is required { //contribution to external forces BodyForce = GetProperties()[BODY_FORCE]; // operation performed: rRightHandSideVector += ExtForce*IntToReferenceWeight CalculateAndAdd_ExtForceContribution( row( Ncontainer, PointNumber ), rCurrentProcessInfo, BodyForce, rRightHandSideVector, IntToReferenceWeight ); // operation performed: rRightHandSideVector -= IntForce*IntToReferenceWeight noalias( rRightHandSideVector ) -= IntToReferenceWeight * prod( trans( B ), StressVector ); } } KRATOS_CATCH( "" ) }