Exemple #1
0
void Inference::makeSchema()
{
    DimList dims;

    for (const auto& name : m_dimVec)
    {
        const pdal::Dimension::Id id(pdal::Dimension::id(name));

        pdal::Dimension::Type t;
        try
        {
            t = pdal::Dimension::defaultType(id);
        }
        catch (pdal::pdal_error&)
        {
            t = pdal::Dimension::Type::Double;
        }

        dims.emplace_back(name, id, t);
    }

    m_schema = makeUnique<Schema>(dims);

    if (const Delta* d = delta())
    {
        const Bounds cube(m_bounds->cubeify(*d));
        m_schema = makeUnique<Schema>(Schema::deltify(cube, *d, *m_schema));
    }
}
Exemple #2
0
 ~Var( void )
 {
     DimList::iterator dim = m_dims.begin();
     DimList::const_iterator last_dim = m_dims.end();
     while ( dim != last_dim )
     {
         if ( *dim ) delete *dim;
         dim++;
     }
     m_dims.clear();
 }
Exemple #3
0
    const Dim* dim( const std::string name ) const
    {
        DimList::const_iterator dim = m_dims.begin();
        DimList::const_iterator last = m_dims.end();
        while ( dim != last )
        {
            if ( (*dim)->name() == name ) break;
            dim++;
        }

        return( *dim );
    }
Exemple #4
0
    const Dim* dim( const size_t index ) const
    {
        DimList::const_iterator dim = m_dims.begin();
        DimList::const_iterator last = m_dims.end();
        size_t counter = 0;
        while ( dim != last )
        {
            if ( counter++ == index ) break;
            dim++;
        }

        return( *dim );
    }
Exemple #5
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 #6
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 #7
0
    ~File( void )
    {
        if ( m_file ) delete m_file;

        DimList::iterator dim = m_dims.begin();
        DimList::const_iterator last_dim = m_dims.end();
        while ( dim != last_dim )
        {
            if ( *dim ) delete *dim;
            dim++;
        }
        m_dims.clear();

        VarList::iterator var = m_vars.begin();
        VarList::const_iterator last_var = m_vars.end();
        while ( var != last_var )
        {
            if ( *var ) delete *var;
            var++;
        }
        m_vars.clear();
    }
Exemple #8
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 );
    }
Exemple #9
0
 const size_t ndims( void ) const
 {
     return( m_dims.size() );
 }