Пример #1
0
tERROR cTmProfile::CreateTask()
{
	if( !m_iid || m_bTaskGroup && !isService() && m_cfg.m_bRemote )
		return errOK;

	tERROR err = errOK;
	cAutoObj<cObj> task;

	PR_TRACE((m_tm, prtIMPORTANT, "tm\t%S - creating task...", m_sName.data()));

	if( m_cfg.m_bRemote )
		err = m_tm->CreateRemoteTask(this, task);
	else
		err = m_host->sysCreateObject((cObj**)&task, m_iid, m_pid);

	if( PR_SUCC(err) )
	{
		tDWORD nActivityId = m_dad && m_dad->m_dad ? m_dad->id() : id();

		task->propSetDWord( pgTASK_ID, id() );
		task->propSetDWord( pgTASK_PARENT_ID, nActivityId );
		task->propSetDWord( m_tm->m_prop_taskid, nActivityId );
		m_sType.copy( task, m_tm->m_prop_task_type );
		m_sName.copy( task, m_tm->m_prop_profile );
		InitDataStorage(task);

		err = AttachTask(task);
	}

	if( PR_SUCC(err) )
		task.relinquish();
	else
		PR_TRACE((m_tm, prtERROR, "tm\t%S - cannot create task object - %terr", m_sName.data(), err));

	return err;
}
Пример #2
0
int Operator::CalcECOperator( DebugFlags debugFlags )
{
	Init_EC();
	InitDataStorage();

	if (Calc_EC()==0)
		return -1;

	m_InvaildTimestep = false;
	opt_dT = 0;
	if (dT>0)
	{
		double save_dT = dT;
		CalcTimestep();
		opt_dT = dT;
		if (dT<save_dT)
		{
			cerr << "Operator::CalcECOperator: Warning, forced timestep: " << save_dT << "s is larger than calculated timestep: " << dT << "s! It is not recommended using this timestep!! " << endl;
			m_InvaildTimestep = true;
		}

		dT = save_dT;
	}
	else
		CalcTimestep();

	InitOperator();

	unsigned int pos[3];

	for (int n=0; n<3; ++n)
	{
		for (pos[0]=0; pos[0]<numLines[0]; ++pos[0])
		{
			for (pos[1]=0; pos[1]<numLines[1]; ++pos[1])
			{
				for (pos[2]=0; pos[2]<numLines[2]; ++pos[2])
				{
					Calc_ECOperatorPos(n,pos);
				}
			}
		}
	}

	//Apply PEC to all boundary's
	bool PEC[6]={1,1,1,1,1,1};
	//make an exception for BC == -1
	for (int n=0; n<6; ++n)
		if ((m_BC[n]==-1))
			PEC[n] = false;
	ApplyElectricBC(PEC);

	CalcPEC();

	Calc_LumpedElements();

	bool PMC[6];
	for (int n=0; n<6; ++n)
		PMC[n] = m_BC[n]==1;
	ApplyMagneticBC(PMC);

	InitExcitation();

	//all information available for extension... create now...
	for (size_t n=0; n<m_Op_exts.size(); ++n)
		m_Op_exts.at(n)->BuildExtension();

	if (debugFlags & debugMaterial)
		DumpMaterial2File( "material_dump" );
	if (debugFlags & debugOperator)
		DumpOperator2File( "operator_dump" );
	if (debugFlags & debugPEC)
		DumpPEC2File( "PEC_dump" );

	//cleanup
	for (int n=0; n<3; ++n)
	{
		delete[] EC_C[n];
		EC_C[n]=NULL;
		delete[] EC_G[n];
		EC_G[n]=NULL;
		delete[] EC_L[n];
		EC_L[n]=NULL;
		delete[] EC_R[n];
		EC_R[n]=NULL;
	}

	return 0;
}