#include <stormcontgrid.hpp>

Inheritance diagram for NRLib::StormContGrid:
Inheritance graph

Public Types

enum  FileFormat { STORM_BINARY = 0 , STORM_ASCII }
 
typedef std::vector< float >::iterator iterator
 
typedef std::vector< float >::const_iterator const_iterator
 
typedef std::vector< float >::reference reference
 
typedef std::vector< float >::const_reference const_reference
 

Public Member Functions

 StormContGrid (const std::string &filename, Endianess file_format=END_BIG_ENDIAN)
 
 StormContGrid (size_t nx=0, size_t ny=0, size_t nz=0)
 
 StormContGrid (const Volume &vol, const Grid< float > &grid)
 
 StormContGrid (const Volume &vol, size_t nx=0, size_t ny=0, size_t nz=0)
 
void SetMissingCode (float missing_code)
 
float GetMissingCode () const
 
bool IsMissing (float val) const
 
void SetFormat (FileFormat format)
 
FileFormat GetFormat () const
 
void SetModelFileName (const std::string &filename)
 
std::string GetModelFileName () const
 
void SetVariableName (const std::string &name)
 
std::string GetVariableName () const
 
void SetZoneNumber (int zone_number)
 
int GetZoneNumber () const
 
void WriteToFile (const std::string &filename, const std::string &predefinedHeader="", bool plainAscii=false, Endianess file_format=END_BIG_ENDIAN, bool remove_path=true) const
 
void WriteToSgriFile (const std::string &file_name, const std::string &file_name_header, const std::string &label, double simbox_dz, Endianess file_format=END_BIG_ENDIAN) const
 
void ReadFromFile (const std::string &filename, bool commonPath=true, Endianess file_format=END_BIG_ENDIAN)
 
double GetDX () const
 
double GetDY () const
 
size_t FindIndex (double x, double y, double z) const
 
void FindIndex (double x, double y, double z, size_t &i_out, size_t &j_out, size_t &k_out) const
 
void FindXYIndex (double x, double y, size_t &i_out, size_t &j_out) const
 
void FindZInterpolatedIndex (const double &x, const double &y, const double &z, size_t &ind1, size_t &ind2, double &t) const
 
float GetValueZInterpolatedFromIndex (const size_t &ind1, const size_t &ind2, const double &t) const
 
double GetValueZInterpolatedFromIndexNoMissing (const size_t &ind1, const size_t &ind2, const double &t) const
 
float GetValueInterpolated (const int &i, const int &j, const float &k_value) const
 
double GetAvgRelThick () const
 
float GetValueZInterpolated (double x, double y, double z) const
 
float GetValueClosestInZ (double x, double y, double z) const
 
double GetZMin () const
 
double GetZMax () const
 
void FindCenterOfCell (size_t i, size_t j, size_t k, double &x, double &y, double &z) const
 
void WriteCravaFile (const std::string &file_name, double inline_0, double crossline_0, double il_step_x, double il_step_y, double xl_step_x, double xl_step_y)
 
void Resize (size_t ni, size_t nj, size_t nk, const float &val=float())
 
void GetAvgMinMax (float &avg, float &min, float &max)
 
void GetAvgMinMaxWithMissing (float &avg, float &min, float &max, float missing)
 
void LogTransform (float missing)
 
reference operator() (size_t i, size_t j, size_t k)
 
reference operator() (size_t index)
 
const_reference operator() (size_t i, size_t j, size_t k) const
 
const_reference operator() (size_t index) const
 
reference GetValue (size_t i, size_t j, size_t k)
 
const_reference GetValue (size_t i, size_t j, size_t k) const
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
size_t GetNI () const
 
size_t GetNJ () const
 
size_t GetNK () const
 
size_t GetN () const
 
size_t GetIndex (size_t i, size_t j, size_t k) const
 
void GetIJK (size_t index, size_t &i, size_t &j, size_t &k) const
 
void SetValue (size_t i, size_t j, size_t k, const float &value)
 
void Swap (Grid< float > &other)
 
void SetDimensions (double x_min, double y_min, double lx, double ly)
 
