float support for fourindex
This commit is contained in:
1 parent
b3b023bfc3
commit
d11e7515de
1 file changed
+28
@@ -32,6 +32,19 @@ while((unsigned char)i!=terminator&&(unsigned char)j!=terminator&&(unsigned char
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void fourindex<unsigned char,float>::fscanf(FILE *ff)
|
||||||
|
{
|
||||||
|
int i,j,k,l;
|
||||||
|
float elem;
|
||||||
|
if(5!= ::fscanf(ff,"%f %d %d %d %d",&elem,&i,&j,&k,&l)) laerror("read error in fourindex::fscanf");
|
||||||
|
while((unsigned char)i!=terminator&&(unsigned char)j!=terminator&&(unsigned char)k!=terminator&&(unsigned char)l!=terminator) //cast: -1 in the file matches the default terminator
|
||||||
|
{
|
||||||
|
add(i,j,k,l,elem);
|
||||||
|
if(5!= ::fscanf(ff,"%f %d %d %d %d",&elem,&i,&j,&k,&l)) laerror("read error in fourindex::fscanf");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void fourindex<unsigned char,double>::fprintf(FILE *f, char *format) const
|
void fourindex<unsigned char,double>::fprintf(FILE *f, char *format) const
|
||||||
{
|
{
|
||||||
@@ -44,6 +57,18 @@ while(it!=end)
|
|||||||
::fprintf(f,format,0.,(int)terminator,(int)terminator,(int)terminator,(int)terminator); //zero line for terminator 0 (FCIDUMP-like)
|
::fprintf(f,format,0.,(int)terminator,(int)terminator,(int)terminator,(int)terminator); //zero line for terminator 0 (FCIDUMP-like)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void fourindex<unsigned char,float>::fprintf(FILE *f, char *format) const
|
||||||
|
{
|
||||||
|
fourindex<unsigned char,float>::iterator it=this->begin(),end=this->end();
|
||||||
|
while(it!=end)
|
||||||
|
{
|
||||||
|
::fprintf(f,format,it->elem,it->index.indiv.i,it->index.indiv.j,it->index.indiv.k,it->index.indiv.l);
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
::fprintf(f,format,0.,(int)terminator,(int)terminator,(int)terminator,(int)terminator); //zero line for terminator 0 (FCIDUMP-like)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************//**
|
/***************************************************************************//**
|
||||||
@@ -52,4 +77,7 @@ while(it!=end)
|
|||||||
template class fourindex<unsigned char,double>;
|
template class fourindex<unsigned char,double>;
|
||||||
template class fourindex_ext<unsigned char,double>;
|
template class fourindex_ext<unsigned char,double>;
|
||||||
template class fourindex_dense<nosymmetry,double,unsigned char>;
|
template class fourindex_dense<nosymmetry,double,unsigned char>;
|
||||||
|
template class fourindex<unsigned char,float>;
|
||||||
|
template class fourindex_ext<unsigned char,float>;
|
||||||
|
template class fourindex_dense<nosymmetry,float,unsigned char>;
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user