コード例 #1
0
ファイル: Function.cpp プロジェクト: JeremieA/fastbuild
// GetStrings
//------------------------------------------------------------------------------
bool Function::GetStrings( const BFFIterator & iter, Array< AString > & strings, const char * name, bool required ) const
{
	const BFFVariable * var;
	if ( !GetStringOrArrayOfStrings( iter, var, name, required ) )
	{
		return false; // problem (GetStringOrArrayOfStrings will have emitted error)
	}
	if ( !var )
	{
		ASSERT( !required );
		return true; // not required and not provided: nothing to do
	}

	if ( var->GetType() == BFFVariable::VAR_STRING )
	{
		strings.Append( var->GetString() );
	}
	else if ( var->GetType() == BFFVariable::VAR_ARRAY_OF_STRINGS )
	{
		const Array< AString > & vStrings = var->GetArrayOfStrings();
		strings.Append( vStrings );
	}
	else
	{
		ASSERT( false );
	}
	return true;
}
コード例 #2
0
  void MyHighOrderFESpace :: GetDofNrs (int elnr, Array<int> & dnums) const
  {
    // returns dofs of element number elnr

    dnums.SetSize(0);

    Ngs_Element ngel = ma->GetElement (elnr);

    // vertex dofs
    for (int i = 0; i < 3; i++)
      dnums.Append (ngel.vertices[i]);

    // edge dofs
    for (int i = 0; i < 3; i++)
      {
        int first = first_edge_dof[ngel.edges[i]];
        int next  = first_edge_dof[ngel.edges[i]+1];
        for (int j = first; j < next; j++)
          dnums.Append (j);
      }

    int first = first_cell_dof[elnr];
    int next  = first_cell_dof[elnr+1];
    for (int j = first; j < next; j++)
      dnums.Append (j);

    // cout << "dnums = " << dnums << endl;
  }
コード例 #3
0
ファイル: msghandler.cpp プロジェクト: 11235813/netgen-csg2d
void PushStatusF(const MyStr& s)
{
  msgstatus_stack.Append(new MyStr (s));
  SetStatMsg(s);
  threadpercent_stack.Append(0);
  PrintFnStart(s);
}
コード例 #4
0
ファイル: optparser.hpp プロジェクト: YPCC/mfem
 void AddOption(bool *var, const char *enable_short_name,
                const char *enable_long_name, const char *disable_short_name,
                const char *disable_long_name, const char *description,
                bool required = false)
 {
    options.Append(Option(ENABLE, var, enable_short_name, enable_long_name,
                          description, required));
    options.Append(Option(DISABLE, var, disable_short_name, disable_long_name,
                          description, required));
 }
