24小时热门版块排行榜    

查看: 361  |  回复: 0

独臂大侠

铜虫 (小有名气)

[求助] 求助求助

我现在在做仿真的后处理,分析结果(网格节点坐标,节点的应力应变)我有,现在我想把这些结果输入到ug中进行后处理显示,我在ugopen函数手册中找了两个函数UF_SF_create_disp_mesh,UF_SF_display_mesh,可是在ug中调用这两个函数生成的dll文件时总是提示外部库错误,是我找错函数了还是什么问题,哪位大神能帮帮我,感激不尽!!附上代码
         
#include "stdafx.h"
#include "test1.h"
#include <stdio.h>
#include <uf.h>
#include <uf_modl.h>
#include <uf_curve.h>
#include <uf_part.h>
#include <uf_obj.h>
#include <uf_csys.h>
#include <uf_sf.h>
#include <uf_ui.h>

#define UF_CALL(X) (report( __FILE__, __LINE__, #X, (X)))
static int report( char *file, int line, char *call, int irc)
{
        if(irc)
        {
                char err[133],messg[300];
                UF_get_fail_message(irc, err);
                sprintf(messg, "\n%s\nerror %d at linePt %d in %s\n%s",
                        err, irc, line, file, call);
                printf("%s\n", messg);
                strcpy(&messg[129], "...";
                uc1601(messg, TRUE);  /* Internal only - remove for external */
        }
        return(irc);
}


static void do_ugopen_api(void)
{
        UF_SF_disp_mesh_t disp_mesh;
        tag_t  mesh_tag;
        disp_mesh.node_coords=new double[9][3];
        disp_mesh.node_ids=new int[9];
        disp_mesh.elem_ids=new int[4];
        disp_mesh.elem_node_ids = new int *[4];
      for (int i = 0; i < 4; i++)
      {
          disp_mesh.elem_node_ids = new int[4];
      }
        disp_mesh.elem_dimension=UF_SF_DIMENSION_2D;
        disp_mesh.num_elements=4;
        disp_mesh.num_nodes=9;
        disp_mesh.num_elem_nodes=4;
        disp_mesh.node_coords[0][0]=0.0;
        disp_mesh.node_coords[0][1]=0.0;
        disp_mesh.node_coords[0][2]=0.0;
        disp_mesh.node_coords[1][0]=1.0;
        disp_mesh.node_coords[1][1]=0.0;
        disp_mesh.node_coords[1][2]=0.0;
        disp_mesh.node_coords[2][0]=2.0;
        disp_mesh.node_coords[2][1]=0.0;
        disp_mesh.node_coords[2][2]=0.0;
        disp_mesh.node_coords[3][0]=2.0;       
        disp_mesh.node_coords[3][1]=1.0;       
        disp_mesh.node_coords[3][2]=0.0;       
        disp_mesh.node_coords[4][0]=2.0;       
        disp_mesh.node_coords[4][1]=2.0;
        disp_mesh.node_coords[4][2]=0.0;
        disp_mesh.node_coords[5][0]=1.0;
        disp_mesh.node_coords[5][1]=2.0;
        disp_mesh.node_coords[5][2]=0.0;
        disp_mesh.node_coords[6][0]=0.0;
        disp_mesh.node_coords[6][1]=2.0;
        disp_mesh.node_coords[6][2]=0.0;
        disp_mesh.node_coords[7][0]=0.0;
        disp_mesh.node_coords[7][1]=1.0;
        disp_mesh.node_coords[7][2]=0.0;
        disp_mesh.node_coords[8][0]=1.0;
        disp_mesh.node_coords[8][1]=1.0;
        disp_mesh.node_coords[8][2]=0.0;
        disp_mesh.node_ids[0]=0;       
        disp_mesh.node_ids[1]=1;       
        disp_mesh.node_ids[2]=2;       
        disp_mesh.node_ids[3]=3;       
        disp_mesh.node_ids[4]=4;       
        disp_mesh.node_ids[5]=5;       
        disp_mesh.node_ids[6]=6;
        disp_mesh.node_ids[7]=7;
        disp_mesh.node_ids[8]=8;
        disp_mesh.elem_ids[0]=0;
        disp_mesh.elem_ids[1]=1;
        disp_mesh.elem_ids[2]=2;
        disp_mesh.elem_ids[3]=3;
        disp_mesh.elem_node_ids[0][0]=0;
        disp_mesh.elem_node_ids[0][1]=1;
        disp_mesh.elem_node_ids[0][2]=8;
        disp_mesh.elem_node_ids[0][3]=7;
        disp_mesh.elem_node_ids[1][0]=1;
        disp_mesh.elem_node_ids[1][1]=2;
        disp_mesh.elem_node_ids[1][2]=3;
        disp_mesh.elem_node_ids[1][3]=8;
        disp_mesh.elem_node_ids[2][0]=8;
        disp_mesh.elem_node_ids[2][1]=3;
        disp_mesh.elem_node_ids[2][2]=4;
        disp_mesh.elem_node_ids[2][3]=5;
        disp_mesh.elem_node_ids[3][0]=7;
        disp_mesh.elem_node_ids[3][1]=8;
        disp_mesh.elem_node_ids[3][2]=5;
        disp_mesh.elem_node_ids[3][3]=6;
        UF_initialize();
        UF_CALL(UF_SF_create_disp_mesh(&disp_mesh,&mesh_tag));
        UF_CALL(UF_SF_display_mesh (mesh_tag));
}

void ufusr(char *param, int *retcode, int param_len)
{
  if (!UF_CALL(UF_initialize()))
  {
    do_ugopen_api();
    UF_CALL(UF_terminate());
  }
}

int ufusr_ask_unload(void)
{
  return (UF_UNLOAD_IMMEDIATELY);
}
回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 独臂大侠 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 279分求调剂 一志愿211 +3 chaojifeixia 2026-03-19 3/150 2026-03-20 05:47 by laoshidan
[论文投稿] 申请回稿延期一个月,编辑同意了。但系统上的时间没变,给编辑又写邮件了,没回复 10+3 wangf9518 2026-03-17 4/200 2026-03-19 23:55 by babero
[考研] 294求调剂材料与化工专硕 +14 陌の森林 2026-03-18 14/700 2026-03-19 22:38 by 学员8dgXkO
[考研] 0856调剂,是学校就去 +6 sllhht 2026-03-19 7/350 2026-03-19 19:50 by 制度的
[考研] 288求调剂,一志愿华南理工大学071005 +5 ioodiiij 2026-03-17 5/250 2026-03-19 18:22 by zcl123
[考研] 321求调剂 +8 何润采123 2026-03-18 10/500 2026-03-19 16:46 by 何润采123
[考研] 【考研调剂】化学专业 281分,一志愿四川大学,诚心求调剂 +5 吃吃吃才有意义 2026-03-19 5/250 2026-03-19 16:18 by 30660438
[考研] 085600材料与化工调剂 324分 +10 llllkkkhh 2026-03-18 12/600 2026-03-19 14:33 by llllkkkhh
[考研] 286求调剂 +6 lemonzzn 2026-03-16 10/500 2026-03-19 14:31 by lemonzzn
[考研] 0703化学 305求调剂 +4 FY_yy 2026-03-14 4/200 2026-03-19 05:54 by anny19840123
[考研] 26调剂/材料/英一数二/总分289/已过A区线 +7 步川酷紫123 2026-03-13 7/350 2026-03-18 17:12 by 尽舜尧1
[考研] 298-一志愿中国农业大学-求调剂 +7 手机用户 2026-03-17 7/350 2026-03-18 14:34 by vgtyfty
[考研] 考研求调剂 +3 橘颂. 2026-03-17 4/200 2026-03-17 21:43 by 有只狸奴
[考研] 有没有道铁/土木的想调剂南林,给自己招师弟中~ +3 TqlXswl 2026-03-16 7/350 2026-03-17 15:23 by TqlXswl
[考研] 材料工程专硕274一志愿211求调剂 +6 薛云鹏 2026-03-15 6/300 2026-03-17 11:05 by 学员h26Tkc
[考研] 302求调剂 +4 小贾同学123 2026-03-15 8/400 2026-03-17 10:33 by 小贾同学123
[考研] 机械专硕325,寻找调剂院校 +3 y9999 2026-03-15 5/250 2026-03-16 19:58 by y9999
[考研] 326求调剂 +3 mlpqaz03 2026-03-15 3/150 2026-03-16 07:33 by Iveryant
[考研] 297一志愿上交085600求调剂 +5 指尖八千里 2026-03-14 5/250 2026-03-14 17:26 by a不易
[考研] 304求调剂 +7 7712b 2026-03-13 7/350 2026-03-13 21:42 by peike
信息提示
请填处理意见