void SetAngle (double angle)
 
void SetTolerance (double tolerance)
 
double GetTolerance ()
 
double GetXMin () const
 
double GetYMin () const
 
double GetZMin (size_t nx, size_t ny) const
 Get extreme values of z for volume, with nx, ny resolution. More...
 
double GetZMax (size_t nx, size_t ny) const
 
double GetLX () const
 
double GetLY () const
 
double GetAngle () const
 
double GetLZ () const
 Maximum height of grid. More...
 
void GetXYFromRelative (double rel_x, double rel_y, double &x, double &y) const
 rel_x and rel_y in [0,1]. More...
 
double GetTopZMin (size_t nx, size_t ny) const
 Get z-range for top and bottom surfaces, with nx, ny resolution. More...
 
double GetTopZMax (size_t nx, size_t ny) const
 
double GetBotZMin (size_t nx, size_t ny) const
 
double GetBotZMax (size_t nx, size_t ny) const
 
void SetSurfaces (const Surface< double > &top_surf, const Surface< double > &bot_surf, bool skip_check=true)
 Set surfaces. More...
 
const Surface< double > & GetTopSurface () const
 
Surface< double > & GetTopSurface ()
 
const Surface< double > & GetBotSurface () const
 
Surface< double > & GetBotSurface ()
 
int IsInside (double x, double y) const
 
bool IsInside (double x, double y, double z) const
 
int IsInsideTolerance (double x, double y) const
 
bool IsInsideZTolerance (double x, double y, double z, double tolerance) const
 
void FindCenter (double &x, double &y, double &z) const
 
bool CheckSurface (const Surface< double > &surface) const
 Checks if surface covers the whole volume. More...
 

Protected Member Functions

void WriteVolumeToFile (std::ofstream &file, const std::string &filename, bool remove_path=true) const
 Reader and writer on storm-format. More...
 
void ReadVolumeFromFile (std::ifstream &file, int line, const std::string &path)
 
void GlobalToLocalCoord (double global_x, double global_y, double &local_x, double &local_y) const
 The local coorinates are (0,0) in (x_min, y_min), and have the same orientation as the volume. More...
 
void LocalToGlobalCoord (double local_x, double local_y, double &global_x, double &global_y) const
 

Member Typedef Documentation

◆ const_iterator

typedef std::vector<float >::const_iterator NRLib::Grid< float >::const_iterator
inherited

◆ const_reference

typedef std::vector<float >::const_reference NRLib::Grid< float >::const_reference
inherited

◆ iterator

typedef std::vector<float >::iterator NRLib::Grid< float >::iterator
inherited

◆ reference

typedef std::vector<float >::reference NRLib::Grid< float >::reference
inherited

Member Enumeration Documentation

◆ FileFormat

Enumerator
STORM_BINARY 
STORM_ASCII 

Constructor & Destructor Documentation

◆ StormContGrid() [1/4]

NRLib::StormContGrid::StormContGrid ( const std::string filename,
Endianess  file_format = END_BIG_ENDIAN 
)
explicit

◆ StormContGrid() [2/4]

NRLib::StormContGrid::StormContGrid ( size_t  nx = 0,
size_t  ny = 0,
size_t  nz = 0 
)
explicit

◆ StormContGrid() [3/4]

NRLib::StormContGrid::StormContGrid ( const Volume vol,
const Grid< float > &  grid 
)
explicit

◆ StormContGrid() [4/4]

NRLib::StormContGrid::StormContGrid ( const Volume vol,
size_t  nx = 0,
size_t  ny = 0,
size_t  nz = 0 
)
explicit

Member Function Documentation

◆ begin() [1/2]

iterator NRLib::Grid< float >::begin ( )
inlineinherited

◆ begin() [2/2]

const_iterator NRLib::Grid< float >::begin ( ) const
inlineinherited

◆ CheckSurface()

bool NRLib::Volume::CheckSurface ( const Surface< double > &  surface) const
inherited

Checks if surface covers the whole volume.

◆ end() [1/2]

iterator NRLib::Grid< float >::end ( )
inlineinherited

◆ end() [2/2]

