From fdbcfd5937f25a2cd459145b28556396a3b7e838 Mon Sep 17 00:00:00 2001 From: eap Date: Thu, 1 Oct 2009 05:36:31 +0000 Subject: [PATCH] 0020441: [CEA 349] P1P1 barycentric interpolators { + // SPEC: + // "Limitation. For the P1P0 barycentric improvement only triangle source cells in 2D and + // tetrahedrons in 3D will be supported by interpolators. If a non + // triangle/tetrahedron source cell is detected an INTERP_KERNEL::Exception should be thrown." + + // Check types of source elements here rather than in intersectCells() since a wrong type can be + // found late after a long time of calculation. + + const unsigned long numSrcElems = meshS.getNumberOfElements(); + for(unsigned long i = 0 ; i < numSrcElems ; ++i) + if ( meshS.getTypeOfElement( i ) != NORM_... ) + throw INTERP_KERNEL::Exception("P1P0 barycentric algorithm works only with triangular source meshes"); } --- src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.txx | 12 ++++++++++++ src/INTERP_KERNEL/PolyhedronIntersectorP1P0Bary.txx | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.txx b/src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.txx index 6e6d666f0..49476a463 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.txx @@ -34,6 +34,18 @@ namespace INTERP_KERNEL PlanarIntersector(meshT,meshS,dimCaracteristic,precision,md3DSurf, medianPlane,doRotate,orientation,printLevel) { + // SPEC: + // "Limitation. For the P1P0 barycentric improvement only triangle source cells in 2D and + // tetrahedrons in 3D will be supported by interpolators. If a non + // triangle/tetrahedron source cell is detected an INTERP_KERNEL::Exception should be thrown." + + // Check types of source elements here rather than in intersectCells() since a wrong type can be + // found late after a long time of calculation. + + const unsigned long numSrcElems = meshS.getNumberOfElements(); + for(unsigned long i = 0 ; i < numSrcElems ; ++i) + if ( meshS.getTypeOfElement( i ) != NORM_TRI3 ) + throw INTERP_KERNEL::Exception("P1P0 barycentric algorithm works only with triangular source meshes"); } PLAN_INTER_TEMPLATE diff --git a/src/INTERP_KERNEL/PolyhedronIntersectorP1P0Bary.txx b/src/INTERP_KERNEL/PolyhedronIntersectorP1P0Bary.txx index a44cb3b7f..0c8f976c0 100644 --- a/src/INTERP_KERNEL/PolyhedronIntersectorP1P0Bary.txx +++ b/src/INTERP_KERNEL/PolyhedronIntersectorP1P0Bary.txx @@ -46,6 +46,18 @@ namespace INTERP_KERNEL SplittingPolicy policy) :Intersector3DP1P0Bary(targetMesh,srcMesh),_split(targetMesh,srcMesh,policy) { + // SPEC: + // "Limitation. For the P1P0 barycentric improvement only triangle source cells in 2D and + // tetrahedrons in 3D will be supported by interpolators. If a non + // triangle/tetrahedron source cell is detected an INTERP_KERNEL::Exception should be thrown." + + // Check types of source elements here rather than in intersectCells() since a wrong type can be + // found late after a long time of calculation. + + const unsigned long numSrcElems = srcMesh.getNumberOfElements(); + for(unsigned long i = 0 ; i < numSrcElems ; ++i) + if ( srcMesh.getTypeOfElement( i ) != NORM_TETRA4 ) + throw INTERP_KERNEL::Exception("P1P0 barycentric algorithm works only with tetrahedral source meshes"); } /** -- 2.39.2