Exemplo n.º 1
0
 bool setStructure(vector<T> &dest, const vector<U> &src, const V &src2)
 {
     dest.resize(src.size());
     if (Dimension<U>::dimension > 0)
     {
         bool ok = true;
         for (long i=0; ok && i<src.size(); i++)
             ok = setStructure(dest[i],src[i],src2);
         return ok;
     } else
     {
         bool ok = true;
         for (long i=0; ok && i<src.size(); i++)
             ok = setStructure(dest[i],src[i],src2);
         return ok;
     }
 }
Exemplo n.º 2
0
void JSFunction::finishCreation(ExecState* exec, FunctionExecutable* executable, ScopeChainNode* scopeChainNode)
{
    Base::finishCreation(exec->globalData());
    ASSERT(inherits(&s_info));

    // Switching the structure here is only safe if we currently have the function structure!
    ASSERT(structure() == scopeChainNode->globalObject->functionStructure());
    setStructure(exec->globalData(), scopeChainNode->globalObject->namedFunctionStructure());
    putDirectOffset(exec->globalData(), scopeChainNode->globalObject->functionNameOffset(), executable->nameValue());
}
Exemplo n.º 3
0
Ship* Ship::_clone(Ship *s, int _id) {
	setName(s->getName());
	setX(s->getX());
	setY(s->getY());
	setZ(s->getZ());
	setMesh(s->getMesh());
	setStructure(s->getStructure());
	id = _id;
	setType(s->getType());
	return this;
}
Exemplo n.º 4
0
 bool setStructure(vector<D> &dest, const vector<S> &src)
 {
     dest.resize(src.size());
     if (Dimension<D>::dimension > 0)
     {
         bool ok = true;
         for (long i=0; ok && i<src.size(); i++)
             ok = setStructure(dest[i], src[i]);
         return ok;
     }
     return true;
 }
Exemplo n.º 5
0
    /** Produce an instance of an fei::Matrix
     */
    virtual fei::SharedPtr<fei::Matrix> createMatrix()
      {
	fei::SharedPtr<fei::Matrix> mptr;
	if (matrixGraph_.get() == NULL) return(mptr);

	if (setStructure() != 0) return(mptr);
        int localsize = matrixGraph_->getRowSpace()->getNumIndices_Owned();

	fei::SharedPtr<fei::Matrix> matptr;
        matptr.reset(new fei::Matrix_Impl<FiniteElementData>(feData_,
						     matrixGraph_, localsize));
	return(matptr);
      }
Exemplo n.º 6
0
    /** Produce an instance of an fei::LinearSystem
     */
    virtual fei::SharedPtr<fei::LinearSystem> createLinearSystem()
      {
	fei::SharedPtr<fei::LinearSystem> lsptr;
	if (matrixGraph_.get() == NULL) return(lsptr);

	if (setStructure() != 0) return(lsptr);

	snl_fei::LinearSystem_FEData*
	  linsysfed = new LinearSystem_FEData(feData_,
					      matrixGraph_);
	linsysfed->setLookup(lookup_);
	fei::SharedPtr<fei::LinearSystem> linsysptr(linsysfed);
	return(linsysptr);
      }
Exemplo n.º 7
0
    /** Produce an instance of an fei::Vector. This overloading of the
	create() method is for use by Broker implementations that are
	dispensing 'views' of vectors that reside in LinearSystemCore or
	FiniteElementData container implementations. In those cases, there is
	a distinction that must be made between solution-vectors and
	rhs-vectors.

	@param isSolutionVector
     */
    virtual fei::SharedPtr<fei::Vector> createVector(bool isSolutionVector=false)
      {
	fei::SharedPtr<fei::Vector> vptr;
	if (matrixGraph_.get() == NULL) return(vptr);

	if (setStructure() != 0) return(vptr);

        int localsize = matrixGraph_->getRowSpace()->getNumIndices_Owned();
	fei::SharedPtr<fei::Vector> vecptr;
        vecptr.reset(new fei::Vector_Impl<FiniteElementData>(matrixGraph_->getRowSpace(),
                                                   feData_.get(), localsize,
                                                    isSolutionVector));
	return(vecptr);
      }
Exemplo n.º 8
0
 bool convert(D &d, const S &s)
 {
     setStructure(d, s);
     Iterator<typename Dimension<D>::basetype,Dimension<D>::dimension> iterD(d);
     Iterator<typename Dimension<S>::basetype,Dimension<S>::dimension> iterS(*const_cast<S*>(&s));
     for ( ; iterD.valid() && iterS.valid() ; ++iterD,++iterS)
         *iterD = *iterS;
     if (iterD.valid() || iterS.valid())
     {
         cerr << "Both cubes do not contain the same number of elements in convert()" << endl;
         return false;
     }
     return true;
 }
