bool WwRIFFVorbisStream::rewind() { _end = false; Common::ScopedPtr<Common::SeekableReadStream> headerIdentification(generateHeaderIdentification()); Common::ScopedPtr<Common::SeekableReadStream> headerComment(generateHeaderComment()); Common::ScopedPtr<Common::SeekableReadStream> headerSetup(generateHeaderSetup()); #ifdef ENABLE_VORBIS _vorbis.reset(Sound::makePacketizedVorbisStream(*headerIdentification, *headerComment, *headerSetup)); #else throw Common::Exception("Vorbis decoding disabled when building without libvorbis"); #endif _currentOffset = _dataOffset + _firstAudioPacketOffset; return true; }
/** * Calculates potential and electric field at the required points, and stores * them in file 'results.vtk' using the vtk format. * * It also calculates the force on the dielectric interface if required and * stores it in file 'force-mst.dat' or 'force-mp.dat' for MST and multipolar * approximations respectively. * * Works for quadratic interpolation in triangular elements (6-noded triangles). * * @param ANALYSIS : [ Input ] Type of post-processing to be done * @param cOutputType : [ Input ] Output format type * @param axis : [ Input ] Semi-axis of ellipsoidal particle * @param XF : [ Input ] Points where the force should be calculated * @param Xinner : [ Input ] Nodes where potential and/or field should be calculated * @param mNodes : [ Input ] Coordinates of all nodes in the computational domain * @param mElems : [ Input ] Connectivity of all nodes in the computational domain * @param vMatParam : [ Input ] Electric properties of dielectric materials * @param vProbParam : [ Input ] Frequency of the applied electric field * @param vBCType : [ Input ] Boundary condition type for each node in the domain * @param vB : [ Input ] Solution vector for the electrostatic problem */ int vtkPostProcess_tria6(unsigned int ANALYSIS, char *cOutputType, double *axis, double **XF, double **Xinner, double **mNodes, unsigned int **mElems, double **vMatParam, double *vProbParam, unsigned int *vBCType, double *vB) { FILE *fp[3]; unsigned int i, nOrder, nShape; double Eps, R; double Fcm[3], mE[6], mPot[2], Xin[3], Xcm[3], Xeval[3]; double **Fce, **Xce; /* Setup the header of the output files */ headerSetup(ANALYSIS,cOutputType,fp,Xinner); /* Electric potential at the required points */ if( nInternalPoints > 0 ){ mPot[0] = mPot[1] = 0.0; for(i = 0; i < 6; i++) mE[i] = 0.0; fprintf(fp[0],"\n"); fprintf(fp[0],"SCALARS Re[V] double\n"); fprintf(fp[0],"LOOKUP_TABLE default\n"); for(i = 0; i < nInternalPoints; i++){ Xin[0] = Xinner[i][0]; Xin[1] = Xinner[i][1]; Xin[2] = Xinner[i][2]; potential_tria6(Xin,mNodes,mElems,vB,mPot); fprintf(fp[0],"%e\n",mPot[0]); } /* Electric potential at the required points */ fprintf(fp[0],"\n"); fprintf(fp[0],"SCALARS Im[V] double\n"); fprintf(fp[0],"LOOKUP_TABLE default\n"); for(i = 0; i < nInternalPoints; i++){ Xin[0] = Xinner[i][0]; Xin[1] = Xinner[i][1]; Xin[2] = Xinner[i][2]; potential_tria6(Xin,mNodes,mElems,vB,mPot); fprintf(fp[0],"%e\n",mPot[1]); } /* Electric field at the required points */ fprintf(fp[0],"\n"); fprintf(fp[0],"VECTORS Re[E] double\n"); for(i = 0; i < nInternalPoints; i++){ Xin[0] = Xinner[i][0]; Xin[1] = Xinner[i][1]; Xin[2] = Xinner[i][2]; field_tria6(Xin,mNodes,mElems,vB,mE); fprintf(fp[0],"%e\t%e\t%e\n",mE[0],mE[2],mE[4]); } /* Electric field at the required points */ fprintf(fp[0],"\n"); fprintf(fp[0],"VECTORS Im[E] double\n"); for(i = 0; i < nInternalPoints; i++){ Xin[0] = Xinner[i][0]; Xin[1] = Xinner[i][1]; Xin[2] = Xinner[i][2]; field_tria6(Xin,mNodes,mElems,vB,mE); fprintf(fp[0],"%e\t%e\t%e\n",mE[1],mE[3],mE[5]); } fclose(fp[0]); } /* Calculate Fdep at dielectric interfaces if required */ if(ANALYSIS == 3 || ANALYSIS == 4){ Fce = doubleMatrix(nElems,3,1); Xce = doubleMatrix(nElems,3,1); Eps = vMatParam[0][1]*eps0; forceMST_tria6(mNodes,mElems,vBCType,vB,Eps,Fce,Xce,Fcm,Xcm); fprintf(fp[2],"%e\t%e\t%e\t%e\t%e\t%e\n",Xcm[0],Xcm[1],Xcm[2],Fcm[0],Fcm[1],Fcm[2]); for(i = 0; i < nElems; i++){ if(vBCType[mElems[i][0]-1] == 6){ fprintf(fp[2],"%e\t%e\t%e\t",Xce[i][0],Xce[i][1],Xce[i][2]); fprintf(fp[2],"%e\t%e\t%e\n",Fce[i][0],Fce[i][1],Fce[i][2]); } } fclose(fp[2]); freeDoubleMatrix(Fce,nElems); freeDoubleMatrix(Xce,nElems); } /* Calculate Fdep at particle centre using multipolar method if required */ else if(ANALYSIS > 4){ multipoleSetup(ANALYSIS,axis,&nShape,&nOrder,&R); for(i = 0; i < nFPoints; i++){ Xeval[0] = XF[i][0]; Xeval[1] = XF[i][1]; Xeval[2] = XF[i][2]; if(nShape == 0) forceMultipole_tria6(nOrder,R,Xeval,mNodes,mElems,vB,vMatParam,vProbParam,Fcm); else forceEllipsoid_tria6(ANALYSIS,nOrder,axis,Xeval,mNodes,mElems,vB,vMatParam,vProbParam,Fcm); fprintf(fp[2],"%e\t%e\t%e\t",Xeval[0],Xeval[1],Xeval[2]); fprintf(fp[2],"%e\t%e\t%e\n",Fcm[0],Fcm[1],Fcm[2]); } fclose(fp[2]); } return 0; }