Exemplo n.º 1
0
// --------------------------------------------------------------------------
Property::Property(PropertyService *owner, const std::string &name,
                   const std::string &chunk_name, std::string inheritorName)
    : mName(name), mChunkName(chunk_name), mVerMaj(1), mVerMin(1),
      mPropertyStorage(NULL), mOwner(owner), mBuiltin(false) {

    // Find the inheritor by the name, and assign too
    mInheritService = GET_SERVICE(InheritService);
    mInheritor = mInheritService->createInheritor(inheritorName);

    // And as a final step, register as inheritor listener
    Inheritor::ListenerPtr cil(
        new ClassCallback<InheritValueChangeMsg, Property>(
            this, &Property::onInheritChange));

    mInheritorListenerID = mInheritor->registerListener(cil);
}
int dScriptCompiler::CompileSource (const char* const source)
{
	dLittleScriptLexical scanner (source);

	bool status = Parse(scanner);

	if (status) {
		for (dList<dDAGClassNode*>::dListNode* node = m_classList.GetFirst(); node; node = node->GetNext()) {
			dDAGClassNode* const scripClass =  node->GetInfo();
			scripClass->ConnectParent (NULL);
		}

		llvm::Module* const module = m_module.get();
		dCIL cil (module);


		for (dList<dDAGClassNode*>::dListNode* node = m_classList.GetFirst(); node; node = node->GetNext()) {
			dDAGClassNode* const scripClass = node->GetInfo();
			scripClass->CompileCIL (cil);
		}

#if 0
		cil.Trace();
		dDAG::dLLVMSymbols globalLLVMSymbols;
		for (dList<dDAGClassNode*>::dListNode* node = m_classList.GetFirst(); node; node = node->GetNext()) {
			dDAGClassNode* const scripClass = node->GetInfo();
			scripClass->AddLLVMGlobalSymbols (cil, module, m_context, globalLLVMSymbols);
		}
		
		for (dList<dDAGClassNode*>::dListNode* node = m_classList.GetFirst(); node; node = node->GetNext()) {
			dDAGClassNode* const scripClass = node->GetInfo();
			scripClass->TranslateToLLVM (cil, module, m_context, globalLLVMSymbols);
			//_ASSERTE (m_currentPackage);
			//m_currentPackage->AddClass(scripClass, cil);
		}


		if (llvm::verifyModule(*module)) {
			llvm::errs() << ": Error constructing function!\n";
			dAssert (0);
		}
		llvm::errs() << *module;
		//CreateLLVMTargetMachine (module);
		cil.Clear();
		llvm::Module::FunctionListType& funtionList = module->getFunctionList();
		for (llvm::Module::FunctionListType::iterator iter (funtionList.begin()); iter != funtionList.end(); iter ++) {
			const llvm::Function& funtion = *iter;
			cil.ConvertLLVMFunctionToNVMFunction (funtion);
		}
#endif

		//cil.Trace();
		for (dList<dDAGClassNode*>::dListNode* node = m_classList.GetFirst(); node; node = node->GetNext()) {
			dDAGClassNode* const scripClass = node->GetInfo();
			scripClass->ConvertToTarget (cil);
		}

		dVirtualMachine* const program = cil.BuilExecutable();

		delete program;
	}
	return 0;
}
Exemplo n.º 3
0
void CalcoloVIZ::classifico_VIZ()
{
    float cil_Z,base;
    Matrix2D<double> Zabb(Matrix2D<double>::Zero(cil.slices.size(), x_size));
    Matrix2D<double> Zbbb(Matrix2D<double>::Zero(cil.slices.size(), x_size));
    double ext_abb,ext_bbb;
    float LIM_VERT= 8.;//questo l'ho messo io
    long int ncv = 0;

    unsigned kbbb=floor(hbbb/res_vert_cil);   //08/01/2013...MODIFICA, inserito questo dato
    unsigned ktbb=ceil(htbb/res_vert_cil);
    unsigned kmax=ceil(LIM_VERT/res_vert_cil);
    // kmax=ceil(z_size/res_vert_cil);

    if (t_ground < T_MAX_ML) kmax=0;/////se t suolo dentro t melting layer pongo kmax=00 e in tal modo non classifico
    if (ktbb>z_size) ktbb=z_size;
    LOG_DEBUG("kmax= %i \n kbbb= %i \n ktbb= %i \n  z_size= %i",kmax,kbbb,ktbb,z_size);

    //inizio l'integrazione
    for(unsigned i=0; i<cil.slices.size(); i++){
        for(unsigned j=0; j<x_size; j++)
        {
            ext_abb=0.;
            ext_bbb=0.;

            //modifica 08/01/2013 .. afggiungo questo ..per fare l'integrazione anche con i dati sotto la bright band
            for(unsigned k=0; k<kbbb; k++)
            {
                if (cil(i, j, k) > -19.){   // 08/01/2013..modifica, prendo fin dove ho un segnale
                    base=(cil(i, j, k))/10.;
                    cil_Z=pow(10.,base);
                    Zbbb(i, j) = Zbbb(i, j) + res_vert_cil*cil_Z;
                    ext_bbb=res_vert_cil+ext_bbb;
                }
            }
//std::cout<<"Z_size :"<<z_size<<" kbbb :"<<kbbb<<" ktbb "<<ktbb<<std::endl;
            for(unsigned k=kbbb; k<ktbb; k++)
            {
                if (k < 4 ){
                    if (cil(i, j, k)>10. &&  cil(i, j, k+4)> 5.){
                        if (cil(i, j, k) - cil(i, j, k+4) > 5.)
                            stratiform(i, j)=1;
                    }
                }
                else if (cil(i, j, k)>10. &&  cil(i, j, k+4)> 5. &&  cil(i, j, k-4) > 5.){
                    if (cil(i, j, k) - cil(i, j, k+4) > 5.&&   cil(i, j, k)- cil(i, j, k-4) > 5. )
                        stratiform(i, j)=1;

                }


                if (cil(i, j, k) - cil(i, j, k+4) > 5.)
                    stratiform(i, j)=1;

                for(k=ktbb; k<kmax; k++)
                {
                    if (cil(i, j, k) > -19.){    // 08/01/2013..modifica, prendo fin dove ho un segnale
                        base=(cil(i, j, k))/10.;
                        cil_Z=pow(10.,base);
                        Zabb(i, j) = Zabb(i, j) + res_vert_cil*cil_Z;
                        ext_abb=res_vert_cil+ext_abb;
                    }
                }


                //solo se l'estensione verticale del segnale sopra il top della bright band è maggiore di 0.8 Km classifico

                if (ext_bbb +  ext_abb>0.8) {
                    //if ( ext_abb>0.8) {
                    if ((Zabb(i, j) +Zbbb(i, j))/(ext_bbb+ext_abb) > THR_VIZ){
                        //if ((Zabb(i, j) /ext_abb) > THR_VIZ){
                        conv_VIZ(i, j)=CONV_VAL;
                        //lista_conv[ncv][0]= i;
                        //lista_conv[ncv][1]= j;
                        ncv=ncv+1;
                    }
                }

            }
        }
    }
    LOG_DEBUG("numero nuclei VIZ = %li",ncv);

    return;
}