void readStrain(){

	if (tnsrDeformGradient != NULL) readDeformGradient();

	printf("Reading input Green's strain tensor values...\n");
	readAtomTensorFrame(tnsrGreenStrain, atomGreenStrain);

	if (tnsrStretch != NULL) readStretch();
}
예제 #2
0
bool dictionary::readNodes(FILE * fp)
    {
    tcount nodeBufLen;
    if(fread(&nodeBufLen,sizeof(nodeBufLen),1,fp) == 1)
        {
        NODES.nnodes = nodeBufLen;
        NODES.initialchars = new int[nodeBufLen];
        NODES.strings = new char * [nodeBufLen];
        NODES.numberOfChildren = new tchildren[nodeBufLen];
        NODES.pos = new tindex[nodeBufLen];
        tchildren length;
        if(fread(&length,sizeof(length),1,fp) == 1)
            {
            NODES.ntoplevel = length;
            readStretch(NODES.ntoplevel,0,fp);
            for(tcount i = 0;i < nodeBufLen;++i)
                {
                NODES.initialchars[i] = UTF8char(NODES.strings[i],staticUTF8);
                }
            }
        return true;
        }
    return false;
    }
예제 #3
0
/*
NODES = {#nodeBufLen}{#ntoplevel}NODE*(ntoplevel)
NODE  = {#stringsIndex}{#numberOfChildren}{#pos}NODE*(numberOfChildren)

where N is ntoplevel for the first NODE and numberOfChildren for child NODES.
The tree is built in depth-first fashion.
*/
tcount dictionary::readStretch(tchildren length,tcount pos,FILE * fp)
    {
    tchildrencount i;
    for(i = 0;i < length;++i)
        {
        tindex tmp;
        if(  fread(&tmp,sizeof(tmp),1,fp) != 1
          || fread(&NODES.numberOfChildren[pos + i],sizeof(NODES.numberOfChildren[pos + i]),1,fp) != 1
          || fread(&NODES.pos[pos + i],sizeof(NODES.pos[pos + i]),1,fp) != 1
          )
            return 0; // error!
        NODES.strings[pos + i] = STRINGS + tmp;
        }
    tcount curr = pos + length;
    for(i = 0;i < length;++i)
        {
        if(NODES.pos[pos + i] < 0)
            {
            NODES.pos[pos + i] = -curr;
            curr = readStretch(NODES.numberOfChildren[pos + i],curr,fp);
            }
        }
    return curr;
    }