const_iterator NRLib::Grid< float >::end ( ) const
inlineinherited

◆ FindCenter()

void NRLib::Volume::FindCenter ( double &  x,
double &  y,
double &  z 
) const
inherited

◆ FindCenterOfCell()

void NRLib::StormContGrid::FindCenterOfCell ( size_t  i,
size_t  j,
size_t  k,
double &  x,
double &  y,
double &  z 
) const

◆ FindIndex() [1/2]

size_t NRLib::StormContGrid::FindIndex ( double  x,
double  y,
double  z 
) const

◆ FindIndex() [2/2]

void NRLib::StormContGrid::FindIndex ( double  x,
double  y,
double  z,
size_t &  i_out,
size_t &  j_out,
size_t &  k_out 
) const

◆ FindXYIndex()

void NRLib::StormContGrid::FindXYIndex ( double  x,
double  y,
size_t &  i_out,
size_t &  j_out 
) const

◆ FindZInterpolatedIndex()

void NRLib::StormContGrid::FindZInterpolatedIndex ( const double &  x,
const double &  y,
const double &  z,
size_t &  ind1,
size_t &  ind2,
double &  t 
) const

◆ GetAngle()

double NRLib::Volume::GetAngle ( ) const
inlineinherited

◆ GetAvgMinMax()

void NRLib::Grid< float >::GetAvgMinMax ( float &  avg,
float &  min,
float &  max 
)
inherited

◆ GetAvgMinMaxWithMissing()

void NRLib::Grid< float >::GetAvgMinMaxWithMissing ( float &  avg,
float &  min,
float &  max,
float  missing 
)
inherited

◆ GetAvgRelThick()

double NRLib::StormContGrid::GetAvgRelThick ( ) const

◆ GetBotSurface() [1/2]

Surface< double > & NRLib::Volume::GetBotSurface ( )
inlineinherited

◆ GetBotSurface() [2/2]

const Surface< double > & NRLib::Volume::GetBotSurface ( ) const
inlineinherited

◆ GetBotZMax()

double NRLib::Volume::GetBotZMax ( size_t  nx,
size_t  ny 
) const
inherited

◆ GetBotZMin()

double NRLib::Volume::GetBotZMin ( size_t  nx,
size_t  ny 
) const
inherited

◆ GetDX()

double NRLib::StormContGrid::GetDX ( ) const
inline

◆ GetDY()

double NRLib::StormContGrid::GetDY ( ) const
inline

◆ GetFormat()

FileFormat NRLib::StormContGrid::GetFormat ( ) const
inline

◆ GetIJK()

void NRLib::Grid< float >::GetIJK ( size_t  index,
size_t &  i,
size_t &  j,
size_t &  k 
) const
inherited

◆ GetIndex()

size_t NRLib::Grid< float >::GetIndex ( size_t  i,
size_t  j,
size_t  k 
) const
inlineinherited

◆ GetLX()

double NRLib::Volume::GetLX ( ) const
inlineinherited

◆ GetLY()

double NRLib::Volume::GetLY ( ) const
inlineinherited

◆ GetLZ()

double NRLib::Volume::GetLZ ( ) const
inlineinherited

Maximum height of grid.

◆ GetMissingCode()

float NRLib::StormContGrid::GetMissingCode ( ) const
inline

◆ GetModelFileName()

std::string NRLib::StormContGrid::GetModelFileName ( ) const
inline

◆ GetN()

size_t NRLib::Grid< float >::GetN ( ) const
inlineinherited

◆ GetNI()

size_t NRLib::Grid< float >::GetNI ( ) const
inlineinherited

◆ GetNJ()

size_t NRLib::Grid< float >::GetNJ ( ) const
inlineinherited

◆ GetNK()

size_t NRLib::Grid< float >::GetNK ( ) const
inlineinherited

◆ GetTolerance()

double NRLib::Volume::GetTolerance ( )
inlineinherited

◆ GetTopSurface() [1/2]

Surface< double > & NRLib::Volume::GetTopSurface ( )
inlineinherited

◆ GetTopSurface() [2/2]

