~ubuntu-branches/ubuntu/raring/openwalnut/raring

« back to all changes in this revision

Viewing changes to src/core/dataHandler/WDataSetVector.cpp

  • Committer: Package Import Robot
  • Author(s): Sebastian Eichelbaum
  • Date: 2012-12-12 11:26:32 UTC
  • mfrom: (3.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20121212112632-xhiuwkxuz5h0idkh
Tags: 1.3.1+hg5849-1
* Minor changes compared to 1.3.0 but included several bug fixes.
* See http://www.openwalnut.org/versions/4

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
 
83
83
namespace
84
84
{
85
 
    boost::array< double, 8 > computePrefactors( const WPosition& pos, boost::shared_ptr< const WGrid > i_grid,
86
 
            boost::shared_ptr< const WValueSetBase > i_valueSet, bool *success, boost::shared_ptr< std::vector< size_t > > vertexIds )
 
85
    boost::array< double, 8 > computePrefactors( const WPosition& pos,
 
86
                                                 boost::shared_ptr< const WGrid > i_grid,
 
87
                                                 boost::shared_ptr< const WValueSetBase > i_valueSet,
 
88
                                                 bool *success,
 
89
                                                 boost::shared_ptr< WGridRegular3D::CellVertexArray > vertexIds )
87
90
    {
88
91
        boost::shared_ptr< const WGridRegular3D > grid = boost::shared_dynamic_cast< const WGridRegular3D >( i_grid );
89
92
 
90
93
        WAssert( grid,  "This data set has a grid whose type is not yet supported for interpolation." );
91
 
        WAssert( grid->isNotRotated(), "Only feasible for grids that are only translated or scaled so far." );
92
94
        WAssert( ( i_valueSet->order() == 1 &&  i_valueSet->dimension() == 3 ),
93
95
                "Only implemented for 3D Vectors so far." );
94
96
        boost::array< double, 8 > h;
105
107
 
106
108
        *vertexIds = grid->getCellVertexIds( cellId );
107
109
 
108
 
        WPosition localPos = pos - grid->getPosition( ( *vertexIds )[0] );
 
110
        WPosition localPos = grid->getTransform().positionToGridSpace( pos - grid->getPosition( ( *vertexIds )[0] ) );
109
111
 
110
 
        double lambdaX = localPos[0] / grid->getOffsetX();
111
 
        double lambdaY = localPos[1] / grid->getOffsetY();
112
 
        double lambdaZ = localPos[2] / grid->getOffsetZ();
 
112
        double lambdaX = localPos[0];
 
113
        double lambdaY = localPos[1];
 
114
        double lambdaZ = localPos[2];
113
115
 
114
116
        //         lZ     lY
115
117
        //         |      /
135
137
 
136
138
WVector3d WDataSetVector::interpolate( const WPosition& pos, bool *success ) const
137
139
{
138
 
    boost::shared_ptr< std::vector< size_t > > vertexIds( new std::vector< size_t > );
 
140
    boost::shared_ptr< WGridRegular3D::CellVertexArray > vertexIds( new WGridRegular3D::CellVertexArray );
139
141
    boost::array< double, 8 > h = computePrefactors( pos, m_grid, m_valueSet, success, vertexIds );
140
142
    WVector3d result( 0.0, 0.0, 0.0 );
141
143
 
152
154
 
153
155
WVector3d WDataSetVector::eigenVectorInterpolate( const WPosition& pos, bool *success ) const
154
156
{
155
 
    boost::shared_ptr< std::vector< size_t > > vertexIds( new std::vector< size_t > );
 
157
    boost::shared_ptr< WGridRegular3D::CellVertexArray > vertexIds( new WGridRegular3D::CellVertexArray );
156
158
    boost::array< double, 8 > h = computePrefactors( pos, m_grid, m_valueSet, success, vertexIds );
157
159
    WVector3d result( 0.0, 0.0, 0.0 );
158
160