예제 #1
0
 void registerDefined(ulong headerNum) 
 {
  CALL("registerDefined(ulong headerNum)");
  DOP(_defined.unfreeze());
  _defined.sub(headerNum) = true;
  DOP(_defined.freeze());
 };
 inline void integrationReset(const Symbol& fun)
 {
   CALL("integrationReset(const Symbol& fun)");
   ASSERT(fun.isComplex());
   DOP(tree.unfreeze());
   integrator.reset(fun,&(tree.sub(fun.functor())));
   DOP(tree.freeze());
 };    
예제 #3
0
      void pushAncestor(Clause* cl,long depth) 
	{
	  CALL("pushAncestor(Clause* cl)");
	  DOP(_ancestors.unfreeze());
	  _ancestors.pushSafe(cl);
	  DOP(_ancestors.freeze()); 
	  if (depth + 1 > _inferenceDepth) _inferenceDepth = depth + 1;
	};
 void associate(ulong var,const Flatterm* term)
   {
     CALL("associate(ulong var,const Flatterm* term)");
     ASSERT(!_debugVariables.coefficient(var));
     _subst[var] = term;
     DOP(_debugVariables.add1(var));
   };
예제 #5
0
 void init()
 {
   CALL("init()");
   _subst.init();
   _termTraversal1.init(&_subst);
   _termTraversal2.init(DOP("SubsumptionCheck::_termTraversal2"));
 };
예제 #6
0
  void ResetBacktracking()
    {
      CALL("ResetBacktracking()");
      if (_codeMemory.size())
       {
        DOP(_backtrackPoints.unfreeze());
        DOP(_backtrackActions.unfreeze());
        
        _backtrackPoints.expand(_codeMemory.size() - 1);
        _backtrackActions.expand(_codeMemory.size() - 1);

        DOP(_backtrackPoints.freeze());
        DOP(_backtrackActions.freeze());
       };
      _backtrackPoints.reset();
      _backtrackActions.reset();
    };
예제 #7
0
  void CompilePseudoLiteral(TERM header,PrefixSym* arg)
    {
      CALL("CompilePseudoLiteral(TERM header,PrefixSym* arg)");

      ASSERT(_dataMemory.size() >= _codeMemory.size());
      end_of_code = _codeMemory.memory();
      PrefixSym* dmem = _dataMemory.memory();
      while (!compiler.CompilePseudoLiteral(header,arg,end_of_code,dmem,_codeMemory.size()))
       {
	DOP(_codeMemory.unfreeze());
        DOP(_dataMemory.unfreeze());
        _codeMemory.expand();
        _dataMemory.expand(_codeMemory.size() - 1);
        DOP(_codeMemory.freeze());
        DOP(_dataMemory.freeze());
        end_of_code = _codeMemory.memory();
        dmem = _dataMemory.memory();
       };
      ASSERT(_dataMemory.size() >= _codeMemory.size());
     
      ResetBacktracking();
    };
예제 #8
0
 void init(const char* name) 
 {
  CALLM(name,"init(const char* name)");
  #ifndef DEBUG_NAMESPACE
   _score.init(0L);
  #else
   _score.init(0L,"ExpandingMultiset<..>::_score"); 
  #endif 
  _registered.init(DOP("ExpandingMultiset<..>::_registered")); 
  #ifdef DEBUG_NAMESPACE
   _name = name;
  #endif
 };
예제 #9
0
 ExpandingMultiset(const char* name)  :
   #ifndef DEBUG_NAMESPACE
   _score(0L),
  #else
   _score(0L,"ExpandingMultiset<..>::_score"), 
  #endif
   _registered(DOP("ExpandingMultiset<..>::_registered"))
  #ifdef DEBUG_NAMESPACE
   , _name(name)
  #endif
 {
  CALL("constructor ExpandingMultiset(const char* name)");
 };
예제 #10
0
  void CompileLiteral(PrefixSym* lit)
    {
      CALL("CompileLiteral(PrefixSym* lit)");


      ASSERT(_dataMemory.size() >= _codeMemory.size());
      end_of_code = _codeMemory.memory();
      PrefixSym* dmem = _dataMemory.memory();
      while (!compiler.CompileLiteral(lit,end_of_code,dmem,_codeMemory.size()))
       {
	DOP(_codeMemory.unfreeze());
        DOP(_dataMemory.unfreeze());
        _codeMemory.expand();
        _dataMemory.expand(_codeMemory.size() - 1);
        DOP(_codeMemory.freeze());
        DOP(_dataMemory.freeze());
        end_of_code = _codeMemory.memory();
        dmem = _dataMemory.memory();
       };
      ASSERT(_dataMemory.size() >= _codeMemory.size());
      ResetBacktracking();
    };
