当前位置: 首页>>代码示例>>C++>>正文


C++ NS函数代码示例

本文整理汇总了C++中NS函数的典型用法代码示例。如果您正苦于以下问题:C++ NS函数的具体用法?C++ NS怎么用?C++ NS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了NS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetS0

void ANCFBeamBE2D::GetdPosdqT(const Vector2D& p_loc, Matrix& dpdqi)
{
	//p = S(p.x,p.y,p.z)*q; d(p)/dq
	dpdqi.SetSize(SOS(),Dim());
	dpdqi.FillWithZeros();
	//d = S + ...
	for (int i = 1; i <= NS(); i++)
	{
		double s = GetS0(p_loc.X(), i);
		dpdqi((i-1)*Dim()+1,1) = s;
		dpdqi((i-1)*Dim()+2,2) = s;
	}
	if (p_loc.Y() != 0)
	{
		double y = p_loc.Y();
		Vector2D rx = GetPosx2D(p_loc.X());
		Vector2D n(-rx.X(), rx.Y());
		n /= rx.Norm();

		for (int i = 1; i <= NS(); i++)
		{
			double sx = GetS0x(p_loc.X(), i) * 2./GetLx();
			//y/|n|*dn/dq
			dpdqi((i-1)*Dim()+1,2) +=  y*sx;
			dpdqi((i-1)*Dim()+2,1) += -y*sx;

			//y*n/|n|*(r_x1*S_x1 + r_x2*S_x2)
			dpdqi((i-1)*Dim()+1,1) +=  y*n.X()*(rx.X()*sx);
			dpdqi((i-1)*Dim()+1,2) +=  y*n.Y()*(rx.X()*sx);
			dpdqi((i-1)*Dim()+2,1) +=  y*n.X()*(rx.Y()*sx);
			dpdqi((i-1)*Dim()+2,2) +=  y*n.Y()*(rx.Y()*sx);
		}
	}
};
开发者ID:AlexeySmolin,项目名称:LIGGGHTS-MCA,代码行数:34,代码来源:ANCFBeamBE2D.cpp

示例2: Tclmsgque_Init

/** \brief initialize the tclmsgque package
 *
 * The tclmsgque package is created and one new command "msgque"
 * is added to the Tcl interpreter.
 * \param[in] interp the current interpreter
 * \return Tcl error-code
 */
TCLMQ_EXTERN int
Tclmsgque_Init (
  Tcl_Interp * interp
)
{
  // check for the reight tcl
  if (Tcl_InitStubs (interp, "8.5", 0) == NULL) {
    return TCL_ERROR;
  }

  // announce my package
  TclErrorCheck (Tcl_PkgProvide (interp, "TclMsgque", LIBMSGQUE_VERSION));

  // provide "msgque" as only public cammand of the package
  Tcl_CreateObjCommand (interp, "tclmsgque", NS(MsgqueCmd), (ClientData) NULL,
                        (Tcl_CmdDeleteProc *) NULL);

  // init libmsgque global data
  if (MqInitGet() == NULL && Tcl_GetNameOfExecutable() != NULL) {
    struct MqBufferLS * initB = MqInitCreate();

    if (Tcl_Eval(interp, "info script") == TCL_ERROR)
      return TCL_ERROR;

    MqBufferLAppendC(initB, Tcl_GetNameOfExecutable());
    MqBufferLAppendC(initB, Tcl_GetStringResult(interp));
  }

  // create the default-factory
  if (!strcmp(MqFactoryDefaultIdent(),"libmsgque")) {
    MqFactoryDefault("tclmsgque", NS(FactoryCreate), NULL, NULL, NS(FactoryDelete), NULL, NULL);
  }

  return TCL_OK;
}
开发者ID:BackupTheBerlios,项目名称:nhi1-svn,代码行数:42,代码来源:msgque_tcl.c

示例3: NS

static enum MqErrorE MQ_DECL NS(FactoryCreate) (
  struct MqS * const tmpl,
  enum MqFactoryE create,
  MQ_PTR data,
  struct MqS  ** contextP
)
{
  JNIEnv * env = NULL;

  // get env
  if (create == MQ_FACTORY_NEW_THREAD) {
    JavaVMAttachArgs args = {JNI_VERSION_1_6, "libmsgque", NULL};
    if ((*cached_jvm)->AttachCurrentThread(cached_jvm, (void**)&env, (void**)&args) != JNI_OK) {
      return MqErrorC (tmpl, __func__, -1, "unable to 'AttachCurrentThread'");
    }
  } else {
    env = ((JNIEnv*) tmpl->threadData);
  }

  // create new object
  *contextP = XCONTEXT((*env)->CallObjectMethod(env, (jobject)tmpl->self, NS(MID_IFactory_Factory)));
  if((*env)->ExceptionCheck(env) == JNI_TRUE) {
    (*env)->CallVoidMethod(env, tmpl->self, NS(MID_MqS_ErrorSet), (*env)->ExceptionOccurred(env));
    (*env)->ExceptionClear(env);
    return MqErrorStack(tmpl);
  }

  MqConfigDup (*contextP, tmpl);
  MqSetupDup (*contextP, tmpl);
  return MQ_OK;
}
开发者ID:BackupTheBerlios,项目名称:nhi1-svn,代码行数:31,代码来源:context_java.c

