Commit cf6ff4b5 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

DepositionCosmics: since no reply from original authors how to contribute...

DepositionCosmics: since no reply from original authors how to contribute patches, hardpatching local copy of CRY
parent 800769e8
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -38,13 +38,15 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "CRYAbsFunction.h"
#include "core/utils/log.h"

#include <assert.h>
#include <iostream>
#include <sstream>
#include <stdlib.h> // For Ubuntu Linux
#include <string.h> // For Ubuntu Linux
#include <string>
#include "CRYAbsFunction.h"
#include "CRYFunctionDict.h"
#include "CRYUtils.h"

@@ -60,13 +62,13 @@ CRYAbsFunction::CRYAbsFunction(std::string name, CRYFunctionDict::functype type,
    std::string::size_type stop = rhs.find("}");

    if(start == std::string::npos) {
        std::cerr << "CRY::CRYAbsFunction: invalid function - missing {. Data was:";
        std::cerr << rhs << std::endl;
        LOG(ERROR) << "CRY::CRYAbsFunction: invalid function - missing {. Data was:";
        LOG(ERROR) << rhs << std::endl;
        assert(0);
    }
    if(stop == std::string::npos) {
        std::cerr << "CRY::CRYAbsFunction: invalid function - missing }. Data was:";
        std::cerr << rhs << std::endl;
        LOG(ERROR) << "CRY::CRYAbsFunction: invalid function - missing }. Data was:";
        LOG(ERROR) << rhs << std::endl;
        assert(0);
    }

+9 −7
Original line number Diff line number Diff line
@@ -38,12 +38,14 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "CRYAbsParameter.h"
#include "core/utils/log.h"

#include <assert.h>
#include <iostream>
#include <sstream>
#include <string.h> // For Ubuntu Linux
#include <string>
#include "CRYAbsParameter.h"

CRYAbsParameter::CRYAbsParameter(std::string data) {

@@ -72,13 +74,13 @@ CRYAbsParameter::CRYAbsParameter(std::string data) {
    std::string::size_type stop = rhs.find("}");

    if(start == std::string::npos) {
        std::cerr << "CRY::CRYAbsParameter: invalid parameter - missing {. Data was:";
        std::cerr << data << std::endl;
        LOG(ERROR) << "CRY::CRYAbsParameter: invalid parameter - missing {. Data was:";
        LOG(ERROR) << data << std::endl;
        assert(0);
    }
    if(stop == std::string::npos) {
        std::cerr << "CRY::CRYAbsParameter:invalid parameter - missing }. Data was:";
        std::cerr << data << std::endl;
        LOG(ERROR) << "CRY::CRYAbsParameter:invalid parameter - missing }. Data was:";
        LOG(ERROR) << data << std::endl;
        assert(0);
    }

@@ -90,8 +92,8 @@ CRYAbsParameter::CRYAbsParameter(std::string data) {
        std::getline(iss3, key, ' ');
        if(key.length() > 0 && 0 != strcmp(key.c_str(), " ")) {
            if(foundIt) {
                std::cerr << "CRY::CRYAbsParameter: Extra data/characters in parameter?? Data was:";
                std::cerr << data << std::endl;
                LOG(ERROR) << "CRY::CRYAbsParameter: Extra data/characters in parameter?? Data was:";
                LOG(ERROR) << data << std::endl;
                assert(0);
            }
            foundIt = true;
+10 −8
Original line number Diff line number Diff line
@@ -38,7 +38,8 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "CRYBinning.h"
#include "core/utils/log.h"

#include <assert.h>
#include <iostream>
#include <math.h>
@@ -46,6 +47,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdlib.h> // For Ubuntu Linux
#include <string.h> // For Ubuntu Linux
#include <string>
#include "CRYBinning.h"

CRYBinning::CRYBinning(std::string data) {

@@ -75,13 +77,13 @@ CRYBinning::CRYBinning(std::string data) {
    std::string::size_type stop = rhs.find("}");

    if(start == std::string::npos) {
        std::cerr << "CRY::CRYBinning: invalid binning - missing {. Data was:";
        std::cerr << data << std::endl;
        LOG(ERROR) << "CRY::CRYBinning: invalid binning - missing {. Data was:";
        LOG(ERROR) << data << std::endl;
        assert(0);
    }
    if(stop == std::string::npos) {
        std::cerr << "CRY::CRYBinning: invalid binning - missing }. Data was:";
        std::cerr << data << std::endl;
        LOG(ERROR) << "CRY::CRYBinning: invalid binning - missing }. Data was:";
        LOG(ERROR) << data << std::endl;
        assert(0);
    }

@@ -94,8 +96,8 @@ CRYBinning::CRYBinning(std::string data) {
            _bins->push_back(atof(key.c_str()));
            if(_bins->size() > 1)
                if((*_bins)[_bins->size() - 1] <= (*_bins)[_bins->size() - 2]) {
                    std::cerr << "CRY::CRYBinning: Bins must be in monotonically increasing order. Data was:\n";
                    std::cerr << data << std::endl;
                    LOG(ERROR) << "CRY::CRYBinning: Bins must be in monotonically increasing order. Data was:\n";
                    LOG(ERROR) << data << std::endl;
                    assert(0);
                }
        }
@@ -115,7 +117,7 @@ void CRYBinning::print(std::ostream& o, bool printData) {

int CRYBinning::bin(double value) {
    if(value < (*_bins)[0]) {
        std::cerr << "CRY::CRYBinning " << name() << ": Datum is in no bin. Stopping\n " << value << std::endl;
        LOG(ERROR) << "CRY::CRYBinning " << name() << ": Datum is in no bin. Stopping\n " << value << std::endl;
        assert(0);
    }

+5 −3
Original line number Diff line number Diff line
@@ -38,9 +38,11 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "CRYData.h"
#include "core/utils/log.h"

#include "CRYAbsFunction.h"
#include "CRYBinning.h"
#include "CRYData.h"
#include "CRYFunctionDict.h"
#include "CRYParamI.h"
#include "CRYParameter.h"
@@ -56,7 +58,7 @@ CRYData::CRYData(std::string file) {
    _file = file;
    bool readOk = read();
    if(!readOk) {
        std::cerr << "CRY::CRYData: Error reading " << _file << "....  Stopping\n";
        LOG(ERROR) << "CRY::CRYData: Error reading " << _file << "....  Stopping\n";
        assert(0);
    }
}
@@ -64,7 +66,7 @@ CRYData::CRYData(std::string file) {
bool CRYData::read() {
    CRYFunctionDict fDict;

    //  std::cout << "CRY::CRYData: Reading data file " << _file << std::endl;
    LOG(DEBUG) << "CRY::CRYData: Reading data file " << _file << std::endl;

    std::ifstream file;
    file.open(_file.c_str(), std::ios::in);
+7 −5
Original line number Diff line number Diff line
@@ -38,7 +38,8 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "CRYFunctionDict.h"
#include "core/utils/log.h"

#include <assert.h>
#include <iostream>
#include <sstream>
@@ -46,6 +47,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <string>
#include "CRYAbsFunction.h"
#include "CRYCosLatitudeFunction.h"
#include "CRYFunctionDict.h"
#include "CRYPrimarySpectrumFunction.h"
#include "CRYUtils.h"

@@ -86,8 +88,8 @@ CRYAbsFunction* CRYFunctionDict::function(std::string data) {

    std::string::size_type colLoc = name.find(":");
    if(colLoc == std::string::npos || name[colLoc + 1] != ':') {
        std::cerr << "CRY::CRYFunctionDict: Function must specify type. Data was:\n";
        std::cerr << data << std::endl;
        LOG(ERROR) << "CRY::CRYFunctionDict: Function must specify type. Data was:\n";
        LOG(ERROR) << data << std::endl;
        assert(0);
    }

@@ -105,8 +107,8 @@ CRYAbsFunction* CRYFunctionDict::function(std::string data) {
            type = iterKF->first;
    }
    if(type == CRYFunctionDict::UNKNOWN) {
        std::cerr << "CRY::CRYFunctionDict: Unknown function type " << funcType << " Data was:\n";
        std::cerr << data << std::endl;
        LOG(ERROR) << "CRY::CRYFunctionDict: Unknown function type " << funcType << " Data was:\n";
        LOG(ERROR) << data << std::endl;
        assert(0);
    }

Loading