obsidian_backup/多体+耦合求解器/数据结构讨论.md
gyz 1094191210 Merge branch 'master' of https://gitee.com/agyz/obsidian_backup
# Conflicts:
#	.obsidian/copilot-index-ef6af226357d1e8b24528ffe939abb69.json
#	.obsidian/plugins/copilot/data.json
#	.obsidian/workspace.json
#	多体+耦合求解器/数据结构讨论.md
2025-01-15 13:59:43 +08:00

112 lines
3.2 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 问题1 结构体定义是否需要加大量option
水动 576行
![[Pasted image 20250110135219.png]]
多体 1600行
![[Pasted image 20250110135444.png]]
<<<<<<< HEAD
``` rust
=======
```
>>>>>>> 43e7b08163ff98d031f47a55e6d8abfb871edb14
pub struct MorisonMOutput {
    pub memberid: i32,                      // Member ID for requested output [-]
    pub noutloc: i32,                      // The number of requested output locations [-]
    pub nodelocs: Option<Vec<f64>>,         // Normalized locations along user-specified member for the outputs [-]
    pub memberidindx: i32,                 // Index for member in the master list [-]
    pub meshindx1: Option<Vec<i32>>,        // Index of node in Mesh for the start of the member element [-]
    pub meshindx2: Option<Vec<i32>>,        // Index of node in Mesh for the end of the member element [-]
    pub memberindx1: Option<Vec<i32>>,      // Index of Member nodes for the start of the member element [-]
    pub memberindx2: Option<Vec<i32>>,      // Index of Member nodes for the end of the member element [-]
    pub s: Option<Vec<f64>>,                 // Linear interpolation factor between node1 and node2 for the output location [-]
}
```
# 问题2 array数组定义
<<<<<<< HEAD
```rust
=======
```
>>>>>>> 43e7b08163ff98d031f47a55e6d8abfb871edb14
pub struct AD_Init{
    pub Ct_final:                   ArrayBase<OwnedRepr<f64>, Dim<[usize; 3]>>,
    pub Cq_final:                   ArrayBase<OwnedRepr<f64>, Dim<[usize; 3]>>,
    pub CP_final:                   ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>,
    pub position_g:                 Vec<[ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>; 3]>,
    pub trans_disp:                 Vec<[ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>; 3]>,
}
impl AD_Init {
    pub fn new() -> Self {
            Ct_final: ArrayBase::zeros((0, 0, 0)),
            Cq_final: ArrayBase::zeros((0, 0, 0)),
            CP_final: ArrayBase::zeros(0),
            position_g: Vec::new(),
            trans_disp: Vec::new(),
    }
 }
   
```
<<<<<<< HEAD
```rust
=======
```
>>>>>>> 43e7b08163ff98d031f47a55e6d8abfb871edb14
pub struct EDParameterType{
pub r_nodes: Array1<f64>, // 分析节点到轮毂的半径
pub pitch_axis: Array2<f64>, // 分析节点的变桨轴
pub twr_fasf: Array3<f64>, // 塔前后形状函数
pub twr_sssf: Array3<f64>, // 塔侧向形状函数
(ArrayBase<OwnedRepr<f64>, Dim<[usize; 3]>>)
}
impl EDParameterType {
    pub fn new() -> EDParameterType {
        EDParameterType {
        // 初始化一个任意维度
        r_nodes: Array1::zeros(1),
        pitch_axis: Array2::zeros((1, 1)),
        twr_fasf: Array3::zeros((3, 3, 3)),
        twr_sssf: Array3::zeros((3, 3, 3)),
        }
}
}
```
<<<<<<< HEAD
```rust
=======
```
>>>>>>> 43e7b08163ff98d031f47a55e6d8abfb871edb14
// 在代码中根据需要创建维度
p.r_nodes = Array1::zeros(p.bld_nodes as usize);
p.pitch_axis = Array2::zeros((p.num_bl as usize, p.bld_nodes as usize));
p.twr_fasf = Array3::zeros((2, p.t_top_node as usize+ 1, 3));
```