コード例 #5
0
// TestFunction_Speed
//------------------------------------------------------------------------------
void TestProjectGeneration::TestFunction_Speed() const
{
	VSProjectGenerator pg;
	AStackString<> baseDir( "C:\\Windows\\System32" );
	Array< AString > baseDirs;
	baseDirs.Append( baseDir );

	// project name
	pg.SetProjectName( AStackString<>( "Big" ) );
	pg.SetBasePaths( baseDirs );

	// platforms
	Array< VSProjectConfig > configs;
	VSProjectConfig cfg;
	cfg.m_Platform = "Win32";
	cfg.m_Config = "Debug";
	configs.Append( cfg );

	// files (about 5,000)
	Array< AString > files;
	FileIO::GetFiles( baseDir, AStackString<>( "*.mui" ), true, &files );
	FileIO::GetFiles( baseDir, AStackString<>( "*.exe" ), true, &files );
	FileIO::GetFiles( baseDir, AStackString<>( "*.dll" ), true, &files );
	pg.AddFiles( files );

	Array< VSProjectFileType > fileTypes;
	{
		VSProjectFileType ft;
		ft.m_FileType = "CppForm";
		ft.m_Pattern = "Code\\Forms\\*.h";
		fileTypes.Append( ft );
		ft.m_FileType = "CppControl";
		ft.m_Pattern = "Controls\\*.h";
		fileTypes.Append( ft );
	}

	AStackString<> projectFileName( "C:\\Windows\\System\\dummy.vcxproj" );

	{
		Timer t;
		pg.GenerateVCXProj( projectFileName, configs, fileTypes );
		float time = t.GetElapsed();
		OUTPUT( "Gen vcxproj        : %2.3fs\n", time );
	}
	{
		Timer t;
		pg.GenerateVCXProjFilters( projectFileName );
		float time = t.GetElapsed();
		OUTPUT( "Gen vcxproj.filters: %2.3fs\n", time );
	}
}
コード例 #6
0
ファイル: SLNGenerator.cpp プロジェクト: Samana/fastbuild
// WriteSolutionConfigs
//------------------------------------------------------------------------------
void SLNGenerator::WriteSolutionFolderListings( const Array< SLNSolutionFolder > & folders,
        Array< AString > & solutionFolderPaths )
{
    // Create every intermediate path
    const SLNSolutionFolder * const foldersEnd = folders.End();
    for( const SLNSolutionFolder * it = folders.Begin() ; it != foldersEnd ; ++it )
    {
        if ( solutionFolderPaths.Find( it->m_Path ) == nullptr )
        {
            solutionFolderPaths.Append( it->m_Path );
        }

        const char * pathEnd = it->m_Path.Find( NATIVE_SLASH );
        while ( pathEnd )
        {
            AStackString<> solutionFolderPath( it->m_Path.Get(), pathEnd );
            if ( solutionFolderPaths.Find( solutionFolderPath ) == nullptr )
            {
                solutionFolderPaths.Append( solutionFolderPath );
            }

            pathEnd = it->m_Path.Find( NATIVE_SLASH, pathEnd + 1 );
        }
    }

    solutionFolderPaths.Sort();

    // Solution Folders Listings

    const AString * const solutionFolderPathsEnd = solutionFolderPaths.End();
    for( const AString * it = solutionFolderPaths.Begin() ; it != solutionFolderPathsEnd ; ++it )
    {
        // parse solution folder name
        const char * solutionFolderName = it->FindLast( NATIVE_SLASH );
        solutionFolderName = solutionFolderName ? solutionFolderName + 1 : it->Get();

        // generate a guid for the solution folder
        AStackString<> solutionFolderGuid;
        VSProjectGenerator::FormatDeterministicProjectGUID( solutionFolderGuid, *it );

        // Guid must be uppercase (like visual)
        solutionFolderGuid.ToUpper();

        Write( "Project(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"%s\", \"%s\", \"%s\"\r\n",
               solutionFolderName, solutionFolderName, solutionFolderGuid.Get() );

        Write( "EndProject\r\n" );
    }
}
コード例 #7
0
ファイル: NAMES.CPP プロジェクト: Comanche93/eech
 unsigned operator <<= (const char* name)
 {
  Name new_name;
  strcpy(new_name.name, name);
  names.Append(new_name);
  return !names - 1;
 }
コード例 #8
0
void RegisterUserFormats (Array<const char*> & names)
{
  const char *types[] =
    {
      "Neutral Format",
      "VTU Format",
      "VTU Format, only volume",
      "Surface Mesh Format" ,
      "DIFFPACK Format",
      "TecPlot Format",
      "Tochnog Format",
      "Abaqus Format",
      "Fluent Format",
      "Permas Format",
      "FEAP Format",
      "Elmer Format",
      "STL Format",
      "VRML Format",
      "Gmsh Format",
      "Gmsh2 Format",
      "DOLFIN Format",
      "JCMwave Format",
      "TET Format",
      "Chemnitz Format", // Why not? - Mikael
      0
    };

  for (int i = 0; types[i]; i++)
    names.Append (types[i]);
}
コード例 #9
0
  void L2EnrichedQuadFESpace::GetDofNrs (int elnr, Array<int> & dnums) const {

    dnums.SetSize(0);
    int first = first_cell_dof[elnr];
    int next  = first_cell_dof[elnr+1];
    for (int j = first; j < next; j++)  dnums.Append (j);      
  }
