laswell.hpp
Go to the documentation of this file.
1// $Id: laswell.hpp 1244 2014-02-24 15:57:16Z hauge $
2
3// Copyright (c) 2011, Norwegian Computing Center
4// All rights reserved.
5// Redistribution and use in source and binary forms, with or without modification,
6// are permitted provided that the following conditions are met:
7// • Redistributions of source code must retain the above copyright notice, this
8// list of conditions and the following disclaimer.
9// • Redistributions in binary form must reproduce the above copyright notice, this list of
10// conditions and the following disclaimer in the documentation and/or other materials
11// provided with the distribution.
12// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
13// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
14// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
15// SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
16// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
17// OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
18// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
19// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
20// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21
22#ifndef NRLIB_WELL_LASWELL_HPP
23#define NRLIB_WELL_LASWELL_HPP
24
25#include <string>
26#include <vector>
27
28#include "well.hpp"
29
30namespace NRLib {
31
35class LasWell : public Well {
36public:
37 enum DepthType {
39 Time
40 };
41
42 // Default constructor added to be able to export from scratch
44
46 LasWell(const std::string & filename);
47
48 void AddLog(const std::string & name,
49 const std::string & units,
50 const std::string & comment,
51 const std::vector<double> & log);
52
53 void WriteToFile(const std::string & filename,
54 const std::vector<std::string> & comment_header);
55
58
59 std::string unitName(const std::string& logName) const;
60
61 void setVersionInfo(const std::string& logName);
62 void setStartDepth(double startDepth);
63 void setStopDepth(double stopDepth);
64 void setDepthStep(double depthStep);
65
66 void addWellInfo(const std::string& parameter, const std::string& value);
67
68private:
69 void ReadHeader(const std::string & filename,
70 std::ifstream & fin,
71 std::string & err_txt);
72
73 void ParseInformation(std::vector<std::string> & info,
74 const std::string & text,
75 std::ifstream & fin,
76 std::string & line,
77 std::string & err_txt);
78
79 void ParseVersionInformation(std::ifstream & fin,
80 std::string & line,
81 std::string & err_txt);
82
83 void ParseWellInformation(std::ifstream & fin,
84 std::string & line,
85 std::string & err_txt);
86
87 void ParseWellToken(const std::string & token,
88 const std::string & value,
89 const std::string & line,
90 std::string & err_txt);
91
92 void ParseCurveInformation(std::ifstream & fin,
93 std::string & line,
94 std::string & err_txt);
95
96 void ReadLogs(std::ifstream & fin,
97 std::string & err_txt);
98
99 bool GetRecord(std:: ifstream & fin,
100 size_t n_items,
101 std::vector<std::string> & record) const;
102
103 void WriteLasLine(std::ofstream & file,
104 const std::string & mnemonic,
105 const std::string & units,
106 const std::string & data,
107 const std::string & description);
108
109 void WriteLasLine(std::ofstream & file,
110 const std::string & mnemonic,
111 const std::string & units,
112 double data,
113 const std::string & description);
114
116 std::string version_;
117
120 bool wrap_;
121
123 bool comma_delimited_;
124
128 std::string depth_unit_;
129
131 double start_depth_;
133 double stop_depth_;
135 double depth_increment_;
136
137 std::vector<std::string> log_name_; //Needed to preserve log order, may be important in LAS-files.
138 std::vector<std::string> log_unit_;
139 std::vector<std::string> log_comment_;
140
141 std::vector<std::string> version_info_; //Unused version keywords, only read from file and rewritten.
142 std::vector<std::string> well_info_; //Unused well keywords, only read from file and rewritten.
143 std::vector<std::string> parameter_info_; //Not used, only read from file and rewritten.
144 std::vector<std::string> other_info_; //Not used, only read from file and rewritten.
145
146 std::map<std::string, std::string> logUnitMap_; // Log name/unit map
147};
148
149}
150
151#endif // NRLIB_WELL_LASWELL_HPP
const char *const name
Definition: cJSON.h:258
const char *const string
Definition: cJSON.h:170
Definition: laswell.hpp:35
void setStopDepth(double stopDepth)
void setDepthStep(double depthStep)
void setVersionInfo(const std::string &logName)
LasWell(const std::string &filename)
Constructor with relevant parameters.
void setDepthUnit(const std::string &depthUnit)
void setStartDepth(double startDepth)
void addWellInfo(const std::string &parameter, const std::string &value)
DepthType
Definition: laswell.hpp:37
@ Depth
Definition: laswell.hpp:38
@ Time
Definition: laswell.hpp:39
std::string unitName(const std::string &logName) const
void WriteToFile(const std::string &filename, const std::vector< std::string > &comment_header)
void AddLog(const std::string &name, const std::string &units, const std::string &comment, const std::vector< double > &log)
std::string depthUnit() const
Definition: NRLib/nrlib/well/well.hpp:30
Definition: exception.hpp:31
T value(details::expression_node< T > *n)
Definition: exprtk.hpp:12955
static std::string data()
Definition: exprtk.hpp:40022