|
4 | 4 | * This work is open source software, licensed under the terms of the |
5 | 5 | * BSD license as described in the LICENSE file in the top-level directory. |
6 | 6 | */ |
7 | | - |
8 | 7 | #include "apf.h" |
9 | 8 | #include "apfScalarField.h" |
10 | 9 | #include "apfScalarElement.h" |
@@ -464,28 +463,20 @@ void getVectorShapeValues(Element* e, Vector3 const& local, |
464 | 463 | NewArray<Vector3> vvals(values.size()); |
465 | 464 | e->getShape()->getVectorValues(e->getMesh(), e->getEntity(), local, vvals); |
466 | 465 |
|
467 | | - // Perform Piola transformation |
468 | | - if( e->getDimension() == e->getMesh()->getDimension() ) // i.e. J is square |
469 | | - { |
470 | | - apf::Matrix3x3 Jinv; |
471 | | - apf::getJacobianInv( e->getParent(), local, Jinv ); |
472 | | - apf::Matrix3x3 JinvT = apf::transpose(Jinv); |
473 | | - |
474 | | - // u(x_hat) * J(x_hat)^{-1} |
475 | | - for( size_t i = 0; i < values.size(); i++ ) { |
476 | | - for ( int j = 0; j < 3; j++ ) { |
477 | | - values[i][j] = 0.; |
478 | | - for ( int k = 0; k < 3; k++ ) |
479 | | - values[i][j] += vvals[i][k] * JinvT[k][j]; |
480 | | - } |
| 466 | + apf::Matrix3x3 Jinv; |
| 467 | + apf::getJacobianInv( e->getParent(), local, Jinv ); |
| 468 | + apf::Matrix3x3 JinvT = apf::transpose(Jinv); |
| 469 | + |
| 470 | + // Perform Piola transformation - u(x_hat) * J(x_hat)^{-1} |
| 471 | + int d = 0; |
| 472 | + (e->getDimension() == e->getMesh()->getDimension()) ? d = 3 : d = 2; |
| 473 | + for( size_t i = 0; i < values.size(); i++ ) { |
| 474 | + for ( int j = 0; j < 3; j++ ) { |
| 475 | + values[i][j] = 0.; |
| 476 | + for ( int k = 0; k < d; k++ ) |
| 477 | + values[i][j] += vvals[i][k] * JinvT[k][j]; |
481 | 478 | } |
482 | 479 | } |
483 | | - else |
484 | | - { |
485 | | - // TODO when ref dim != mesh space dim. Pseudo-inverse needed. |
486 | | - PCU_ALWAYS_ASSERT_VERBOSE(false, |
487 | | - "not yet implemented for 3D surface meshes (i.e., manifolds)!"); |
488 | | - } |
489 | 480 | } |
490 | 481 |
|
491 | 482 | void getCurlShapeValues(Element* e, Vector3 const& local, |
|
0 commit comments