Ejemplo n.º 1
0
IonDB * createIonDb(Sdr ionsdr, IonDB * iondbPtr)
{
	if (iondbPtr == NULL)
		iondbPtr = (IonDB*) malloc(sizeof(IonDB));
	memset((char *) iondbPtr, 0, sizeof(IonDB));
	iondbPtr->ownNodeNbr = getNodeNum();
	iondbPtr->productionRate = -1;	/*	Unknown.	*/
	iondbPtr->consumptionRate = -1;	/*	Unknown.	*/
	//limit = (sdr_heap_size(ionsdr) / 100) * (100 - ION_SEQUESTERED);

	/*	By default, let outbound ZCOs occupy up to
	 *	half of the available heap space, leaving
	 *	the other half for inbound ZCO acquisition.	*/

	//zco_set_max_heap_occupancy(ionsdr, limit/2, ZcoInbound);
	//zco_set_max_heap_occupancy(ionsdr, limit/2, ZcoOutbound);

	/*	By default, the occupancy ceiling is 50% more
	 *	than the outbound ZCO allocation.		*/

	//iondbBuf.occupancyCeiling = zco_get_max_file_occupancy(ionsdr, ZcoOutbound);
	//iondbBuf.occupancyCeiling += (limit/4);
	iondbPtr->contacts = sdr_list_create(ionsdr);
	iondbPtr->ranges = sdr_list_create(ionsdr);
	iondbPtr->maxClockError = 0;
	iondbPtr->clockIsSynchronized = 1;
	iondbPtr->contactLog[SENDER_NODE] = sdr_list_create(ionsdr);
	iondbPtr->contactLog[RECEIVER_NODE] = sdr_list_create(ionsdr);
    //memcpy(&iondbBuf.parmcopy, parms, sizeof(IonParms));
	//fprintf(stderr, "ionDb created: %d\n", getOwnNodeNbr());
	return iondbPtr;
}
Ejemplo n.º 2
0
    void multiplyBySystemJacobianTranspose(
        const SBTreePositionCache&  pc,
        SpatialVec*                 zTmp,
        const SpatialVec*           X,
        Real*                       JtX) const
    {
        const SpatialVec& in  = X[getNodeNum()];
        SpatialVec&       z   = zTmp[getNodeNum()];

        z = in;

        for (unsigned i=0; i<children.size(); ++i) {
            const SpatialVec& zChild   = zTmp[children[i]->getNodeNum()];
            const PhiMatrix&  phiChild = children[i]->getPhi(pc);
            z += phiChild * zChild;
        }
        // No generalized speeds so no contribution to JtX.
    }
Ejemplo n.º 3
0
//==============================================================================
//                   MULTIPLY BY SYSTEM JACOBIAN TRANSPOSE
//==============================================================================
// Calculate product of kinematic Jacobian transpose ~J=~H*Phi and a spatial
// forces vector on each of the outboard bodies. Requires that Phi and H are 
// available, so this should only be called in Stage::Position or higher. This 
// does not  change the cache at all.
// NOTE (sherm 060214): I reworked this from the original. This one no longer 
// incorporates applied hinge gradients if there are any; just add those in at 
// the end if you want them.
//
// (sherm 060727) In spatial operators, this calculates ~H*Phi*F where F are the 
// spatial forces applied to each body. See Schwieters Eq. 41. (But with sense 
// of H transposed.)
//
// Call tip to base.
//
template<int dof, bool noR_FM, bool noX_MB, bool noR_PF> void
RigidBodyNodeSpec<dof, noR_FM, noX_MB, noR_PF>::
multiplyBySystemJacobianTranspose(
    const SBTreePositionCache&  pc,
    SpatialVec*                 zTmp,
    const SpatialVec*           X, 
    Real*                       JtX) const
{
    const SpatialVec& in  = X[getNodeNum()];
    Vec<dof>&         out = Vec<dof>::updAs(&JtX[getUIndex()]);
    SpatialVec&       z   = zTmp[getNodeNum()];

    z = in;

    for (unsigned i=0; i<children.size(); ++i) {
        const SpatialVec& zChild   = zTmp[children[i]->getNodeNum()];
        const PhiMatrix&  phiChild = children[i]->getPhi(pc);

        z += phiChild * zChild; // 18 flops
    }

    out = ~getH(pc) * z; // 11*dof flops
}
Ejemplo n.º 4
0
static IonPartitions * updateIonPartitions()
{
	JNIEnv * jniEnv = getThreadLocalEnv();
	IonPartitions * ionP = getIonPartitions();
	if (ionP == NULL)
	{
		putErrmsg("Cannot retrieve ion partitions", NULL);
		return NULL;
	}
	if (ionP->nodeNbr != getNodeNum())
	{
		ionP->nodeNbr = getNodeNum();
		(*jniEnv)->DeleteGlobalRef(jniEnv, ionP->partition[WM_PSM_PARTITION]);
		(*jniEnv)->DeleteGlobalRef(jniEnv, ionP->partition[SDR_PSM_PARTITION]);
		ionP->partition[WM_PSM_PARTITION] =
				(*jniEnv)->NewGlobalRef(jniEnv,
				getIonPsmPartition((jlong) ionP->nodeNbr, WM_PSM_PARTITION));
		ionP->partition[SDR_PSM_PARTITION] =
				(*jniEnv)->NewGlobalRef(jniEnv,
				getIonPsmPartition((jlong) ionP->nodeNbr, SDR_PSM_PARTITION));
		setIonPartitions(ionP);
	}
	return ionP;
}
Ejemplo n.º 5
0
void destroyIonSdr()
{
	eraseIonPsmPartition((jlong) getNodeNum(), SDR_PSM_PARTITION);
}
Ejemplo n.º 6
0
void initIonSdr()
{
	newIonPsmPartition((jlong) getNodeNum(), SDR_PSM_PARTITION);
	initIonPartitions();
}