示例4: type

/*! \internal
    \since 4.7

    Registers a user type for marshalling, as an alias of another type (typedef)
*/
int QMetaType::registerTypedef(const char* typeName, int aliasId)
{
    QVector<QCustomTypeInfo> *ct = customTypes();
    if (!ct || !typeName)
        return -1;

#ifdef QT_NO_QOBJECT
    NS(QByteArray) normalizedTypeName = typeName;
#else
    NS(QByteArray) normalizedTypeName = QMetaObject::normalizedType(typeName);
#endif

    int idx = qMetaTypeStaticType(normalizedTypeName.constData(),
                                  normalizedTypeName.size());

    if (idx) {
        Q_ASSERT(idx == aliasId);
        return idx;
    }

    QWriteLocker locker(customTypesLock());
    idx = qMetaTypeCustomType_unlocked(normalizedTypeName.constData(),
                                           normalizedTypeName.size());

    if (idx)
        return idx;

    QCustomTypeInfo inf;
    inf.typeName = normalizedTypeName;
    inf.alias = aliasId;
    inf.constr = 0;
    inf.destr = 0;
    ct->append(inf);
    return aliasId;
}
开发者ID:jbartolozzi,项目名称:CIS462_HW1,代码行数:40,代码来源:qmetatype.cpp

示例5: TEST

TEST(StringTest, Case)
{
    NoString x = NS("xx");
    NoString X = NS("XX");
    EXPECT_EQ(X, x.toUpper());
    EXPECT_EQ(x, X.toLower());
}
开发者ID:Kriechi,项目名称:nobnc,代码行数:7,代码来源:StringTest.cpp

示例6: NS

static void
NS(test_main)(void *arg)
{
  routerset_t *set = routerset_new();
  smartlist_t *out = smartlist_new();
  int r;
  (void)arg;

  NS_MOCK(nodelist_get_list);

  smartlist_add(set->country_names, tor_strdup("{xx}"));
  NS(mock_smartlist) = smartlist_new();
  NS(mock_node).is_running = 0;
  smartlist_add(NS(mock_smartlist), (void *)&NS(mock_node));

  routerset_get_all_nodes(out, set, NULL, 1);
  r = smartlist_len(out);
  routerset_free(set);
  smartlist_free(out);
  smartlist_free(NS(mock_smartlist));

  tt_int_op(r, ==, 0);
  tt_int_op(CALLED(nodelist_get_list), ==, 1);

  done:
    ;
}
开发者ID:caofangkun,项目名称:tor,代码行数:27,代码来源:test_routerset.c

示例7: calc_coefficients

static void calc_coefficients(AVFilterContext *ctx)
{
    ColorMatrixContext *color = ctx->priv;
    double rgb_coeffd[4][3][3];
    double yuv_convertd[16][3][3];
    int v = 0;
    int i, j, k;

    for (i = 0; i < 4; i++)
        inverse3x3(rgb_coeffd[i], yuv_coeff[i]);
    for (i = 0; i < 4; i++) {
        for (j = 0; j < 4; j++) {
            solve_coefficients(yuv_convertd[v], rgb_coeffd[i], yuv_coeff[j]);
            for (k = 0; k < 3; k++) {
                color->yuv_convert[v][k][0] = NS(yuv_convertd[v][k][0]);
                color->yuv_convert[v][k][1] = NS(yuv_convertd[v][k][1]);
                color->yuv_convert[v][k][2] = NS(yuv_convertd[v][k][2]);
            }
            if (color->yuv_convert[v][0][0] != 65536 || color->yuv_convert[v][1][0] != 0 ||
                    color->yuv_convert[v][2][0] != 0) {
                av_log(ctx, AV_LOG_ERROR, "error calculating conversion coefficients\n");
            }
            v++;
        }
    }
}
开发者ID:ningyotoge,项目名称:FFmpeg,代码行数:26,代码来源:vf_colormatrix.c

示例8: customTypes

/*! \internal

    Registers a user type for marshalling, with \a typeName, a \a
    destructor, and a \a constructor. Returns the type's handle,
    or -1 if the type could not be registered.
 */
int QMetaType::registerType(const char *typeName, Destructor destructor,
                            Constructor constructor)
{
    QVector<QCustomTypeInfo> *ct = customTypes();
    if (!ct || !typeName || !destructor || !constructor)
        return -1;

#ifdef QT_NO_QOBJECT
    NS(QByteArray) normalizedTypeName = typeName;
#else
    NS(QByteArray) normalizedTypeName = QMetaObject::normalizedType(typeName);
#endif

    int idx = qMetaTypeStaticType(normalizedTypeName.constData(),
                                  normalizedTypeName.size());

    if (!idx) {
        QWriteLocker locker(customTypesLock());
        idx = qMetaTypeCustomType_unlocked(normalizedTypeName.constData(),
                                           normalizedTypeName.size());
        if (!idx) {
            QCustomTypeInfo inf;
            inf.typeName = normalizedTypeName;
            inf.constr = constructor;
            inf.destr = destructor;
            inf.alias = -1;
            idx = ct->size() + User;
            ct->append(inf);
        }
    }
    return idx;
}
开发者ID:jbartolozzi,项目名称:CIS462_HW1,代码行数:38,代码来源:qmetatype.cpp