예제 #11
0
 void init() 
 {
  CALLM("?","init()");
  
  #ifndef DEBUG_NAMESPACE
   _score.init(0L);
  #else
   _score.init(0L,"ExpandingMultiset<..>::_score"); 
  #endif
  _registered.init(DOP("ExpandingMultiset<..>::_registered")); 
  #ifdef DEBUG_NAMESPACE
   _name = "?";
  #endif
 };  
    ForwardMatchingWithOriginalCodeTrees() 
      : 
#ifdef NO_DEBUG 
      tree(0,0),
#else
      tree(0,"ForwardMatchingWithOriginalCodeTrees<..>::tree"),
#endif
      integrator(subst), 
      removal(subst)
    {
      CALL("constructor ForwardMatchingWithOriginalCodeTrees()");
      DOP(tree.freeze());
#ifndef NO_DEBUG_VIS
      _output.setSubst(subst);
#endif     
    };
예제 #13
0
파일: system-state.cpp 프로젝트: uqs/avalon
int
main (int argc, const char * argv[])
{
	RtxThread * th;
    int ret;

	// Process the command line
    if ((ret = RTX_GETOPT_CMD (producerOpts, argc, argv, NULL, 
			       producerHelpStr)) == -1) {
        RTX_GETOPT_PRINT (producerOpts, argv[0], NULL, producerHelpStr);
        exit (1);
    }
    rtx_main_init ("store-producer", RTX_ERROR_STDERR);

	// Open the store
	DOB(store.open());

	// Register the DataExample data type
	DOC(DDX_STORE_REGISTER_TYPE (store.getId(), SystemState));

	// Create output variable
	DOB(store.registerVariable(dataV,varname,"SystemState"));

	// Start the working thread
    DOP(th = rtx_thread_create ("thfunc", 0,
				 RTX_THREAD_SCHED_OTHER, RTX_THREAD_PRIO_MIN, 0, 
				 RTX_THREAD_CANCEL_DEFERRED,
				 production_thread, NULL,
				 NULL, NULL));

	// Wait for Ctrl-C
    DOC (rtx_main_wait_shutdown (0));
	rtx_message_routine ("Caught SIGINT/SIGQUIT, exiting ...");

	done = 1;
	// Terminating the thread
    rtx_thread_destroy_sync (th);

	// The destructors will take care of cleaning up the memory
    return (0);
}
예제 #14
0
      void init()
      {
	_rules.init();
	_ancestors.init(DOP("OpenClauseBackground::_ancestors"));
      };
예제 #15
0
      OpenClauseBackground() 
	: _ancestors(DOP("OpenClauseBackground::_ancestors"))
	{
	  DOP(_ancestors.freeze());
	};
예제 #16
0
 SubsumptionCheck() : 
   _termTraversal1(&_subst), 
   _termTraversal2(DOP("SubsumptionCheck::_termTraversal2")) 
   {
   };