Exemplo n.º 9
0
void JSObject::removeDirect(const Identifier& propertyName)
{
    size_t offset;
    if (m_structure->isUncacheableDictionary()) {
        offset = m_structure->removePropertyWithoutTransition(propertyName);
        if (offset != WTF::notFound)
            putDirectOffset(offset, jsUndefined());
        return;
    }

    RefPtr<Structure> structure = Structure::removePropertyTransition(m_structure, propertyName, offset);
    setStructure(structure.release());
    if (offset != WTF::notFound)
        putDirectOffset(offset, jsUndefined());
}
Exemplo n.º 10
0
void PvObject::setStructure(const boost::python::dict& pyDict)
{
    std::string key = PyPvDataUtility::getValueOrSingleFieldName(pvStructurePtr);
    setStructure(key, pyDict);
}
Exemplo n.º 11
0
void  LatticeSim::setNativeStructure (  CAABase&  rBases ){
  setStructure (rBases);
  lattice->setNative();
}
Exemplo n.º 12
0
// My main function
int main(int argc, char *argv[])
{
	int syntaxCheck=0,status=0;
	char *inputString=NULL;
	size_t len = 512;
	char **arg_temp=NULL;
	char **arg=NULL;

	char *path=NULL, *pathname=NULL,*cdpath=NULL;
	int size,i=0,arg_count=0;

	char *strparse=NULL;
	char **temp_arg=NULL;
	int numberArg=0;
	char *strwithBackground=NULL;
	char *bck=NULL,*strptr=NULL;
	int bckFlag=0;
	inputString = (char *) malloc (512);
	memset(inputString,'\0',len);

	while(1)
	{
		bckFlag=0;
		if(argc ==2)
		{
			printf("%s:",argv[1]);
		}
		else if(argc==1)
			printf("myshell:");
		fflush(stdout);

		getline(&inputString, &len, stdin);
		if(feof(stdin) != 0)
		{
			exit(0);
		}
		size=strlen(inputString);
		inputString[size-1]='\0';
		arg = (char **)malloc(10 * sizeof(char *));
		memset(arg,0,10 * sizeof(char *));
		syntaxCheck=checkSyntax(inputString);
		if(syntaxCheck==1)
		{
			printf("Syntax Error\n");
			continue;
		}
		arg_temp=&inputString;
		arg[i] = strsep(arg_temp, ";");
		while(arg[i] != NULL)
		{
			bckFlag=0;
			strparse = Strcpy(arg[i]);
			strparse=truncateEndSpaces(strparse);

			if(strcmp(strparse, "exit") == 0)
				exit(0);
			if(strstr(strparse, "cd"))
			{
				pathname=strstr(strparse, "cd");
				while(*pathname!=' ')
				{
					pathname=pathname+1;

				}
				if(*pathname==' ')
				{
					while(*pathname==' ')
					{
						pathname=pathname+1;
					}
				}
				cdpath=(char *)malloc(strlen(strparse));
				memset(cdpath,'\0',strlen(strparse));
				path=cdpath;
				while(*pathname!='\0')
				{
					*path++=*pathname++;
				}
				*path='\0';
				if(chdir(cdpath)==-1)
				{
					perror("Change Directory Failed");
				}
				i++;
				arg[i] = strsep(arg_temp, ";");
				continue;
			}

			strptr=strparse;
			strwithBackground=(char *)malloc(sizeof(char)*200);
			memset(strwithBackground,'\0',sizeof(char)*200);
			bck=strwithBackground;
			if(strstr(strparse,"&"))
			{
				bckFlag=1;
				while(*strptr!='&')
				{
					*bck++=*strptr++;
				}
				*bck='\0';
				strwithBackground=truncateEndSpaces(strwithBackground);
				memset(strparse,'\0',strlen(strwithBackground)+1);
				strparse = Strcpy(strwithBackground);
			}
			arg_count++;
			temp_arg=parseString(strparse,&numberArg);
			setStructure(temp_arg,numberArg);
			runCommand(bckFlag);
			i++;
			arg[i] = strsep(arg_temp, ";");
		}
		wait4(-1,&status,WNOHANG,NULL);
	}

	return 0;
}
Exemplo n.º 13
0
 bool setStructure(T &dest, const U &src, const V &src2)
 {
     return setStructure(dest,src2);
 }