const Surface< double > & NRLib::Volume::GetTopSurface ( ) const
inlineinherited

◆ GetTopZMax()

double NRLib::Volume::GetTopZMax ( size_t  nx,
size_t  ny 
) const
inherited

◆ GetTopZMin()

double NRLib::Volume::GetTopZMin ( size_t  nx,
size_t  ny 
) const
inherited

Get z-range for top and bottom surfaces, with nx, ny resolution.

◆ GetValue() [1/2]

Grid< float >::reference NRLib::Grid< float >::GetValue ( size_t  i,
size_t  j,
size_t  k 
)
inlineinherited

◆ GetValue() [2/2]

Grid< float >::const_reference NRLib::Grid< float >::GetValue ( size_t  i,
size_t  j,
size_t  k 
) const
inlineinherited

◆ GetValueClosestInZ()

float NRLib::StormContGrid::GetValueClosestInZ ( double  x,
double  y,
double  z 
) const

◆ GetValueInterpolated()

float NRLib::StormContGrid::GetValueInterpolated ( const int &  i,
const int &  j,
const float &  k_value 
) const

◆ GetValueZInterpolated()

float NRLib::StormContGrid::GetValueZInterpolated ( double  x,
double  y,
double  z 
) const

◆ GetValueZInterpolatedFromIndex()

float NRLib::StormContGrid::GetValueZInterpolatedFromIndex ( const size_t &  ind1,
const size_t &  ind2,
const double &  t 
) const

◆ GetValueZInterpolatedFromIndexNoMissing()

double NRLib::StormContGrid::GetValueZInterpolatedFromIndexNoMissing ( const size_t &  ind1,
const size_t &  ind2,
const double &  t 
) const

◆ GetVariableName()

std::string NRLib::StormContGrid::GetVariableName ( ) const
inline

◆ GetXMin()

double NRLib::Volume::GetXMin ( ) const
inlineinherited

◆ GetXYFromRelative()

void NRLib::Volume::GetXYFromRelative ( double  rel_x,
double  rel_y,
double &  x,
double &  y 
) const
inlineinherited

rel_x and rel_y in [0,1].

References NRLib::Volume::LocalToGlobalCoord(), and exprtk::details::x().

◆ GetYMin()

double NRLib::Volume::GetYMin ( ) const
inlineinherited

◆ GetZMax() [1/2]

double NRLib::StormContGrid::GetZMax ( ) const
inline

◆ GetZMax() [2/2]

double NRLib::Volume::GetZMax ( size_t  nx,
size_t  ny 
) const
inherited

Referenced by GetZMax().

◆ GetZMin() [1/2]

double NRLib::StormContGrid::GetZMin ( ) const
inline

◆ GetZMin() [2/2]

double NRLib::Volume::GetZMin ( size_t  nx,
size_t  ny 
) const
inherited

Get extreme values of z for volume, with nx, ny resolution.

Referenced by GetZMin().

◆ GetZoneNumber()

int NRLib::StormContGrid::GetZoneNumber ( ) const
inline

◆ GlobalToLocalCoord()

void NRLib::Volume::GlobalToLocalCoord ( double  global_x,
double  global_y,
double &  local_x,
double &  local_y 
) const
protectedinherited

The local coorinates are (0,0) in (x_min, y_min), and have the same orientation as the volume.

◆ IsInside() [1/2]

int NRLib::Volume::IsInside ( double  x,
double  y 
) const
inherited

◆ IsInside() [2/2]

bool NRLib::Volume::IsInside ( double  x,
double  y,
double  z 
) const
inherited

◆ IsInsideTolerance()

int NRLib::Volume::IsInsideTolerance ( double  x,
double  y 
) const
inherited

◆ IsInsideZTolerance()

bool NRLib::Volume::IsInsideZTolerance ( double  x,
double  y,
double  z,
double  tolerance 
) const
inherited

◆ IsMissing()

bool NRLib::StormContGrid::IsMissing ( float  val) const
inline

◆ LocalToGlobalCoord()

void NRLib::Volume::LocalToGlobalCoord ( double  local_x,
double  local_y,
double &  global_x,
double &  global_y 
) const
protectedinherited