コード例 #10
0
ファイル: csgpkg.cpp プロジェクト: liangcheng/netgen
  int Ng_SetPrimitiveData (ClientData clientData,
			   Tcl_Interp * interp,
			   int argc, tcl_const char *argv[])
  {
    CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.get());
    if (!geometry)
      {
	Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC);
	return TCL_ERROR;
      }


    tcl_const char * name = argv[1];
    tcl_const char * value = argv[2];

    Array<double> coeffs;


    cout << "Set primitive data, name = " << name
	 << ", value = " << value  << endl;


    istringstream vst (value);
    double val;
    while (!vst.eof())
      {
	vst >> val;
	coeffs.Append (val);
      }

    ((Primitive*)
     geometry->GetSolid (name)->GetPrimitive())->SetPrimitiveData (coeffs);

    return TCL_OK;
  }
コード例 #11
0
ファイル: Function.cpp プロジェクト: JeremieA/fastbuild
// PopulateStringHelper
//------------------------------------------------------------------------------
bool Function::PopulateStringHelper( const BFFIterator & iter, const Meta_Path * pathMD, const Meta_File * fileMD, const BFFVariable * variable, const AString & string, Array< AString > & outStrings ) const
{
	// Full paths to files can support aliases
	if ( fileMD && ( !fileMD->IsRelative() ) )
	{
		// Is it an Alias?
		Node * node = FBuild::Get().GetDependencyGraph().FindNode( string );
		if ( node && ( node->GetType() == Node::ALIAS_NODE ) )
		{
			AliasNode * aliasNode = node->CastTo< AliasNode >();
			for ( const auto& aliasedNode : aliasNode->GetAliasedNodes() )
			{
				if ( !PopulateStringHelper( iter, pathMD, fileMD, variable, aliasedNode.GetNode()->GetName(), outStrings ) )
				{
					return false; // PopulateStringHelper will have emitted an error
				}
			}
			return true;
		}

		// Not an alias - fall through to normal handling
	}

	AStackString<> stringToFix( string );
	if ( !PopulatePathAndFileHelper( iter, pathMD, fileMD, variable->GetName(), stringToFix ) )
	{
		return false; // PopulatePathAndFileHelper will have emitted an error
	}
	outStrings.Append( stringToFix );
	return true;
}
コード例 #12
0
ファイル: FunctionCopy.cpp プロジェクト: dontnod/fastbuild
// GetSourceNodes
//------------------------------------------------------------------------------
bool FunctionCopy::GetSourceNodes( const BFFIterator & iter, Node * node, Array< Node * > & nodes ) const
{
    if ( node->GetType() == Node::ALIAS_NODE )
    {
        // resolve aliases to real nodes
        AliasNode * aliasNode = node->CastTo< AliasNode >();
        const Dependencies & aliasedNodes = aliasNode->GetAliasedNodes();
        const Dependency * const end = aliasedNodes.End();
        for ( const Dependency * it = aliasedNodes.Begin(); it != end; ++it )
        {
            if ( !GetSourceNodes( iter, it->GetNode(), nodes ) )
            {
                return false;
            }
        }
        return true;
    }
    else if ( node->IsAFile() )
    {
        // anything that results in a file is ok
        nodes.Append( node );
        return true;
    }

    // something we don't know how to handle
    Error::Error_1005_UnsupportedNodeType( iter, this, ".Source", node->GetName(), node->GetType() );
    return false;
}
コード例 #13
0
ファイル: FunctionSLN.cpp プロジェクト: ClxS/fastbuild
// GetStringOrArrayOfStringsFromStruct
//------------------------------------------------------------------------------
bool FunctionSLN::GetStringOrArrayOfStringsFromStruct( const BFFIterator & iter, const BFFVariable * s, const char * name, Array< AString > & result ) const
{
    for ( const BFFVariable * v : s->GetStructMembers() )
    {
        if ( v->GetName() == name )
        {
			if ( ( v->IsArrayOfStrings() == false ) && ( v->IsString() == false ) )
			{
				Error::Error_1050_PropertyMustBeOfType( iter, this, name, v->GetType(), BFFVariable::VAR_ARRAY_OF_STRINGS, BFFVariable::VAR_STRING );
				return false;
			}

			if ( v->IsArrayOfStrings() )
			{
				result = v->GetArrayOfStrings();
			}
			else
			{
				result.Append( v->GetString() );
			}
			return true; // found
		}
    }

    // TODO:B custom error
    Error::Error_1101_MissingProperty( iter, this, AStackString<>( name ) );
    return false;
}
コード例 #14
0
ファイル: optparser.hpp プロジェクト: YPCC/mfem
 void AddOption(const char **var, const char *short_name,
                const char *long_name, const char *description,
                bool required = false)
 {
    options.Append(Option(STRING, var, short_name, long_name, description,
                          required));
 }
