Exemple #1
0
char *strsignal(int signum)
{
    char *s = (char *)sys_siglist;

    signum = sigmap(signum);
    if ((unsigned)signum - 1 > 31) signum = 0;

    for (; signum--; s++) for (; *s; s++);

    return s;
}
Exemple #2
0
BeatType Score::tick2beatType(int tick)
      {
      Measure* m = tick2measure(tick);
      const int msrTick = m->tick();
      TimeSigFrac timeSig = sigmap()->timesig(msrTick).nominal();

      int rtick = tick - msrTick;

      if (m->isAnacrusis()) // measure is incomplete (anacrusis)
            rtick += timeSig.ticksPerMeasure() - m->ticks();

      return timeSig.rtick2beatType(rtick);
      }
Exemple #3
0
char* strsignal(int signum) {
    const char* s = strings;

    signum = sigmap(signum);
    if (signum - 1U >= _NSIG - 1)
        signum = 0;

    for (; signum--; s++)
        for (; *s; s++)
            ;

    return (char*)LCTRANS_CUR(s);
}
Exemple #4
0
void Score::readStaff(XmlReader& e)
{
    int staff = e.intAttribute("id", 1) - 1;
    e.initTick(0);
    e.setTrack(staff * VOICES);

    if (staff == 0) {
        while (e.readNextStartElement()) {
            const QStringRef& tag(e.name());

            if (tag == "Measure") {
                Measure* measure = 0;
                measure = new Measure(this);
                measure->setTick(e.tick());
                if (_mscVersion < 115) {
                    const SigEvent& ev = sigmap()->timesig(measure->tick());
                    measure->setLen(ev.timesig());
                    measure->setTimesig(ev.nominal());
                }
                else {
                    //
                    // inherit timesig from previous measure
                    //
                    Measure* m = e.lastMeasure(); // measure->prevMeasure();
                    Fraction f(m ? m->timesig() : Fraction(4,4));
                    measure->setLen(f);
                    measure->setTimesig(f);
                }
                measure->read(e, staff);
                if (!measure->isMMRest()) {
                    measures()->add(measure);
                    e.setLastMeasure(measure);
                    e.initTick(measure->tick() + measure->ticks());
                }
                else {
                    // this is a multi measure rest
                    // always preceded by the first measure it replaces
                    Measure* m = e.lastMeasure();

                    if (m) {
                        m->setMMRest(measure);
                        measure->setTick(m->tick());
                    }
                }
            }
            else if (tag == "HBox" || tag == "VBox" || tag == "TBox" || tag == "FBox") {
                MeasureBase* mb = static_cast<MeasureBase*>(Element::name2Element(tag, this));
                mb->read(e);
                mb->setTick(e.tick());
                measures()->add(mb);
            }
            else if (tag == "tick")
                e.initTick(fileDivision(e.readInt()));
            else
                e.unknown();
        }
    }
    else {
        Measure* measure = firstMeasure();
        while (e.readNextStartElement()) {
            const QStringRef& tag(e.name());

            if (tag == "Measure") {
                if (measure == 0) {
                    qDebug("Score::readStaff(): missing measure!");
                    measure = new Measure(this);
                    measure->setTick(e.tick());
                    measures()->add(measure);
                }
                e.initTick(measure->tick());
                measure->read(e, staff);
                if (measure->isMMRest())
                    measure = e.lastMeasure()->nextMeasure();
                else {
                    e.setLastMeasure(measure);
                    if (measure->mmRest())
                        measure = measure->mmRest();
                    else
                        measure = measure->nextMeasure();
                }
            }
            else if (tag == "tick")
                e.initTick(fileDivision(e.readInt()));
            else
                e.unknown();
        }
    }
}
int main(int argc, char *argv[])
{	

	timeSelector::addOptions();
	#   include "addRegionOption.H"
	argList::addBoolOption
	(
	"noWrite",
	"suppress writing results"
	);
	#include "addDictOption.H"

	#include "setRootCase.H"
	#include "createTime.H"
	instantList timeDirs = timeSelector::select0(runTime, args);
	#include "createNamedMesh.H"

	#include "createFields.H" 	 

    	// Create particle cloud
    	cfdemCloud particleCloud(mesh);

        // Post-processing dictionary
        #include "postProcessingDict.H"
    
	// Create conditional averaging class
	conditionalAve condAve(postProcessingDict,conditionalAveragingDict,
						mesh,nVariable,nAveragingVariable,nTotalCase,conditionalAveraging);
	
	// Create multiple variable conditional averaging class
	multipleVarsConditionalAve multipleVarsCondAve(postProcessingDict,multConditionalAveragingDict,
						mesh,multNVariable,multNAveragingVariable,multNTotalCase,multConditionalAveraging);
			
	forAll(timeDirs, timeI)
	{
  
		runTime.setTime(timeDirs[timeI], timeI);

		Pout << " " << endl;
		Pout << "\nTime = " << runTime.timeName() << endl;

		mesh.readUpdate();

        	// Read gas volume fraction
        	IOobject voidfractionheader
        	(
        	    "voidfraction",
        	    runTime.timeName(),
        	    mesh,
        	    IOobject::MUST_READ
        	);

        	Info<< " 	Reading voidfraction" << endl;
        	volScalarField voidfraction(voidfractionheader,mesh);

		// Read Eulerian particle velocity
		IOobject Usheader
		(
		   "Us",
		   runTime.timeName(),
		   mesh,
		   IOobject::MUST_READ	
		);

		Info<< " 	Reading Us" << endl;
		volVectorField Us(Usheader,mesh);

        	// Read particle kinetic stresses
        	IOobject sigmaKinHeader
        	(
        	    "sigmaKin",
        	    runTime.timeName(),
        	    mesh,
        	    IOobject::MUST_READ
        	);

        	Info<< " 	Reading sigmaKin" << endl;
        	volSymmTensorField sigmaKin(sigmaKinHeader,mesh);

        	// Read particle collisional stresses
        	IOobject sigmaCollHeader
        	(
        	    "sigmaColl",
        	    runTime.timeName(),
        	    mesh,
        	    IOobject::MUST_READ
        	);

        	Info<< " 	Reading sigmaColl" << endl;
        	volSymmTensorField sigmaColl(sigmaCollHeader,mesh);

        	// Particle pressure
        	volScalarField Pp
        	(
        	    IOobject
        	    (
                	"Pp",
                	runTime.timeName(),
                	mesh,
                	IOobject::NO_READ,
                	IOobject::AUTO_WRITE
        	    ),
        	    mesh,
        	    dimensionedScalar( "zero", dimensionSet(1,-1,-2,0,0), scalar(0) )
        	 );

        	Pp = 1./3. * tr( sigmaKin + sigmaColl ) ;
        	// Write into the results folder
        	Pp.write();
        	// Calculate the particulate pressure gradient
        	volVectorField gradPp(fvc::grad(Pp));

        	// Particle shear stress
        	volTensorField sigmap
        	(
        	    IOobject
        	    (
                	"sigmap",
                	runTime.timeName(),
                	mesh,
                	IOobject::NO_READ,
                	IOobject::AUTO_WRITE
        	    ),
        	    mesh,
        	    dimensionedTensor( "zero", dimensionSet(1,-1,-2,0,0), tensor(0,0,0,0,0,0,0,0,0) )
        	);

        	sigmap = ( sigmaKin + sigmaColl ) - tensor(I) * Pp;
        	// Write into the results folder
        	sigmap.write();

        	// Particle viscosity
        	volScalarField mup
        	(
        	    IOobject
        	    (
                	"mup",
                	runTime.timeName(),
                	mesh,
                	IOobject::NO_READ,
                	IOobject::AUTO_WRITE
        	    ),
        	    mesh,
        	    dimensionedScalar( "zero", dimensionSet(1,-1,-1,0,0), scalar(0) )
        	);

        	// Particle shear stresses
        	volTensorField S("S",fvc::grad(Us) + fvc::grad(Us)().T());
        	dimensionedScalar SSsmall("zero", dimensionSet(0,0,-2,0,0,0,0), SMALL);
        	mup = ( sigmap && S ) / ( max ( S && S, SSsmall ) );
        	// Limit by zero
        	mup.max(0.);
        	// Write into the results folder
        	mup.write(); 
		
		// Particle viscosity/sqrt(p)
        	dimensionedScalar PpSmall("zero", dimensionSet(1,-1,-2,0,0,0,0), 1.e-06);
        	volScalarField mupSqrtPp
        	(
        	    IOobject
        	    (
                	"mupSqrtPp",
                	runTime.timeName(),
                	mesh,
                	IOobject::NO_READ,
                	IOobject::AUTO_WRITE
        	    ),
        	    mup/sqrt((mag(Pp)+PpSmall)*rhop)/dp
        	); 
		
		//- Dummy word
		word varName("");

		//- Conditional averaging
	        condAve.calc();
		condAve.write(varName);
		
		//- Multi-variable conditional averaging
	        multipleVarsCondAve.calc();
		multipleVarsCondAve.write(varName);

	}