◆ LogTransform()

void NRLib::Grid< float >::LogTransform ( float  missing)
inherited

◆ operator()() [1/4]

Grid< float >::reference NRLib::Grid< float >::operator() ( size_t  i,
size_t  j,
size_t  k 
)
inlineinherited

◆ operator()() [2/4]

Grid< float >::const_reference NRLib::Grid< float >::operator() ( size_t  i,
size_t  j,
size_t  k 
) const
inlineinherited

◆ operator()() [3/4]

Grid< float >::reference NRLib::Grid< float >::operator() ( size_t  index)
inlineinherited

◆ operator()() [4/4]

Grid< float >::const_reference NRLib::Grid< float >::operator() ( size_t  index) const
inlineinherited

◆ ReadFromFile()

void NRLib::StormContGrid::ReadFromFile ( const std::string filename,
bool  commonPath = true,
Endianess  file_format = END_BIG_ENDIAN 
)
Exceptions
IOErrorif the file can not be opened.
FileFormatErrorif file format is not either storm_binary or storm_ascii, or if grid contains barriers.

◆ ReadVolumeFromFile()

void NRLib::Volume::ReadVolumeFromFile ( std::ifstream &  file,
int  line,
const std::string path 
)
protectedinherited

◆ Resize()

void NRLib::Grid< float >::Resize ( size_t  ni,
size_t  nj,
size_t  nk,
const float &  val = A() 
)
inherited

All values in the grid are erased when the grid is resized.

Parameters
valInitial cell value.

◆ SetAngle()

void NRLib::Volume::SetAngle ( double  angle)
inherited

◆ SetDimensions()

void NRLib::Volume::SetDimensions ( double  x_min,
double  y_min,
double  lx,
double  ly 
)
inherited

◆ SetFormat()

void NRLib::StormContGrid::SetFormat ( FileFormat  format)
inline

References format.

◆ SetMissingCode()

void NRLib::StormContGrid::SetMissingCode ( float  missing_code)
inline

◆ SetModelFileName()

void NRLib::StormContGrid::SetModelFileName ( const std::string filename)
inline

◆ SetSurfaces()

void NRLib::Volume::SetSurfaces ( const Surface< double > &  top_surf,
const Surface< double > &  bot_surf,
bool  skip_check = true 
)
inherited

Set surfaces.

◆ SetTolerance()

void NRLib::Volume::SetTolerance ( double  tolerance)
inlineinherited

◆ SetValue()

void NRLib::Grid< float >::SetValue ( size_t  i,
size_t  j,
size_t  k,
const float &  value 
)
inherited

◆ SetVariableName()

void NRLib::StormContGrid::SetVariableName ( const std::string name)
inline

References name.

◆ SetZoneNumber()

void NRLib::StormContGrid::SetZoneNumber ( int  zone_number)
inline

◆ Swap()

void NRLib::Grid< float >::Swap ( NRLib::Grid< float > &  other)
inherited

◆ WriteCravaFile()

void NRLib::StormContGrid::WriteCravaFile ( const std::string file_name,
double  inline_0,
double  crossline_0,
double  il_step_x,
double  il_step_y,
double  xl_step_x,
double  xl_step_y 
)

◆ WriteToFile()

void NRLib::StormContGrid::WriteToFile ( const std::string filename,
const std::string predefinedHeader = "",
bool  plainAscii = false,
Endianess  file_format = END_BIG_ENDIAN,
bool  remove_path = true 
) const

Write to file. If predefinedHeader is not empty, this header is written instead of standard, and surfaces are not written.

◆ WriteToSgriFile()

void NRLib::StormContGrid::WriteToSgriFile ( const std::string file_name,
const std::string file_name_header,
const std::string label,
double  simbox_dz,
Endianess  file_format = END_BIG_ENDIAN 
) const

◆ WriteVolumeToFile()

void NRLib::Volume::WriteVolumeToFile ( std::ofstream &  file,
const std::string filename,
bool  remove_path = true 
) const
protectedinherited

Reader and writer on storm-format.


The documentation for this class was generated from the following file: