![]() |
|
|||
File indexing completed on 2025-08-06 08:18:18
0001 #ifndef MILLE_H 0002 #define MILLE_H 0003 0004 /** \file 0005 * Define class Mille. 0006 * 0007 * \author Gero Flucke, University Hamburg, 2006 0008 * 0009 * \copyright 0010 * Copyright (c) 2009 - 2015 Deutsches Elektronen-Synchroton, 0011 * Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY \n\n 0012 * This library is free software; you can redistribute it and/or modify 0013 * it under the terms of the GNU Library General Public License as 0014 * published by the Free Software Foundation; either version 2 of the 0015 * License, or (at your option) any later version. \n\n 0016 * This library is distributed in the hope that it will be useful, 0017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0019 * GNU Library General Public License for more details. \n\n 0020 * You should have received a copy of the GNU Library General Public 0021 * License along with this program (see the file COPYING.LIB for more 0022 * details); if not, write to the Free Software Foundation, Inc., 0023 * 675 Mass Ave, Cambridge, MA 02139, USA. 0024 */ 0025 0026 #include <climits> 0027 #include <fstream> 0028 #include <limits> 0029 /** 0030 * \class Mille 0031 * 0032 * Class to write a C binary (cf. below) file of a given name and to fill it 0033 * with information used as input to **pede**. 0034 * Use its member functions \c mille(), \c special(), \c kill() and \c end() 0035 * as you would use the fortran \ref mille.f90 "MILLE" 0036 * and its entry points \c MILLSP, \c KILLE and \c ENDLE. 0037 * 0038 * For debugging purposes constructor flags enable switching to text output and/or 0039 * to write also derivatives and labels which are ==0. 0040 * But note that **pede** will not be able to read text output and has not been tested with 0041 * derivatives/labels ==0. 0042 * 0043 * author : Gero Flucke 0044 * date : October 2006 0045 * $Revision: 1.3 $ 0046 * $Date: 2007/04/16 17:47:38 $ 0047 * (last update by $Author: flucke $) 0048 */ 0049 0050 /// Class to write C binary file. 0051 class Mille 0052 { 0053 public: 0054 Mille(const char *outFileName, bool asBinary = true, bool writeZero = false); 0055 ~Mille(); 0056 0057 void mille(int NLC, const float *derLc, int NGL, const float *derGl, 0058 const int *label, float rMeas, float sigma); 0059 void special(int nSpecial, const float *floatings, const int *integers); 0060 void kill(); 0061 void end(); 0062 0063 private: 0064 void newSet(); 0065 bool checkBufferSize(int nLocal, int nGlobal); 0066 0067 std::ofstream myOutFile; ///< C-binary for output 0068 bool myAsBinary; ///< if false output as text 0069 bool myWriteZero; ///< if true also write out derivatives/labels ==0 0070 /// buffer size for ints and floats 0071 enum 0072 { 0073 myBufferSize = 10000 0074 }; ///< buffer size for ints and floats 0075 int myBufferInt[myBufferSize]{}; ///< to collect labels etc. 0076 float myBufferFloat[myBufferSize]{}; ///< to collect derivatives etc. 0077 int myBufferPos; ///< position in buffer 0078 bool myHasSpecial; ///< if true, special(..) already called for this record 0079 /// largest label allowed 0080 enum 0081 { 0082 myMaxLabel = std::numeric_limits<int>::max() - 1 0083 }; 0084 }; 0085 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |