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);
43static void deleteKFVariable(KFVariable *var);
44static KFSection *createKFSection (KFFile *kf, const char *name, int phBlk, int logBlk, int numBlks);
45static void deleteKFSection(KFSection *sec);
46static KFBlockRun *createKFBlockRun(int phBlk, int logBlk, int numBlks);
47static 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
55void ADF_getVariableFromName(const char *complexName, char *varName);
56void ADF_getSectionFromName(const char *complexName, char *secName);
57int ADF_sectionsComparator(const void *secName, const void *sec);
58KFSection* ADF_findSection(KFFile *kf, const char *name);
59int 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);
62int ADF_getKFVariableLength(KFFile *kf, const char *name);
63void ADF_addDataBlockRun (KFSection *sec, int phBlk, int logBlk, int numBlks);
64void ADF_getDataBlockFromSuperEntry(KFFile *kf, void *buf);
65void ADF_parseIndexEntry(KFSection *sec, KFFile *kf, void *buf);
66void ADF_parseIndexBlock(KFSection *sec, KFFile *kf, void *buf);
67void ADF_swapBytes(char *d, int size);
68void ADF_swapNBytes(char *p, int size, int count);
69void ADF_swapBytesIndexBlock(KFFile *kf, char *buf);
70void ADF_addIndexBlockRun (KFSection *sec, int phBlk, int logBlk, int numBlks);
71void ADF_getSectionFromSuperEntry(KFFile *kf, void *buf);
72int ADF_readBlock(int fd, void *buf, int block);
73void ADF_swapBytesSuperIndexBlock(KFFile *kf, char *buf);
74void ADF_initialize(KFFile *kf, void *buf);
75int ADF_guessIntegerSize(void *buf);
76int ADF_guessByteOrder(void *buf, int size);
77int ADF_openKFFile(KFFile *kf, const char *name);
78int ADF_verifySuperIndex(void *buf);
79void ADF_closeKFFile (KFFile *kf);
80int ADF_getKFVariableUsedLength(KFFile *kf, const char *name);
81int ADF_getKFData(KFFile *kf, const char *name, void *buf);
82int ADF_getKFVariableData(KFVariable *var, void *buf);
83int ADF_getKFVariableType(KFFile *kf, const char *name);
84int ADF_calculateDataOffset(KFVariable *var, void* data, int firstBlock) ;
85int 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);
87void ADF_deleteKFVariable (KFVariable *var);
88int ADF_getPhysicalBlockNumber(KFVariable *var);
89int ADF_getPhysicalBlockNumberForLogical(KFVariable *var, int logBlock);
90KFSection* ADF_createKFSection (KFFile *kf, const char *name, int phBlk, int logBlk, int numBlks);
91void ADF_deleteKFSection(KFSection *sec);
92KFBlockRun* ADF_createKFBlockRun(int phBlk, int logBlk, int numBlks);
93void ADF_deleteKFBlockRun(KFBlockRun *br);
94int ADF_getHostByteOrder();
95int ADF_isValidKFFile(const char* fname);
96
97int ADF_primtype(int kx, int ky, int kz);