Exemple #1
0
 Var( const NcVar* var ):
     m_var( var )
 {
     const int ndims = m_var->num_dims();
     for ( int i = 0; i < ndims; i++ )
     {
         m_dims.push_back( new Dim( m_var->get_dim(i) ) );
     }
 }
Exemple #2
0
CelledBaseChunkReader::CelledBaseChunkReader(
        const Metadata& m,
        PointPool& pool,
        const arbiter::Endpoint& endpoint)
    : BaseChunkReader(m, pool)
{
    DimList dims;
    dims.push_back(DimInfo("TubeId", "unsigned", 8));
    dims.insert(dims.end(), m.schema().dims().begin(), m.schema().dims().end());
    const Schema celledSchema(dims);
    PointPool celledPool(celledSchema, m.delta());

    auto tubedCells(m.storage().deserialize(endpoint, celledPool, m_id));
    Data::PooledStack tubedData(celledPool.dataPool());

    auto dataNodes(m_pool.dataPool().acquire(tubedCells.size()));
    m_cells = m_pool.cellPool().acquire(tubedCells.size());

    const std::size_t celledPointSize(celledSchema.pointSize());
    const std::size_t tubeIdSize(sizeof(uint64_t));
    uint64_t tube(0);
    char* tPos(reinterpret_cast<char*>(&tube));

    BinaryPointTable table(m.schema());
    pdal::PointRef pointRef(table, 0);

    for (auto& cell : m_cells)
    {
        auto tubedCell(tubedCells.popOne());
        const char* src(tubedCell->uniqueData());

        Data::PooledNode data(dataNodes.popOne());

        std::copy(src, src + tubeIdSize, tPos);
        std::copy(src + tubeIdSize, src + celledPointSize, *data);

        table.setPoint(*data);
        cell.set(pointRef, std::move(data));

        m_points.at(tube).emplace_back(cell.point(), cell.uniqueData());

        tubedData.push(tubedCell->acquire());
    }
}
Exemple #3
0
    const bool read( const std::string filename )
    {
        if ( m_file ) delete m_file;

        m_filename = filename;
        m_file = new NcFile( filename.c_str(), NcFile::ReadOnly );
        if ( !m_file ) return( false );
        if ( !m_file->is_valid() ) return( false );

        const int ndims = m_file->num_dims();
        for ( int i = 0; i < ndims; i++ )
        {
            m_dims.push_back( new Dim( m_file->get_dim(i) ) );
        }

        const int nvars = m_file->num_vars();
        for ( int i = 0; i < nvars; i++ )
        {
            m_vars.push_back( new Var( m_file->get_var(i) ) );
        }

        return( true );
    }