コード例 #15
0
STLGeometry *  STLTopology :: LoadNaomi (istream & ist)
{
  int i;
  STLGeometry * geom = new STLGeometry();
  Array<STLReadTriangle> readtrigs;

  PrintFnStart("read NAOMI file format");
  
  char buf[100];
  Vec<3> normal;

  //int cntface = 0;
  //int cntvertex = 0;
  double px, py, pz;
    

  int noface, novertex;
  Array<Point<3> > readpoints;

  ist >> buf;
  if (strcmp (buf, "NODES") == 0)
    {
      ist >> novertex;
      PrintMessage(5,"nuber of vertices = ", novertex);
      for (i = 0; i < novertex; i++)
	{
	  ist >> px;
	  ist >> py;
	  ist >> pz;
	  readpoints.Append(Point<3> (px,py,pz));
	}
    }
コード例 #16
0
ファイル: optparser.hpp プロジェクト: YPCC/mfem
 void AddOption(Vector * var, const char *short_name,
                const char *long_name, const char *description,
                bool required = false)
 {
    options.Append(Option(VECTOR, var, short_name, long_name, description,
                          required));
 }
コード例 #17
0
ファイル: optparser.hpp プロジェクト: YPCC/mfem
 void AddOption(Array<int> * var, const char *short_name,
                const char *long_name, const char *description,
                bool required = false)
 {
    options.Append(Option(ARRAY, var, short_name, long_name, description,
                          required));
 }
コード例 #18
0
ファイル: seti.hpp プロジェクト: 11235813/netgen-csg2d
  void Add (int ind)
  {
    if (!flags.Test(ind))
      {
	set.Append (ind);
	flags.Set (ind);
      }
  }
コード例 #19
0
ファイル: TextReader.cpp プロジェクト: dontnod/fastbuild
// ReadRef
//------------------------------------------------------------------------------
bool TextReader::ReadRef()
{
    // Name
    AStackString<> name;
    if ( !GetToken( name ) )
    {
        Error( "Missing ref name" );
        return false;
    }

    AStackString<> value;
    if ( !GetString( value ) )
    {
        Error( "Missing ref value" );
        return false;
    }

    Ref< RefObject > ref;
    if ( value != "null" )
    {
        ref = (RefObject *)ReflectionInfo::CreateObject( value );
        if ( ref.Get() == nullptr )
        {
            Error( "Unable to create sub-object" );
            ASSERT( false ); // TODO: Handle failure/skipping gracefully
            return false;
        }
    }

    const StackFrame & sf = m_DeserializationStack.Top();

    if ( sf.m_ArrayProperty )
    {
        void * arrayBase = (void *)( (size_t)sf.m_Base + (size_t)sf.m_ArrayProperty->GetOffset() );
        Array< Ref< RefObject > > *array = ( Array< Ref< RefObject > > *)( arrayBase );
        array->Append( ref );
    }
    else
    {
        sf.m_Reflection->SetProperty( sf.m_Base, name.Get(), ref );
    }

    // do sub-object properties if needed
    if ( ref.Get() )
    {
        StackFrame newFrame;
        newFrame.m_Base = (void *)ref.Get();
        newFrame.m_Reflection = ref->GetReflectionInfoV();
        newFrame.m_ArrayProperty = nullptr;
        #ifdef DEBUG
            newFrame.m_RefObject = ref.Get();
            newFrame.m_Struct = nullptr;
        #endif
        m_DeserializationStack.Append( newFrame );
    }

    return true;
}
コード例 #20
0
ファイル: stlline.cpp プロジェクト: liangcheng/netgen
void STLEdgeDataList :: BuildLineWithEdge(int ep1, int ep2, Array<twoint>& line)
{
    int status = Get(GetEdgeNum(ep1,ep2)).GetStatus();

    int found, pstart, p(0), en, pnew(0), ennew(0);
    int closed = 0;
    int j, i;
    for (j = 1; j <= 2; j++)
    {
        if (j == 1) {
            p = ep1;
        }
        if (j == 2) {
            p = ep2;
        }

        pstart = p;
        en = GetEdgeNum(ep1,ep2);

        found = 1;
        while (found && !closed)
        {
            found = 0;

            if (GetNEPPStat(p,status) == 2)
            {
                for (i = 1; i <= GetNEPP(p); i++)
                {
                    const STLTopEdge & e = Get(GetEdgePP(p,i));
                    if (GetEdgePP(p,i) != en && e.GetStatus() == status)
                    {
                        if (e.PNum(1) == p)
                        {
                            pnew = e.PNum(2);
                        }
                        else
                        {
                            pnew = e.PNum(1);
                        }

                        ennew = GetEdgePP(p,i);
                    }
                }
                if (pnew == pstart) {
                    closed = 1;
                }
                else
                {
                    line.Append(twoint(p,pnew));
                    p = pnew;
                    en = ennew;
                    found = 1;
                }
            }
        }
    }

}
コード例 #21
0
STLGeometry *  STLTopology :: LoadBinary (istream & ist)
{
  STLGeometry * geom = new STLGeometry();
  Array<STLReadTriangle> readtrigs;

  PrintMessage(1,"Read STL binary file");
  
  if (sizeof(int) != 4 || sizeof(float) != 4) 
    {
      PrintWarning("for stl-binary compatibility only use 32 bit compilation!!!");
    }

  //specific settings for stl-binary format
  const int namelen = 80; //length of name of header in file
  const int nospaces = 2; //number of spaces after a triangle

  //read header: name
  char buf[namelen+1];
  FIOReadStringE(ist,buf,namelen);
  PrintMessage(5,"header = ",buf);

  //Read Number of facets
  int nofacets;
  FIOReadInt(ist,nofacets);
  PrintMessage(5,"NO facets = ",nofacets);

  Point<3> pts[3];
  Vec<3> normal;

  char spaces[nospaces+1];

  for (int cntface = 0; cntface < nofacets; cntface++)
    {
      if (cntface % 10000 == 0)
	// { PrintDot(); } 
	PrintMessageCR (3, cntface, " triangles loaded\r");

      float f;
      FIOReadFloat(ist,f); normal(0) = f;
      FIOReadFloat(ist,f); normal(1) = f;
      FIOReadFloat(ist,f); normal(2) = f;
      
      for (int j = 0; j < 3; j++)
	{
	  FIOReadFloat(ist,f); pts[j](0) = f;
	  FIOReadFloat(ist,f); pts[j](1) = f;
	  FIOReadFloat(ist,f); pts[j](2) = f;	  
	} 

      readtrigs.Append (STLReadTriangle (pts, normal));
      FIOReadString(ist,spaces,nospaces);
    }	    
  PrintMessage (3, nofacets, " triangles loaded\r");  

  geom->InitSTLGeometry(readtrigs);

  return geom;
}
コード例 #22
0
  void MyHighOrderFESpace :: GetSDofNrs (int elnr, Array<int> & dnums) const
  {
    // the same for the surface elements

    dnums.SetSize(0);

    Ngs_Element ngel = ma->GetSElement (elnr);

    // vertex dofs
    for (int i = 0; i < 2; i++)
      dnums.Append (ngel.vertices[i]);

    // edge dofs
    int first = first_edge_dof[ngel.edges[0]];
    int next  = first_edge_dof[ngel.edges[0]+1];
    for (int j = first; j < next; j++)
      dnums.Append (j);
  }
コード例 #23
0
ファイル: adtree.cpp プロジェクト: 11235813/netgen-csg2d
  void ADTree :: GetMatch (Array <int> & matches)
  {
    int nodenr;

    Reset();

    while ( (nodenr = Next()) != -1)
      matches.Append (nodenr);
  }
コード例 #24
0
ファイル: stlline.cpp プロジェクト: liangcheng/netgen
void STLEdgeDataList :: BuildClusterWithEdge(int ep1, int ep2, Array<twoint>& line)
{
    int status = Get(GetEdgeNum(ep1,ep2)).GetStatus();

    int p(0), en;
    int j, i, k;
    int oldend;
    int newend = 1;
    int pnew, ennew(0);

    int changed = 1;
    while (changed)
    {
        changed = 0;
        for (j = 1; j <= 2; j++)
        {
            oldend = newend;
            newend = line.Size();
            for (k = oldend; k <= line.Size(); k++)
            {
                if (j == 1) p = line.Get(k).i1;
                if (j == 2) p = line.Get(k).i2;
                en = GetEdgeNum(line.Get(k).i1, line.Get(k).i2);

                for (i = 1; i <= GetNEPP(p); i++)
                {
                    pnew = 0;
                    const STLTopEdge & e = Get(GetEdgePP(p,i));
                    if (GetEdgePP(p,i) != en && e.GetStatus() == status)
                    {
                        if (e.PNum(1) == p)
                        {
                            pnew = e.PNum(2);
                        }
                        else
                        {
                            pnew = e.PNum(1);
                        }

                        ennew = GetEdgePP(p,i);
                    }
                    if (pnew && !Exists(p,pnew,line))
                    {
                        changed = 1;
                        line.Append(twoint(p,pnew));
                        p = pnew;
                        en = ennew;
                    }
                }

            }
        }

    }

}
コード例 #25
0
ファイル: validate.cpp プロジェクト: cgogn/SCHNApps
  double Validate(const Mesh & mesh, Array<ElementIndex> & bad_elements,
		  const Array<double> & pure_badness,
		  double max_worsening, const bool uselocalworsening,
		  Array<double> * quality_loss)
  {
    PrintMessage(3,"!!!! Validating !!!!");
    //if(max_worsening > 0)
    //  (*testout) << "badness " << counter++ << endl;

    bad_elements.SetSize(0);

    double loc_pure_badness = -1;

    if(!uselocalworsening)
      loc_pure_badness = pure_badness.Last(); // maximum is saved at last position


    double worsening = -1;
    ElementIndex ind;

    if(quality_loss != NULL)
      quality_loss->SetSize(mesh.GetNE());

    for (ElementIndex i = 0; i < mesh.GetNE(); i++)
      {
	if(uselocalworsening)
	  {
	    loc_pure_badness = -1;
	    for(int j=0; j<mesh[i].GetNP(); j++)
	      if(pure_badness[mesh[i][j]] > loc_pure_badness)
		loc_pure_badness = pure_badness[mesh[i][j]];
	  }


	double bad = mesh[i].CalcJacobianBadness (mesh.Points());
	if (bad > 1e10 || 
	    (max_worsening > 0 && bad > loc_pure_badness*max_worsening))
	  bad_elements.Append(i);
	  

	if(max_worsening > 0)
	  {
	    double actw = bad/loc_pure_badness;
	    if(quality_loss != NULL)
	      (*quality_loss)[i] = actw;

	    if(actw > worsening)
	      {
		worsening = actw;
		ind = i;
	      }
	  }
      }
    return worsening;
  }
コード例 #26
0
ファイル: adtree.cpp プロジェクト: 11235813/netgen-csg2d
  void ADTree3M :: GetIntersecting (const float * bmin, 
				    const float * bmax,
				    Array<int> & pis) const
  {
    static Array<ADTreeNode3M*> stack(1000);
    static Array<int> stackdir(1000);
    ADTreeNode3M * node;
    int dir, i, stacks;

    stack.SetSize (1000);
    stackdir.SetSize(1000);
    pis.SetSize(0);

    stack.Elem(1) = root;
    stackdir.Elem(1) = 0;
    stacks = 1;

    while (stacks)
      {
	node = stack.Get(stacks);
	dir = stackdir.Get(stacks); 
	stacks--;

	int * hpi = node->pi;
	for (i = 0; i < ADTN_SIZE; i++)
	  if (hpi[i])
	    {
	      float * datai = &node->data[i][0];
	      if (datai[0] >= bmin[0] && datai[0] <= bmax[0] &&
		  datai[1] >= bmin[1] && datai[1] <= bmax[1] &&
		  datai[2] >= bmin[2] && datai[2] <= bmax[2])
	      
		pis.Append (node->pi[i]);
	    }


	int ndir = dir+1;
	if (ndir == 3)
	  ndir = 0;

	if (node->left && bmin[dir] <= node->sep)
	  {
	    stacks++;
	    stack.Elem(stacks) = node->left;
	    stackdir.Elem(stacks) = ndir;
	  }
	if (node->right && bmax[dir] >= node->sep)
	  {
	    stacks++;
	    stack.Elem(stacks) = node->right;
	    stackdir.Elem(stacks) = ndir;
	  }
      }
  }
コード例 #27
0
	bool InitBrowser(const std::array<BrowserConnectionDescription, OVERLAY_COUNT> &browsers, LONG width, LONG height)
	{
		Array servers;
		for (const auto &browser : browsers)
			servers.Append(Object()
				.Set("server", browser.server)
				.Set("name", browser.name));

		return SendEvent(EventCreate("init_browser")
			.Set("servers", servers)
			.Set("width", Number(width))
			.Set("height", Number(height)));
	}
コード例 #28
0
ファイル: Report.cpp プロジェクト: hilbertdu/fastbuild
// Flatten
//------------------------------------------------------------------------------
void Report::IncludeStatsMap::Flatten( Array< const IncludeStats * > & stats ) const
{
	for ( size_t i=0; i<65536; ++i )
	{
		IncludeStats * item = m_Table[ i ];
		while ( item )
		{
			IncludeStats * next = item->m_Next;
			stats.Append( item );
			item = next;
		}
	}
}
コード例 #29
0
ファイル: adtree.cpp プロジェクト: 11235813/netgen-csg2d
  void ADTree3 :: GetIntersecting (const float * bmin, 
				   const float * bmax,
				   Array<int> & pis) const
  {
    static Array<ADTreeNode3*> stack(1000);
    static Array<int> stackdir(1000);
    ADTreeNode3 * node;
    int dir, stacks;

    stack.SetSize (1000);
    stackdir.SetSize(1000);
    pis.SetSize(0);

    stack.Elem(1) = root;
    stackdir.Elem(1) = 0;
    stacks = 1;

    while (stacks)
      {
	node = stack.Get(stacks);
	dir = stackdir.Get(stacks); 
	stacks--;

	if (node->pi != -1)
	  {
	    if (node->data[0] >= bmin[0] && node->data[0] <= bmax[0] &&
		node->data[1] >= bmin[1] && node->data[1] <= bmax[1] &&
		node->data[2] >= bmin[2] && node->data[2] <= bmax[2])

	      pis.Append (node->pi);
	  }


	int ndir = dir+1;
	if (ndir == 3)
	  ndir = 0;

	if (node->left && bmin[dir] <= node->sep)
	  {
	    stacks++;
	    stack.Elem(stacks) = node->left;
	    stackdir.Elem(stacks) = ndir;
	  }
	if (node->right && bmax[dir] >= node->sep)
	  {
	    stacks++;
	    stack.Elem(stacks) = node->right;
	    stackdir.Elem(stacks) = ndir;
	  }
      }
  }
コード例 #30
0
ファイル: ObjectListNode.cpp プロジェクト: dontnod/fastbuild
// GetInputFiles
//------------------------------------------------------------------------------
void ObjectListNode::GetInputFiles( Array< AString > & files ) const
{
    // only valid to call on ObjectListNode (not LibraryNode)
    ASSERT( GetType() == Node::OBJECT_LIST_NODE );

    files.SetCapacity( files.GetCapacity() + m_DynamicDependencies.GetSize() );
    for ( Dependencies::Iter i = m_DynamicDependencies.Begin();
            i != m_DynamicDependencies.End();
            i++ )
    {
        const Node * n = i->GetNode();
        files.Append( n->GetName() );
    }
}