face ConstCombinatorialEmbedding::chooseFace() const { if (numberOfFaces() == 0) return nullptr; int k = ogdf::randomNumber(0, numberOfFaces()-1); face f = firstFace(); while(k--) f = f->succ(); return f; }
void Tetrahedron::getCubatureJacobianHat( Math::MatR43 cJHat[Math::Simplex::Tetrahedron<2>::ncp], const Math::MatR44 cJ[Math::Simplex::Tetrahedron<2>::ncp], const Math::Real cJDet[Math::Simplex::Tetrahedron<2>::ncp]) const { // PURPOSE: // See chapter 17.3.1 of Filippa's course on Advanced FEM. std::size_t ind[3]; Math::MatR33 Jred, invJred; Math::MatR43 res; // Main loop, runs over all simplex coordinates. for (std::size_t j = 0; j < numberOfFaces(); j++) { // Chooses columns indices that will be substracted from the Jacobian. switch (j) { case 0: ind[0] = 1; ind[1] = 2; ind[2] = 3; break; case 1: ind[0] = 0; ind[1] = 2; ind[2] = 3; break; case 2: ind[0] = 0; ind[1] = 1; ind[2] = 3; break; case 3: ind[0] = 0; ind[1] = 1; ind[2] = 2; break; } // Builds reduced jacobian for all cubature points. for (std::size_t c = 0; c < Math::Simplex::Tetrahedron<1>::ncp; c++) { // Substracts column j to column ind[c], to build J reduced. for (std::size_t k = 0; k < 3; k++) { for (std::size_t i = 0; i < 3; i++) { Jred(k,i) = cJ[c](k,ind[i]) - cJ[c](k,j); } } // Computes reduced jacobian inverse. invJred = Jred.invert(); // Gets Jhat from the summation of reduced jacobians. for (std::size_t m = 0; m < 3; m++) { for (std::size_t n = 0; n < 3; n++) { cJHat[c](j,m) -= invJred(n,m); } } } } // Ends j loop, running over faces. // Multiplies by Jacobian determinant. for (std::size_t c = 0; c < Math::Simplex::Tetrahedron<1>::ncp; c++) { cJHat[c] *= cJDet[c]; } }
void Tetrahedron::getCubatureJacobian( Math::MatR44 res[Math::Simplex::Tetrahedron<2>::ncp]) const { for (std::size_t s = 0; s < numberOfFaces(); s++) for (std::size_t i = 0; i < numberOfCoordinates(); i++) { const Math::CVecR3 v = *(getV(i)); for (std::size_t c = 0; c < Math::Simplex::Tetrahedron<2>::ncp; c++) { res[c](0,s) += v(0) * getTet().getCda(i,s,c); res[c](1,s) += v(1) * getTet().getCda(i,s,c); res[c](2,s) += v(2) * getTet().getCda(i,s,c); res[c](3,s) = 1.0; } } }
face ConstCombinatorialEmbedding::maximalFace() const { if (numberOfFaces() == 0) return nullptr; face fMax = firstFace(); int max = fMax->size(); for(face f = fMax->succ(); f != nullptr; f = f->succ()) { if (f->size() > max) { max = f->size(); fMax = f; } } return fMax; }
Acad::ErrorStatus AsdkShellData::setFaceData(int colorIndex) { // If user overrides this function they must obey the following // contract. // 1. Allocate memory for AcGiFaceData and point it to mpFaceData // 2. Allocate memory for all elements of AcGiFaceData. // They are free to set any value to the members of AcGiFaceData. // For example, the colors need not be the same for all faces as // is shown in this example. unsigned int numberFaces = numberOfFaces(); short* pColors = new short[numberFaces]; for (unsigned int i = 0; i < numberFaces; ++i) pColors[i] = colorIndex; // Set data members for AcgiFaceData to the above. mpFaceData = new AcGiFaceData; mpFaceData->setColors(pColors); return Acad::eOk; }