IGMPlot 3.16 Optimized IGMplot version able to use wfn/wfx/xyz files

Loading...
Searching...
No Matches
ADF_KFReader.h
1 /***************************************************************************
2 KFReader.h - Implementation of KFReader library for handling ADF binary file
3 format, the so-called KF-files. The current version supports only
4 reading KF files.
5 Even though the binary files are system-dependent, they are
6 converted on the fly and the caller routine gets the data in the
7 native format.
8
9 Copyright (C) 2006-2023 by Software for Chemistry & Materials B.V.
10 For support, contact support at scm . com
11
12 This file is part of the ADF software
13 For more information, see <http://www.scm.com>
14
15 This program is free software; you can redistribute it and/or modify
16 it under the terms of the GNU Lesser General Public License as published by
17 the Free Software Foundation version 3 of the License.
18
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
23
24 SCM owns the intellectual property right for this file and reserves the
25 right to distrbute it under a license other than LGPL
26 ****************************************************************************/
27#include <ADF_KFc.h>
28
29#include <stdlib.h>
30/* JC Only Unix version
31#ifdef _MSC_VER
32#include <io.h>
33#else*/
34#include <unistd.h>
35//#endif
36#include <stdio.h>
37#include <fcntl.h>
38#include <string.h>
39
40/* (de-)initializers */
41
42/*static KFVariable *createKFVariable (KFSection *sec, const char* name, int lbl, int dex, int len, int fln, int usd, int typ);
43 static void deleteKFVariable(KFVariable *var);
44 static KFSection *createKFSection (KFFile *kf, const char *name, int phBlk, int logBlk, int numBlks);
45 static void deleteKFSection(KFSection *sec);
46 static KFBlockRun *createKFBlockRun(int phBlk, int logBlk, int numBlks);
47 static void deleteKFBlockRun(KFBlockRun *br);*/
48
49/* Functions for KFVariable */
50/*static int getPhysicalBlockNumber(KFVariable *var);
51 static int getPhysicalBlockNumberForLogical(KFVariable *var, int logBlock);*/
52
53
54// JC add non static declaration
55 void ADF_getVariableFromName(const char *complexName, char *varName);
56 void ADF_getSectionFromName(const char *complexName, char *secName);
57 int ADF_sectionsComparator(const void *secName, const void *sec);
58KFSection* ADF_findSection(KFFile *kf, const char *name);
59 int ADF_variablesNamesComparator(const void *varName, const void *var);
60KFVariable* ADF_findVariableInSection(const KFSection *sec, const char *name);
61KFVariable* ADF_findVariable(KFFile *kf, const char *name);
62 int ADF_getKFVariableLength(KFFile *kf, const char *name);
63 void ADF_addDataBlockRun (KFSection *sec, int phBlk, int logBlk, int numBlks);
64 void ADF_getDataBlockFromSuperEntry(KFFile *kf, void *buf);
65 void ADF_parseIndexEntry(KFSection *sec, KFFile *kf, void *buf);
66 void ADF_parseIndexBlock(KFSection *sec, KFFile *kf, void *buf);
67 void ADF_swapBytes(char *d, int size);
68 void ADF_swapNBytes(char *p, int size, int count);
69 void ADF_swapBytesIndexBlock(KFFile *kf, char *buf);
70 void ADF_addIndexBlockRun (KFSection *sec, int phBlk, int logBlk, int numBlks);
71 void ADF_getSectionFromSuperEntry(KFFile *kf, void *buf);
72 int ADF_readBlock(int fd, void *buf, int block);
73 void ADF_swapBytesSuperIndexBlock(KFFile *kf, char *buf);
74 void ADF_initialize(KFFile *kf, void *buf);
75 int ADF_guessIntegerSize(void *buf);
76 int ADF_guessByteOrder(void *buf, int size);
77 int ADF_openKFFile(KFFile *kf, const char *name);
78 int ADF_verifySuperIndex(void *buf);
79 void ADF_closeKFFile (KFFile *kf);
80 int ADF_getKFVariableUsedLength(KFFile *kf, const char *name);
81 int ADF_getKFData(KFFile *kf, const char *name, void *buf);
82 int ADF_getKFVariableData(KFVariable *var, void *buf);
83 int ADF_getKFVariableType(KFFile *kf, const char *name);
84 int ADF_calculateDataOffset(KFVariable *var, void* data, int firstBlock) ;
85 int ADF_calculateDataSize(KFVariable *var, void *data, int firstBlock);
86KFVariable* ADF_createKFVariable (KFSection *sec, const char *name, int lbl, int dex, int len, int fln, int usd, int typ);
87 void ADF_deleteKFVariable (KFVariable *var);
88 int ADF_getPhysicalBlockNumber(KFVariable *var);
89 int ADF_getPhysicalBlockNumberForLogical(KFVariable *var, int logBlock);
90KFSection* ADF_createKFSection (KFFile *kf, const char *name, int phBlk, int logBlk, int numBlks);
91 void ADF_deleteKFSection(KFSection *sec);
92KFBlockRun* ADF_createKFBlockRun(int phBlk, int logBlk, int numBlks);
93 void ADF_deleteKFBlockRun(KFBlockRun *br);
94 int ADF_getHostByteOrder();
95 int ADF_isValidKFFile(const char* fname);
96
97 int ADF_primtype(int kx, int ky, int kz);