예제 #17
0
glm::mat4x4 ComputeMperpar(glm::vec3 const& vrp, glm::vec3 const& vpn, glm::vec3 const& vup,
			   glm::vec3 const& prp,
			   glm::vec2 const& window_lower_left, glm::vec2 const& window_upper_right,
			   float front_clipping_plane, float back_clipping_plane)
{
    std::cout << "-->ComputeNper()" << std::endl;

    glm::vec3 n(glm::normalize(vpn));
    glm::vec3 u(glm::normalize(glm::cross(vup, vpn)));
    glm::vec3 v(glm::normalize(glm::cross(n, u)));

    std::cout << "Eye coordinate system:" << std::endl;
    std::cout << horizline << std::endl;
    std::cout << "   vrp = " << vrp << std::endl;
    std::cout << "   vup = " << vup << std::endl;
    std::cout << std::endl;
    std::cout << "   u   = " << u << std::endl;
    std::cout << "   v   = " << v << std::endl;
    std::cout << "   n   = " << n << std::endl;
    std::cout << std::endl;
    std::cout << "   prp = " << prp << std::endl;
    std::cout << std::endl;
    std::cout << "   window lower left  = " << window_lower_left  << std::endl;
    std::cout << "   window upper right = " << window_upper_right << std::endl;
    std::cout << std::endl;
    std::cout << "   front clipping plane = " << std::setw(6) << std::setprecision(4)
	      << front_clipping_plane << std::endl;
    std::cout << "   back clipping plane  = " << std::setw(6) << std::setprecision(4)
	      << back_clipping_plane << std::endl;
    std::cout << std::endl;

    // Make the ViewOrientation Matrix
    std::cout << "Make the ViewOrientation Matrix" << std::endl;

    glm::mat4x4 T_vrp = glm::translate(-vrp);
    std::cout << "T(-vrp)" << std::endl;
    std::cout << horizline << std::endl;
    std::cout << T_vrp << std::endl;

    glm::mat4x4 Rotation;
    Rotation = glm::row(Rotation, 0, glm::vec4(u, 0.0f));
    Rotation = glm::row(Rotation, 1, glm::vec4(v, 0.0f));
    Rotation = glm::row(Rotation, 2, glm::vec4(n, 0.0f));

    std::cout << "Rotation(u, v, n)" << std::endl;
    std::cout << horizline << std::endl;
    std::cout << Rotation << std::endl;

    // Here is the ViewOrientation Matrix
    glm::mat4x4 ViewOrientation = Rotation * T_vrp;
    std::cout << "ViewOrientation = Rotation * T_vrp" << std::endl;
    std::cout << horizline << std::endl;
    std::cout << ViewOrientation << std::endl;



    // Make the ViewProjection Matrix
    std::cout << "Make the ViewProjection Matrix" << std::endl;

    // Translate top of the view pyramid to the origin
    glm::mat4x4 T_prp = glm::translate(-prp);
    std::cout << "T(-prp)" << std::endl;
    std::cout << horizline << std::endl;
    std::cout << T_prp << std::endl;

    // Make the shear matrix SHxy
    glm::vec3 CW((window_upper_right + window_lower_left) / 2.0f, 0.0f);
    glm::vec3 DOP(prp - CW);
    float shx = 0.0f;
    float shy = 0.0f;
    if (DOP.z != 0.0f) {
	shx = -DOP.x / DOP.z;
	shy = -DOP.y / DOP.z;
    }
    glm::mat4x4 SHxy(glm::shearXY(shx, shy));
    std::cout << "SHxy(DOP.u / DOP.n, DOP.v /DOP.n)" << std::endl;
    std::cout << horizline << std::endl;
    std::cout << SHxy << std::endl;
    
    // Make the scale matrix S
    float sx = 2.0f * prp.z / (window_upper_right.x - window_lower_left.x);
    float sy = 2.0f * prp.z / (window_upper_right.y - window_lower_left.y);
    float s  = -1.0f / (back_clipping_plane - prp.z);

    glm::mat4x4 S(glm::scale(glm::vec3(sx * s, sy * s, s)));
    std::cout << "Scaling matrix" << std::endl;
    std::cout << horizline << std::endl;
    std::cout << S << std::endl;

    glm::mat4x4 ViewProjection(S * SHxy * T_prp);
    std::cout << "ViewProjection = S * Shxy * T(-prp)" << std::endl;
    std::cout << horizline << std::endl;
    std::cout << ViewProjection << std::endl;

    // Make the matrix Mperpar
    float Zmax = -(front_clipping_plane - prp.z) / (back_clipping_plane - prp.z);
    glm::mat4x4 Mperpar(glm::vec4(1.0f, 0.0f, 0.0f, 0.0f),
			glm::vec4(0.0f, 1.0f, 0.0f, 0.0f),
			glm::vec4(0.0f, 0.0f, 1.0f / (1 + Zmax), -1.0f),
			glm::vec4(0.0f, 0.0f, -Zmax / (1.0f + Zmax), 0.0f));
    std::cout << "Mperpar" << std::endl;
    std::cout << horizline << std::endl;
    std::cout << Mperpar << std::endl;

    glm::mat4x4 Mtotal(Mperpar * ViewProjection * ViewOrientation);
    std::cout << "Mtotal = Mperpar * ViewProjection * ViewOrientation" << std::endl;
    std::cout << horizline << std::endl;
    std::cout << Mtotal << std::endl;

#if 0
    std::cout << "Test of the extreme points" << std::endl;
    std::cout << horizline << std::endl;
    glm::vec4 p(glm::vec4(1.0f, 1.0f, -1.0f, 1.0f));
    glm::vec4 pt = Mperpar * p;
    std::cout << "p = [" << p << "] --> [" << pt << "] --> [" << p / p.w << "]" << std::endl;

    glm::vec4 q(glm::vec4(-Zmax, -Zmax, Zmax, 1.0f));
    glm::vec4 qt = Mperpar * q;
    std::cout << "q = [" << q << "] --> [" << qt << "] --> [" << qt / qt.w << "]" << std::endl;
#endif
    std::cout << std::endl;
    std::cout << "<--ComputeNper()" << std::endl;

    std::cout << std::endl;

    // return the final matrix Mperpar * Nper
    return Mtotal;
}
 void reset() 
   {
     DOP(_debugVariables.reset());
   };