24小时热门版块排行榜    

Znn3bq.jpeg
查看: 365  |  回复: 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的回帖
相关版块跳转 我要订阅楼主 独臂大侠 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 301求调剂 +5 149. 2026-04-10 5/250 2026-04-10 15:45 by 柴小白
[考研] 22408 352分求调剂0854类 +3 努力的夏末 2026-04-09 3/150 2026-04-10 10:12 by 314126402
[考研] 材料化工总分334求调剂 +16 Riot2025 2026-04-08 17/850 2026-04-09 20:19 by maddjdld
[考研] 材料专硕(0856) 339分求调剂 +9 哈哈哈鹅哈哈哈 2026-04-09 10/500 2026-04-09 20:01 by Orcid
[考研] 332,085601求调剂 +12 ydfyh 2026-04-09 14/700 2026-04-09 17:28 by wp06
[考研] 274求调剂 +5 山阿蔓 2026-04-07 5/250 2026-04-09 15:28 by 18828373951
[考研] 086004 求调剂 309 +7 Yin DY 2026-04-08 7/350 2026-04-09 13:59 by Delta2012
[考研] 材料专硕322 +14 哈哈哈吼吼吼哈 2026-04-05 14/700 2026-04-09 13:25 by 5268321
[考研] 070300化学279求调剂 +17 哈哈哈^_^ 2026-04-08 18/900 2026-04-09 10:49 by 三七七想上岸
[考研] 288求调剂 +15 没有答案_ 2026-04-05 15/750 2026-04-09 10:22 by 5268321
[考研] 266调剂 +8 daya sun 2026-04-07 9/450 2026-04-08 20:27 by yutian743
[考研] 一志愿华东理工085601材料工程303分求调剂 +15 a1708 2026-04-06 15/750 2026-04-08 16:23 by luoyongfeng
[考研] 22408 一志愿双一流人工智能300分 四六级,数据分析国奖 +4 zzfeng123 2026-04-06 6/300 2026-04-07 21:02 by zzfeng123
[考研] 071000生物学,一志愿深圳大学296分,求调剂 +12 TIckLw 2026-04-06 13/650 2026-04-07 20:34 by lijunpoly
[考研] 312求调剂 +18 gtw1 2026-04-06 20/1000 2026-04-07 18:16 by 蓝云思雨
[考研] 307求调剂 +3 Youth@@ 2026-04-07 3/150 2026-04-07 09:25 by 小黑不怕难
[考研] (调剂)一志愿报考哈尔滨工业大学0857资源与环境专业378分考生 +7 狠狠加油 2026-04-05 8/400 2026-04-06 16:52 by momo皓
[考研] 283求调剂 +5 baiiyu 2026-04-05 6/300 2026-04-05 20:35 by 啵啵啵0119
[考研] 288求调剂,一志愿华南理工大学071005 +6 ioodiiij 2026-04-04 6/300 2026-04-05 10:09 by guoweigw
[考研] 求生物学学硕调剂——364分 +7 云朵遛弯指南 2026-04-04 7/350 2026-04-04 22:49 by zhyzzh
信息提示
请填处理意见