void CEnumInfo<T>::outEnumInfo(FILE **pOutFile, bool removeReportFile, const CGroupsInfo *pGroupInfo)
{
	setRunTime();
	FILE *outFile = pOutFile ? *pOutFile : NULL;
	if (!outFile)
		return;

	if (!pGroupInfo)
		pGroupInfo = this;

	pGroupInfo->printGroupInfo(outFile);
	const ulonglong nConstrMatr = constrCanonical();
	char buff[256];
	SPRINTF(buff, "\n%10llu matri%s" CONSTRUCTED_IN " ", nConstrMatr, nConstrMatr == 1 ? "x" : "ces");
	const size_t len = strlen(buff);
	convertTime(runTime(), buff + len, countof(buff) - len, false);
	outString(buff, outFile);

	const ulonglong nMatr = numbSimpleDesign();
	if (nConstrMatr > 0) {
		SPRINTF(buff, "%10llu matri%s ha%s no replicated blocks\n", nMatr, nMatr == 1 ? "x" : "ces", nMatr == 1 ? "s" : "ve");
		outString(buff, outFile);
	}

	SPRINTF(buff, "%10llu matri%s fully constructed\n", constrTotal(), constrTotal() == 1 ? "x was" : "ces were");
	outString(buff, outFile);

	outEnumInformation(pOutFile);
	if (removeReportFile) // Remove temporary file with the intermediate results	
		remove(reportFileName());
}
executeIfPythonFunctionObject::executeIfPythonFunctionObject
(
    const word& name,
    const Time& t,
    const dictionary& dict
)
:
    conditionalFunctionObjectListProxy(
        name,
        t,
        dict
    ),
    pythonInterpreterWrapper(
        t.db(),
        dict
    )
{
    if(!parallelNoRun()) {
        initEnvironment(t);

        setRunTime(t);
    }

    readParameters(dict);
}
bool pythonIntegrationFunctionObject::end()
{
    Pbug << "end" << endl;

    if(!parallelNoRun()) {
        setRunTime();
    }

    return executeCode(endCode_,true);
}
bool pythonIntegrationFunctionObject::start()
{
    Pbug << "start" << endl;

    simpleFunctionObject::start();

    if(!parallelNoRun()) {
        setRunTime();
    }

    return executeCode(startCode_,true);
}
void pythonIntegrationFunctionObject::writeSimple()
{
    Pbug << "writeSimple" << endl;

    if(!parallelNoRun()) {
        setRunTime();
    }

    executeCode(executeCode_,true);

    if(this->time_.outputTime()) {
        executeCode(writeCode_,true);
    }
}
示例#6
0
 void
 CreatureManager::MakePointCache(const std::string& animation_name_in)
 {
     float store_run_time = getRunTime();
     auto cur_animation = animations[animation_name_in];
     if(cur_animation->hasCachePts())
     {
         // cache already generated, just exit
         return;
     }
     
     std::vector<glm::float32 *>& cache_pts_list = cur_animation->getCachePts();
     
     for(int i = (int)cur_animation->getStartTime(); i <= (int)cur_animation->getEndTime(); i++)
     {
         setRunTime((float)i);
         auto new_pts = new glm::float32[target_creature->GetTotalNumPoints() * 3];
         PoseCreature(animation_name_in, new_pts, getRunTime());
         
         cache_pts_list.push_back(new_pts);
     }
     
     setRunTime(store_run_time);
 }
bool executeIfPythonFunctionObject::condition()
{
    if(!parallelNoRun()) {
        setRunTime(time());
    }

    if(writeDebug()) {
        Info << "Evaluating " << conditionCode_ << endl;
    }
    bool result=evaluateCodeTrueOrFalse(conditionCode_,true);
    if(writeDebug()) {
        Info << "Evaluated to " << result << endl;
    }
    return result;
}
timeManipulationWithPythonFunctionObject::timeManipulationWithPythonFunctionObject
(
    const word &name,
    const Time& t,
    const dictionary& dict
)
:
    timeManipulationFunctionObject(name,t,dict),
    pythonInterpreterWrapper(
        t.db(),
        dict
    )
{
    if(!parallelNoRun()) {
        initEnvironment(t);

        setRunTime(t);
    }
}
bool writeAndEndPythonFunctionObject::endRunNow()
{
    if(!parallelNoRun()) {
        setRunTime(time());
    }

    if(writeDebug()) {
        Info << "Evaluating " << conditionCode_ << endl;
    }
    bool result=evaluateCodeTrueOrFalse(conditionCode_,true);
    if(writeDebug()) {
        Info << "Evaluated to " << result << endl;
    }

    if(result) {
        Info << "Stopping because python code  " << conditionCode_
            << " evaluated to 'true' in " << name() << endl;
    }

    return result;
}
writeAndEndPythonFunctionObject::writeAndEndPythonFunctionObject
(
    const word &name,
    const Time& t,
    const dictionary& dict
)
:
    writeAndEndFunctionObject(name,t,dict),
    pythonInterpreterWrapper(
        t.db(),
        dict
    )
{
    if(!parallelNoRun()) {
        initEnvironment(t);

        setRunTime(t);
    }

    readParameters(dict);
}
pythonIntegrationFunctionObject::pythonIntegrationFunctionObject
(
    const word& name,
    const Time& t,
    const dictionary& dict
)
:
    simpleFunctionObject(
        name,
        t,
        dict
    ),
    pythonInterpreterWrapper(
        t.db(),
        dict
    ),
    time_(t)
{
    Pbug << "Constructor" << endl;

    if(!parallelNoRun()) {
        initEnvironment(t);

        setInterpreter();
        PyObject *m = PyImport_AddModule("__main__");
        PyObject_SetAttrString(
            m,
            "functionObjectName",
            PyString_FromString(this->name().c_str())
        );
        releaseInterpreter();

        setRunTime();
    }

    read(dict);
}
scalar setDeltaTWithPythonFunctionObject::deltaT()
{
    if(!parallelNoRun()) {
        setRunTime(time());
    }

    if(writeDebug()) {
        Pbug << "Evaluating " << deltaTCode_ << endl;
    }

    scalar result=evaluateCodeScalar(deltaTCode_,true);

    if(writeDebug()) {
        Pbug << "Evaluated to " << result << endl;
    }

    if(result!=time().deltaT().value()) {
        Info << "Changing timestep because " << deltaTCode_
            << " evaluated to " << result << "(current deltaT: "
            << time().deltaT().value() << " in " << name() << endl;
    }

    return result;
}