Skip to main content

Project

Struct Project 

Source
pub struct Project {
Show 34 fields pub format: Option<String>, pub format_version: Option<u32>, pub name: String, pub glass_catalogs: Vec<String>, pub coatings: BTreeMap<String, CoatSpec>, pub coating_file: Option<String>, pub macros: Vec<Macro>, pub wavelengths: Vec<Wave>, pub primary: usize, pub aperture: ApertureSpec, pub fields: FieldsSpec, pub object_distance: Option<f64>, pub aiming: Aiming, pub telecentric: bool, pub afocal: Option<String>, pub floating_clip: bool, pub mech_clip: bool, pub apodization: Apodization, pub ropd: i64, pub aim_pupil: AimPupil, pub input_pol: InputPolarization, pub glass_template: GlassTemplate, pub vig_interp: Option<VigInterp>, pub blocks: Vec<Block>, pub states: Vec<State>, pub path: Option<String>, pub beams: Vec<Beam>, pub turn: Option<BlockFace>, pub mechanics: Vec<MechPlacement>, pub glrs: Option<BlockRef>, pub environment: Environment, pub image: Option<Box<Row>>, pub object: Option<Box<Row>>, pub gui: Option<Value>,
}

Fields§

§format: Option<String>

形式の印 “lensbench-project”。書くときはいつも付ける(省略したファイルは今の版として読む)

§format_version: Option<u32>

形式の版(今は 1)。読める版より新しければ誤り

§name: String§glass_catalogs: Vec<String>§coatings: BTreeMap<String, CoatSpec>

膜(名前 → フィルタの透過特性・表)。面の coat に名前を書いて使う。ユーザーカタログの同じ名前より優先

§coating_file: Option<String>

膜ファイル(OpticStudio の COATING.DAT の形)。面の coat の名前を、coatings に無ければこのファイルで引く。 相対パスはプロジェクトのフォルダから、そこに無ければ材料の検索フォルダから。取り込んだ .zmx の膜ファイルより優先

§macros: Vec<Macro>

ZPL のマクロ(名前 name と文 source、.ZPL の中身)。ブロックの surface_ops の add_solve で種類 macro_curv・macro_thick の param にこの並びの番号(0 始まり)を書いて使う。マクロのファイルは読まない

§wavelengths: Vec<Wave>§primary: usize

主波長の番号(1 始まり)

§aperture: ApertureSpec§fields: FieldsSpec§object_distance: Option<f64>

物体面から最初のブロックまで [mm](省略で無限遠)

§aiming: Aiming§telecentric: bool

物体側テレセントリック(物体距離が有限のときだけ)

§afocal: Option<String>

像空間をアフォーカルにする。値は角度の単位(ur・mr・rr・as・am・dg)

§floating_clip: bool

浮動開口(半直径を固定した面)の外の光線をけるか(既定はける。OpticStudio と同じ)

§mech_clip: bool

機構部品(mechanics)の穴の外に出た光線を、解析の光線追跡でもけるか(既定はける。false ならけられは 機構のケラレの解析だけで見て、レイアウト図では切られる点から後ろを薄く描く)

§apodization: Apodization

瞳の振幅の分布("uniform"・{"gaussian": G}・"cosine_cubed"。省略は一様)

§ropd: i64

OPD の基準(.zmx の ROPD。省略は 2: 出射瞳の参照球)

§aim_pupil: AimPupil

光線エイミングの瞳のずれ・圧縮(.zmx の PUSH と RAIM の 10 番目。追跡には効かない)。省略は全部 0

§input_pol: InputPolarization

系の入射偏光(.zmx の POLS。膜・偏光を入れる解析の入射の偏光)。省略は偏光なし

§glass_template: GlassTemplate

ガラス置換のテンプレート(OpticStudio の Glass Substitution Template、.zmx の GSTD)。最適化のガラスの置き換えの候補を絞る

§vig_interp: Option<VigInterp>

定義した視野以外の点のケラレ係数の求め方("continuous"・"opticstudio"。省略は連続)

§blocks: Vec<Block>§states: Vec<State>§path: Option<String>

ビームスプリッターの経路(BS を通る順の T・R)。省略で各 BS の arm。状態の project でも変えられる

§beams: Vec<Beam>

光束の組(名前つきの経路)。光束の名前は状態の名前の代わりに使え、光束の状態を当てて経路を選んだ系になる

§turn: Option<BlockFace>

当てた光束の turn(Beam::turn)。Project::with_state で光束から写す(ファイルには書かない)

§mechanics: Vec<MechPlacement>

機構部品(チューブ・ケージ板・マウント)。光線の追跡は変えず、ケラレの確認(mech-check)と描画に使う

§glrs: Option<BlockRef>

大域座標の基準の面(.zmx の GLRS。書き出し・3D の座標の原点)。ブロックの面 {"block": id, "surface": i} か、 展開した系の面の番号か名前。省略で面 1

§environment: Environment

温度・気圧(ガラスの屈折率の計算)。省略で 20 °C・1 atm・補正なし

§image: Option<Box<Row>>

像面(省略は平面で傾きなし)。システムファイル(版 2)の面の行で、形・面の前の傾き偏心・開口などを書く。 厚さ・媒質・絞りの印は書けない

§object: Option<Box<Row>>

物体面の形・開口・物体空間の媒質(省略は平面で開口なし・空気)。image と同じ面の行で、厚さは object_distance。medium は物体空間の媒質(液浸など)。厚さ・絞りの印・傾き偏心は書けない

§gui: Option<Value>

GUI が自分の編集の状態(組合せの表など)を残す欄。展開には使わない

Implementations§

Source§

impl Project

Source

pub fn check_beams(&self) -> Result<(), Error>

光束の組の誤り: 名前の空・重なり(光束どうし・状態と)、無い状態、経路の文字

Source

pub fn beam_names(&self) -> Vec<&str>

光束の名前(Project::beams の順)

Source

pub fn beam(&self, name: &str) -> Option<&Beam>

名前が name の光束

Source

pub fn beam_takes_path(&self, name: &str, path_given: bool) -> Result<(), Error>

状態・光束の名前 name と一緒に別の経路を渡してよいか(経路を持つ光束には渡せない)

Source

pub fn with_state_and_path( &self, name: &str, path_given: bool, ) -> Result<Project, Error>

Project::with_state。別の経路を渡すなら(path_given)、経路を持つ光束は誤り

Source§

impl Project

Source

pub fn detector(&self) -> Option<&DetectorBlock>

最後のブロックの検出器(なければ None)

Source§

impl Project

Source

pub fn load(path: &Path) -> Result<Project, Error>

プロジェクトファイルを読む(相対パスの基準は Env::for_file)

Source

pub fn from_json(txt: &str) -> Result<Project, Error>

Source

pub fn to_json(&self) -> String

プロジェクトの JSON(形式の印と版、先頭に $schema をいつも付ける)

Source

pub fn state_names(&self) -> Vec<&str>

Source

pub fn with_state(&self, name: &str) -> Result<Project, Error>

状態 name の変更を当てたプロジェクト(状態の一覧は残す)。name が光束の名前なら、光束の状態を当て、経路を 光束の経路にする

Trait Implementations§

Source§

impl Clone for Project

Source§

fn clone(&self) -> Project

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Project

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Project

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Project, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for Project

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl Serialize for Project

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Parallelizable for T
where T: Send + Sync,

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,