Esempio n. 1
0
const std::vector<REAL> & cSetEqFormelles::VAddEqFonctToSys
     (
                  cElCompiledFonc * aFonct,
                  const std::vector<double> & aVPds,
                  bool WithDerSec
     )
{

     AssertClosed();
if (1)
{
   aFonct->Std_AddEqSysSurResol
   (
        false,
        aVPds,
        mAlloc.ValsVar(),
        *mSys,
        *this,
        true
   );
}
     const std::vector<REAL> & aRes = aFonct->Vals();

     return aRes;
}
Esempio n. 2
0
void  cSetEqFormelles::AddContrainte(const cContrainteEQF & aContr,bool Stricte)
{  
     AssertClosed();

     cElCompiledFonc * aFonct = aContr.FctrContrEQF();

     if (aContr.ContrainteIsStricte())
     {
        if (Stricte)
        {
            aFonct->Std_AddEqSysSurResol
            (
                 true,
                 0.0,
                 mAlloc.ValsVar(),
                 *mSys,
                 *this,
                 true
            );
       }
     }
     else
     {
        if (!Stricte)
        {

            double anEc = ElAbs(ResiduSigne(aFonct));
            double aPds = aContr.PdsOfEcart(anEc);
            VAddEqFonctToSys(aFonct,aPds,false);
        }
     }
}
Esempio n. 3
0
cElemEqFormelle::tContFcteur  cElemEqFormelle::FoncRapp(INT i0,INT i1,const double * vals)
{
   AssertClosed();
   mSet.AssertClosed();
   tContFcteur aRes;
   for (INT i=i0; i<i1 ; i++)
   {
      *mAdrFR[i]  = vals[i];
      mFoncRap[i]->SetCoordCur(mSet.Alloc().ValsVar());
      aRes.push_back( mFoncRap[i]);
   }

   return aRes;
}
Esempio n. 4
0
const std::vector<REAL> & cSetEqFormelles::AddEqIndexeToSys
                          (
                              cElCompiledFonc * aFonct,
                              REAL aPds,
                              const std::vector<INT>  & aVInd
                          )
{
     AssertClosed();
     aFonct->SVD_And_AddEqSysSurResol
     (
          false,
          aVInd,
          aPds,
          mAlloc.ValsVar(),
          *mSys,
          *this,
          true
     );
     return aFonct->Vals();
}
Esempio n. 5
0
void Editor::Open(OpenMode mode)
{
	AssertClosed();

	if (ValueUserScreen::Get()) //????
	{
		ValueUserScreen::Set(false);
		Far::Api->UI->SaveUserScreen();
	}

	// strings
	PIN_ES(pinFileName, _FileName);
	PIN_ES(pinTitle, _Title);

	// frame
	int nLine = _frameStart.CaretLine >= 0 ? _frameStart.CaretLine + 1 : -1;
	int nPos = _frameStart.CaretColumn >= 0 ? _frameStart.CaretColumn + 1 : -1;

	// from dialog? set modal
	WindowKind wt = Far::Api->Window->Kind;
	if (wt == WindowKind::Dialog || Far::Api->UI->IsCommandMode)
		mode = OpenMode::Modal;

	// flags
	int flags = 0;

	if (ES(_FileName)) // Far 3.0.2400
		flags |= EF_CREATENEW;

	if (_DisableHistory)
		flags |= EF_DISABLEHISTORY;

	switch(_Switching)
	{
	case FarNet::Switching::Enabled:
		flags |= VF_ENABLE_F6;
		break;
	case FarNet::Switching::Auto:
		if (_DeleteSource == FarNet::DeleteSource::None &&
			_Closed == nullptr &&
			_GotFocus == nullptr &&
			_LosingFocus == nullptr &&
			_Opened == nullptr &&
			_Saving == nullptr &&
			_KeyDown == nullptr &&
			_KeyUp == nullptr &&
			_MouseClick == nullptr &&
			_MouseDoubleClick == nullptr &&
			_MouseMove == nullptr &&
			_MouseWheel == nullptr &&
			_Redrawing == nullptr)
			flags |= VF_ENABLE_F6;
		break;
	}

	switch(_DeleteSource)
	{
	case FarNet::DeleteSource::UnusedFile:
		flags |= EF_DELETEONLYFILEONCLOSE; break;
	case FarNet::DeleteSource::UnusedFolder:
		flags |= EF_DELETEONCLOSE; break;
	}

	switch(mode)
	{
	case OpenMode::None:
		flags |= (EF_NONMODAL | EF_IMMEDIATERETURN); break;
	case OpenMode::Wait:
		flags |= EF_NONMODAL; break;
	}

	// open:
	// - set ID to -1 just in case if it is reopened;
	// - it fires READ event and the host sets the Id;
	// - in any case after this ID = -1 means an error
	_id = -1;
	Editor0::_editorWaiting = this;
	Info.Editor(
		pinFileName,
		pinTitle,
		_Window.Left,
		_Window.Top,
		_Window.Right,
		_Window.Bottom,
		flags,
		nLine,
		nPos,
		_CodePage); //?? test window values, make window settable

	// redraw Far
	if (wt == WindowKind::Dialog)
		Far::Api->UI->Redraw();

	//! Check errors: ID must not be -1 (even if it is already closed then ID = -2).
	//! Using Far diagnostics fires false errors, e.g.:
	//! Test-CallStack-.ps1 \ s \ type: exit \ enter
	//! SVN tag 4.2.26
	if (_id == -1)
	{
		// - error or a file was already opened in the editor and its window is activated
		Editor^ editor = Editor0::GetCurrentEditor();
		if (editor)
		{
			String^ fileName1 = Path::GetFullPath(_FileName);
			String^ fileName2 = Path::GetFullPath(editor->_FileName);
			if (Compare(fileName1, fileName2) == 0)
			{
				// goto?
				if (nLine >= 0 || nPos >= 0)
					editor->GoTo(_frameStart.CaretColumn, _frameStart.CaretLine);
				return;
			}
		}
		throw gcnew InvalidOperationException("Cannot open the file '" + (FileName ? FileName : "<null>") + "'");
	}
}
Esempio n. 6
0
void Editor::DisableHistory::set(bool value)
{
	AssertClosed();
	_DisableHistory = value;
}
Esempio n. 7
0
void Editor::Switching::set(FarNet::Switching value)
{
	AssertClosed();
	_Switching = value;
}
Esempio n. 8
0
void cSetEqFormelles::Solve(double ExpectResidu,bool *OK)
{
    AssertClosed();

    // Precaution anti degenerescence :
    for 
    ( 
        std::list<cEqfBlocIncTmp *>::iterator itB=mLBlocTmp.begin();
        itB != mLBlocTmp.end();
	itB++
    )
    {
        int I0 = (*itB)->IncInterv().I0Solve();
        int I1 = (*itB)->IncInterv().I1Solve();
        for (int aK=I0; aK<I1 ; aK++)
        {
	    mSys->SetElemQuad(aK,aK,1);
        }
    }

    

    if (false)
    {
        ShowSpectrSys(*this);
        std::cout << "SetEqFormelles::Solve:DoneIntervvvvvvvvvvvvv \n";
        getchar();
    }

    if (::DebugPbCondFaisceau)
    {
/*
        std::cout << "======== BEGIN GLOB  TestPbFaisceau======== \n";
        TestPbFaisceau(true,true,true);
        std::cout << "======== DONE GLOB  TestPbFaisceau======== \n";
*/
    }



    mSolQuad = mSys->GSSR_Solve(OK);
    if (OK)
    {
       ELISE_ASSERT(OK,"Solve pb detected in cSetEqFormelles::SolveResetUpdate");
    }

   if (ExpectResidu >=0)
   {
          Im1D_REAL8  aV0(mNbVar,0.0);
/*
          for (INT aK=0 ; aK < mNbVar; aK++)
          {
              aDC[aK]  = mAlloc.GetVar(aK);
          }
*/
          double aR0 = mSys->ResiduOfSol(aV0.data());
          double aDif = ElAbs(aR0-ExpectResidu) / (1e-8+ExpectResidu);
          if ((aDif>1e-7) && DoCheckResiduPhgrm)
          {
              if (aDif>=1e-1)
              {
                  std::cout 
                     <<  " COST 0 :  " << aR0
                     <<  " COST SOL " <<  mSys->ResiduOfSol(mSolQuad.data())
                     <<  "  EXP  " <<  ExpectResidu
                     <<  "  DIF  " <<  aDif
                     << "\n";
/*
*/

              // cSetEqFormelles::AddEqLineaire : 
                 ELISE_ASSERT(false,"Expect Residu in mSetEq.SolveResetUpdate");
              }
          }

    }
    
    mSolQuad = ReordonneSol(mSolQuad);
    mCurSol.Resize(mSolQuad.tx());

    REAL * aDC = mCurSol.data();
    for (INT aK=0 ; aK < mNbVar; aK++)
    {
        aDC[aK]  = mAlloc.GetVar(aK);
    }
}