void BarycentricMapperMeshTopology<CudaVec3fTypes,CudaVec3fTypes>::applyJT( In::MatrixDeriv& out, const Out::MatrixDeriv& in) { Out::MatrixDeriv::RowConstIterator rowItEnd = in.end(); for ( Out::MatrixDeriv::RowConstIterator rowIt = in.begin(); rowIt != rowItEnd; ++rowIt) { Out::MatrixDeriv::ColConstIterator colItEnd = rowIt.end(); Out::MatrixDeriv::ColConstIterator colIt = rowIt.begin(); int indexIn; if (colIt != colItEnd) { In::MatrixDeriv::RowIterator o = out.writeLine(rowIt.index()); for ( ; colIt != colItEnd; ++colIt) { indexIn = colIt.index(); InDeriv data = (InDeriv) colIt.val(); for (int j=0; j<maxNIn; ++j) { const OutReal f = ( OutReal ) getMapValue(indexIn,j); int index = getMapIndex(indexIn,j); if (index < 0) break; o.addCol( index, data * f ); } } } } }
void BarycentricMapperSparseGridTopology<CudaVec3f1Types,CudaVec3f1Types>::applyJT( In::MatrixDeriv& out, const Out::MatrixDeriv& in) { helper::ReadAccessor<gpu::cuda::CudaVector<CubeData> > map = this->map; for (Out::MatrixDeriv::RowConstIterator rowIt = in.begin(), rowItEnd = in.end(); rowIt != rowItEnd; ++rowIt) { Out::MatrixDeriv::ColConstIterator colItEnd = rowIt.end(); Out::MatrixDeriv::ColConstIterator colIt = rowIt.begin(); if (colIt != colItEnd) { In::MatrixDeriv::RowIterator o = out.writeLine(rowIt.index()); for ( ; colIt != colItEnd; ++colIt) { unsigned indexIn = colIt.index(); InDeriv data = (InDeriv) Out::getDPos(colIt.val()); const topology::SparseGridTopology::Hexa cube = this->m_fromTopology->getHexahedron ( map[indexIn].in_index ); const OutReal fx = ( OutReal ) map[indexIn].baryCoords[0]; const OutReal fy = ( OutReal ) map[indexIn].baryCoords[1]; const OutReal fz = ( OutReal ) map[indexIn].baryCoords[2]; const OutReal oneMinusFx = 1-fx; const OutReal oneMinusFy = 1-fy; const OutReal oneMinusFz = 1-fz; OutReal f = ( oneMinusFx * oneMinusFy * oneMinusFz ); o.addCol ( cube[0], ( data * f ) ); f = ( ( fx ) * oneMinusFy * oneMinusFz ); o.addCol ( cube[1], ( data * f ) ); f = ( oneMinusFx * ( fy ) * oneMinusFz ); o.addCol ( cube[3], ( data * f ) ); f = ( ( fx ) * ( fy ) * oneMinusFz ); o.addCol ( cube[2], ( data * f ) ); f = ( oneMinusFx * oneMinusFy * ( fz ) ); o.addCol ( cube[4], ( data * f ) ); f = ( ( fx ) * oneMinusFy * ( fz ) ); o.addCol ( cube[5], ( data * f ) ); f = ( oneMinusFx * ( fy ) * ( fz ) ); o.addCol ( cube[7], ( data * f ) ); f = ( ( fx ) * ( fy ) * ( fz ) ); o.addCol ( cube[6], ( data * f ) ); } } } }