Exemplo n.º 1
0
Forces::Forces(int argc,char **argv,char *ConfF,char *Snapshot){
  Shout("constructor with intial configuration");
  InitConst();
  if(ReadConfDinamica(ConfF)){
    Dx = 1./(double)(NEdge-1);
  }
  Open(Snapshot,BF_PART);
  if(VAR_IF_TYPE(SysShape,SYS_LEAVES)) IfNano = 2;
  if(VAR_IF_TYPE(SysShape,SYS_PORE)) IfNano = 2;
  AllocMethod();
  PrepareParallel(argc,argv);
  PrepareSys();
 //Interp();
}
Exemplo n.º 2
0
OSCMethod OSCNewMethod(Name name, OSCcontainer me, methodCallback callback, 
		       void *context, struct OSCMethodQueryResponseInfoStruct *QueryResponseInfo) {

    char addr[LONG_ADDR_SIZE];
    OSCMethod m;

#ifdef DEBUG
    printf("OSCNewMethod(name %s, container %p, callback %p, context %p)\n",
	   name, me, callback, context);
#endif

    if (strchr(name, '/') != NULL) {
	OSCProblem("Method name \"%s\" contains a slash --- not good.",
		   name);
	return 0;
    }


    if (me->numMethods >= MAX_METHODS_PER_CONTAINER) {
	addr[0] = '\0';
	OSCGetAddressString(addr, LONG_ADDR_SIZE, me);
	OSCProblem("OSCNewMethod: container %s already has %d methods; can't add another\n"
		   "Change MAX_METHODS_PER_CONTAINER in OSC-address-space.c and recompile.",
		   addr, me->numMethods);
	return 0;
    }

    m = AllocMethod();
    if (!m) return 0;

    m->callback = callback;
    m->context = context;
    m->QueryResponseInfo = *QueryResponseInfo;

    me->methodNames[me->numMethods] = name;
    me->methods[me->numMethods] = m;
    ++(me->numMethods);
    return m;
}
Exemplo n.º 3
0
static OSCMethod AllocMethod(void) {
    static int numExtraAllocs = 0;
    OSCMethod result;

    if (freeMethods != 0) {
        result = freeMethods;
	freeMethods = freeMethods->next;
	return result;
    }

    OSCWarning("Out of memory for methods; trying to allocate more in real time");
    {
        int num = BASE_NUM_TO_REALLOCATE * ++numExtraAllocs;
        freeMethods = (*RealTimeMemoryAllocator)(num * sizeof(*freeMethods));
        if (freeMethods == 0) {
            OSCWarning("Real-time allocation failed");
            return 0;
	}
        MakeFreeMethodsList(num);
        return AllocMethod();
    }
}
Exemplo n.º 4
0
Forces::Forces(int argc,char **argv,int NInEdge,char *ConfFileExt){
  Shout("Constructor/no starting configuration");
  InitConst();
  sprintf(ConfFile,"%s",ConfFileExt);
  char ConfF[40];
  sprintf(ConfF,ConfFile);
  if(ReadConfDinamica(ConfF)){
    Dx = 1./(double)(NEdge-1);
  }
  if(VAR_IF_TYPE(SysShape,SYS_2D)){
    nEdge[0] = NEdge;
    double Ratio = pEdge(1)*pInvEdge(0);
    nEdge[1] = (int)(nEdge[0]*Ratio + 0.0001);
    for(int i=0;;i++){
      if((int)(nEdge[1]/Ratio) == nEdge[0]) break;
      nEdge[0]++;
      nEdge[1] = (int)(nEdge[0]*Ratio + 0.0001);
      printf("using: nEdge[0] %d nEdge[1] %d\n",nEdge[0],nEdge[1]);
      if(i>=10){
	printf("Could not find the appropriate border partition %d %d\n",nEdge[0],nEdge[1]);
	exit(0);
      }
    }
    SetNLink(4);
    ReSetNPart(nEdge[0]*nEdge[1]);
    ReSetNChain(nEdge[1]);
    SetNPCh(nEdge[0]);
  }
  else if(VAR_IF_TYPE(SysShape,SYS_3D)){
    SetNLink(6);
    ReSetNChain(NEdge*NEdge);
    ReSetNPart(NEdge*NEdge*NEdge);
  }
  else if(VAR_IF_TYPE(SysShape,SYS_ROD)){
    SetNLink(1);
    ReSetNChain(1);
    ReSetNPart(NEdge);
  }
  else if(VAR_IF_TYPE(SysShape,SYS_STALK)){
    SetNLink(3);
    ReSetNPart(4*NEdge);
    ReSetNChain(4);
    //    Kf.El[0] *= Gen->NPart;
  }
  else if(VAR_IF_TYPE(SysShape,SYS_LEAVES)){
    SetNLink(3);
    ReSetNPart(NEdge);
    ReSetNChain(1);
    //    Kf.El[0] *= Gen->NPart;
  }
  else if(VAR_IF_TYPE(SysShape,SYS_PORE)){
    SetNLink(3);
    ReSetNPart(NEdge);
    ReSetNChain(1);
  }
  else if(VAR_IF_TYPE(SysShape,SYS_1D)){
    SetNLink(2);
    ReSetNPart(NEdge);
    ReSetNChain(1);
  }
  else if(VAR_IF_TYPE(SysShape,SYS_RIGID)){
    ReSetNPart(0);
    SetNLink(0);
  }
  else if(VAR_IF_TYPE(SysShape,SYS_TRIAL)){
    ReSetNPart(3*3*3);
    SetNLink(0);
    ReSetNChain(1);
  }
  else if(VAR_IF_TYPE(SysShape,SYS_MD)){
    SetNLink(0);
    ReSetNPart(NEdge);
    ReSetNChain(1);
  }
  else if(VAR_IF_TYPE(SysShape,SYS_MC)){
    SetNLink(0);
    ReSetNPart(NEdge);
    ReSetNChain(1);
  }
  else if(VAR_IF_TYPE(SysShape,SYS_ELECTRO)){
    SetNLink(4);
    ReSetNPart(NEdge+NSpline);
    ReSetNChain(1);
  }
  ReSetNPCh(pNPart()/pNChain());
  //SetNPCh(NEdge);
  SetDeltat(Deltat);
  SetStep(0);
  SetNType(2);
  CreateInitial();
  {
    MInt = new MatInt(3,3);
    MInt->SetCoeff(-24.33,0,0);
    MInt->SetCoeff(-7.22,0,1);
    MInt->SetCoeff(-24.33,0,2);
    MInt->SetCoeff(-0.1,1,1);
    MInt->SetCoeff(-7.22,1,2);
    MInt->SetCoeff(0.,2,2);
    MInt->SetCoeff(3.,0,0,0);
    MInt->SetCoeff(3.,0,0,1);
    MInt->SetCoeff(3.,0,0,2);
    MInt->SetCoeff(3.,0,1,1);
    MInt->SetCoeff(3.,0,1,2);
    MInt->SetCoeff(3.,0,2,2);
    MInt->SetCoeff(0.,1,1,1);
    MInt->SetCoeff(3.,1,1,2);
    MInt->SetCoeff(3.,1,2,2);
    MInt->SetCoeff(0.,2,2,2);
  }
  AllocMethod();
  PrepareSys();
  PrepareParallel(argc,argv);
  if(VAR_IF_TYPE(SysShape,SYS_LEAVES)) IfNano = 2;
  if(VAR_IF_TYPE(SysShape,SYS_PORE)) IfNano = 2;
  if(VAR_IF_TYPE(SysShape,SYS_ELECTRO)){
    Pm[NEdge].Typ = 2;
    Pm[NEdge+1].Typ = 2;
  }
  //Pc->PrintCells();
  //for(int p=0;p<pNPart();p++) CheckDomDec(p);
  //Interp();
}