本文整理汇总了C++中GaussPoint::giveGlobalCoordinates方法的典型用法代码示例。如果您正苦于以下问题:C++ GaussPoint::giveGlobalCoordinates方法的具体用法?C++ GaussPoint::giveGlobalCoordinates怎么用?C++ GaussPoint::giveGlobalCoordinates使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GaussPoint
的用法示例。
在下文中一共展示了GaussPoint::giveGlobalCoordinates方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: KZero
void PrescribedGradientBCWeak :: assembleGPContrib(SparseMtrx &answer, TimeStep *tStep,
CharType type, const UnknownNumberingScheme &r_s, const UnknownNumberingScheme &c_s, TracSegArray &iEl, GaussPoint &iGP)
{
SpatialLocalizer *localizer = domain->giveSpatialLocalizer();
///////////////
// Gamma_plus
FloatMatrix contrib;
assembleTangentGPContributionNew(contrib, iEl, iGP, -1.0, iGP.giveGlobalCoordinates());
// Compute vector of traction unknowns
FloatArray tracUnknowns;
iEl.mFirstNode->giveUnknownVector(tracUnknowns, giveTracDofIDs(), VM_Total, tStep);
IntArray trac_rows;
iEl.giveTractionLocationArray(trac_rows, type, r_s);
FloatArray dispElLocCoord, closestPoint;
Element *dispEl = localizer->giveElementClosestToPoint(dispElLocCoord, closestPoint, iGP.giveGlobalCoordinates() );
IntArray disp_cols;
dispEl->giveLocationArray(disp_cols, c_s);
answer.assemble(trac_rows, disp_cols, contrib);
FloatMatrix contribT;
contribT.beTranspositionOf(contrib);
answer.assemble(disp_cols, trac_rows, contribT);
///////////////
// Gamma_minus
contrib.clear();
FloatArray xMinus;
this->giveMirroredPointOnGammaMinus(xMinus, iGP.giveGlobalCoordinates() );
assembleTangentGPContributionNew(contrib, iEl, iGP, 1.0, xMinus);
// Compute vector of traction unknowns
tracUnknowns.clear();
iEl.mFirstNode->giveUnknownVector(tracUnknowns, giveTracDofIDs(), VM_Total, tStep);
trac_rows.clear();
iEl.giveTractionLocationArray(trac_rows, type, r_s);
dispElLocCoord.clear(); closestPoint.clear();
dispEl = localizer->giveElementClosestToPoint(dispElLocCoord, closestPoint, xMinus );
disp_cols.clear();
dispEl->giveLocationArray(disp_cols, c_s);
answer.assemble(trac_rows, disp_cols, contrib);
contribT.clear();
contribT.beTranspositionOf(contrib);
answer.assemble(disp_cols, trac_rows, contribT);
// Assemble zeros on diagonal (required by PETSc solver)
FloatMatrix KZero(1,1);
KZero.zero();
for( int i : trac_rows) {
answer.assemble(IntArray({i}), IntArray({i}), KZero);
}
}
示例2: line
std::vector<std::unique_ptr<EnrichmentItem>> NCPrincipalStress::nucleateEnrichmentItems() {
SpatialLocalizer *octree = this->mpDomain->giveSpatialLocalizer();
XfemManager *xMan = mpDomain->giveXfemManager();
std::vector<std::unique_ptr<EnrichmentItem>> eiList;
// Center coordinates of newly inserted cracks
std::vector<FloatArray> center_coord_inserted_cracks;
// Loop over all elements and all bulk GP.
for(auto &el : mpDomain->giveElements() ) {
int numIR = el->giveNumberOfIntegrationRules();
int csNum = el->giveCrossSection()->giveNumber();
if(csNum == mCrossSectionInd || true) {
for(int irInd = 0; irInd < numIR; irInd++) {
IntegrationRule *ir = el->giveIntegrationRule(irInd);
int numGP = ir->giveNumberOfIntegrationPoints();
for(int gpInd = 0; gpInd < numGP; gpInd++) {
GaussPoint *gp = ir->getIntegrationPoint(gpInd);
// int csNum = gp->giveCrossSection()->giveNumber();
// printf("csNum: %d\n", csNum);
StructuralMaterialStatus *ms = dynamic_cast<StructuralMaterialStatus*>(gp->giveMaterialStatus());
if(ms != NULL) {
const FloatArray &stress = ms->giveTempStressVector();
FloatArray principalVals;
FloatMatrix principalDirs;
StructuralMaterial::computePrincipalValDir(principalVals, principalDirs, stress, principal_stress);
if(principalVals[0] > mStressThreshold) {
// printf("\nFound GP with stress above threshold.\n");
// printf("principalVals: "); principalVals.printYourself();
FloatArray crackNormal;
crackNormal.beColumnOf(principalDirs, 1);
// printf("crackNormal: "); crackNormal.printYourself();
FloatArray crackTangent = {-crackNormal(1), crackNormal(0)};
crackTangent.normalize();
// printf("crackTangent: "); crackTangent.printYourself();
// Create geometry
FloatArray pc = {gp->giveGlobalCoordinates()(0), gp->giveGlobalCoordinates()(1)};
// printf("Global coord: "); pc.printYourself();
FloatArray ps = pc;
ps.add(-0.5*mInitialCrackLength, crackTangent);
FloatArray pe = pc;
pe.add(0.5*mInitialCrackLength, crackTangent);
if(mCutOneEl) {
// If desired, ensure that the crack cuts exactly one element.
Line line(ps, pe);
std::vector<FloatArray> intersecPoints;
// line.computeIntersectionPoints(el.get(), intersecPoints);
for ( int i = 1; i <= el->giveNumberOfDofManagers(); i++ ) {
// int n1 = i;
// int n2 = 0;
// if ( i < el->giveNumberOfDofManagers() ) {
// n2 = i + 1;
// } else {
// n2 = 1;
// }
// const FloatArray &p1 = *(el->giveDofManager(n1)->giveCoordinates());
// const FloatArray &p2 = *(el->giveDofManager(n2)->giveCoordinates());
}
// printf("intersecPoints.size(): %lu\n", intersecPoints.size());
if(intersecPoints.size() == 2) {
ps = std::move(intersecPoints[0]);
pe = std::move(intersecPoints[1]);
}
else {
//.........这里部分代码省略.........