示例9: Init_rubymsgque

RUBYMQ_EXTERN void Init_rubymsgque() {

  // Register system
#ifdef HAVE_FORK
//  MqInitSysAPI(NS(fork),NULL);
#endif

  // Initialize components
  NS(MqS_Init)();
  NS(MqSException_Init)();
  NS(MqBufferS_Init)();

  // get the script name
  VALUE a0 = rb_gv_get("$0");

  // init libmsgque global data
  if (MqInitBuf == NULL && !NIL_P(a0)) {
    struct MqBufferLS * initB = MqInitCreate();
    MqBufferLAppendC(initB, VAL2CST(rb_argv0));
    MqBufferLAppendC(initB, VAL2CST(a0));
  }

  // set global data
  id_receiver = rb_intern("receiver");
  id_clone = rb_intern("clone");
  id_unbind = rb_intern("unbind");
  id_bind = rb_intern("bind");
}
开发者ID:BackupTheBerlios,项目名称:nhi1-svn,代码行数:28,代码来源:context_ruby.c

示例10: NS

 //! Restore the original environment
 ~environment ()
 {
   std::for_each (vars_set_.begin (), vars_set_.end (),
                  NS(bind) (&environment::unsetenv_, this, NSPH(_1)));
   std::for_each (mod_vars_.begin (), mod_vars_.end (),
                  NS(bind) (&environment::setenv_, this, NSPH(_1)));
 }
开发者ID:sirjaren,项目名称:utsushi,代码行数:8,代码来源:environment.hpp

示例11: NS

static or_state_t *
NS(get_or_state)(void)
{
  NS(mock_state) = tor_malloc_zero(sizeof(or_state_t));
  NS(mock_state)->AccountingBytesReadInInterval = 0;
  NS(mock_state)->AccountingBytesWrittenInInterval = 0;

  return NS(mock_state);
}
开发者ID:BwRy,项目名称:Astoria,代码行数:9,代码来源:test_status.c

示例12: NS

const node_t *
NS(node_get_by_nickname)(const char *nickname, int warn_if_unused)
{
  CALLED(node_get_by_nickname)++;
  tt_str_op(nickname, OP_EQ, NS(mock_nickname));
  tt_int_op(warn_if_unused, OP_EQ, 1);

  done:
    return &NS(mock_node);
}
开发者ID:Archer-sys,项目名称:tor,代码行数:10,代码来源:test_routerset.c

示例13: NS

void NS(MqBufferS_Init) (TSRMLS_D) {
    zend_class_entry me_ce;

    // create class and make depend on "Exception"
    INIT_CLASS_ENTRY(me_ce,"MqBufferS", NS(MqBufferS_functions));
    NS(MqBufferS) = zend_register_internal_class(&me_ce TSRMLS_CC);

    // define additional properties "buf" to save the "struct MqBufferS *" pointer
    zend_declare_property_null(NS(MqBufferS), ID(__buf), ZEND_ACC_PRIVATE TSRMLS_CC);
}
开发者ID:BackupTheBerlios,项目名称:nhi1-svn,代码行数:10,代码来源:MqBufferS_php.c

示例14: NS

int NS(SendEND_AND_CALLBACK) (NS_ARGS)
{
  SETUP_mqctx
  MQ_STR token;
  Tcl_Obj *callback;
  CHECK_C(token)
  CHECK_OBJ(callback)
  CHECK_NOARGS
  Tcl_IncrRefCount(callback);
  ErrorMqToTclWithCheck(MqSendEND_AND_CALLBACK(mqctx, token, NS(ProcCall), callback, NS(ProcFree)));
  RETURN_TCL
}
开发者ID:BackupTheBerlios,项目名称:nhi1-svn,代码行数:12,代码来源:send_tcl.c

示例15: NS

PyObject* NS(ReadForward) (
  PyObject*	self,
  PyObject*	args
)
{
  SETUP_context
  MqS_Obj *ctxO = NULL;
  MqDumpS_Obj *dumpO = NULL;
  PyErrorCheck (PyArg_ParseTuple(args, "O!|O!:ReadForward", &NS(MqS), &ctxO, &NS(MqDumpS), &dumpO));
  ErrorMqToPythonWithCheck(MqReadForward(context, &ctxO->context, dumpO == NULL ? NULL : dumpO->dump));
  SETUP_RETURN;
}
开发者ID:BackupTheBerlios,项目名称:nhi1-svn,代码行数:12,代码来源:read_python.c


注:本文中的NS函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。