Skip to content

Commit

Permalink
[FTheoryTools] Serialization sets cox rings of base and ambient space…
Browse files Browse the repository at this point in the history
… correctly
  • Loading branch information
HereAround committed Oct 1, 2024
1 parent 75d5d22 commit 3642acb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,17 @@ end
##########################################

function load_object(s::DeserializerState, ::Type{<:HypersurfaceModel}, params::Tuple{NormalToricVariety, NormalToricVariety, NormalToricVariety, <:MPolyRing, <:MPolyRing})
base_space, ambient_space, fiber_ambient_space, R1, R2 = params
base_space, amb_space, fiber_ambient_space, R1, R2 = params
defining_equation = load_object(s, MPolyRingElem, R1, :hypersurface_equation)
defining_equation_parametrization = load_object(s, MPolyRingElem, R2, :hypersurface_equation_parametrization)
explicit_model_sections = haskey(s, :explicit_model_sections) ? load_typed_object(s, :explicit_model_sections) : Dict{String, MPolyRingElem}()
defining_classes = haskey(s, :defining_classes) ? load_typed_object(s, :defining_classes) : Dict{String, ToricDivisorClass}()
model = HypersurfaceModel(explicit_model_sections, defining_equation_parametrization, defining_equation, base_space, ambient_space, fiber_ambient_space)
model = HypersurfaceModel(explicit_model_sections, defining_equation_parametrization, defining_equation, base_space, amb_space, fiber_ambient_space)
model.defining_classes = defining_classes
attrs_data = haskey(s, :__attrs) ? load_typed_object(s, :__attrs) : Dict{Symbol, Any}()
for (key, value) in attrs_data
set_attribute!(model, Symbol(key), value)
end
@req cox_ring(ambient_space(model)) == parent(hypersurface_equation(model)) "Hypersurface polynomial not in Cox ring of toric ambient space"
return model
end
6 changes: 3 additions & 3 deletions experimental/FTheoryTools/src/Serialization/tate_models.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ function save_type_params(s::SerializerState, gtm::GlobalTateModel)
save_data_dict(s) do
save_object(s, encode_type(GlobalTateModel), :name)
base, ambient, tp_ring = base_space(gtm), ambient_space(gtm), parent(tate_polynomial(gtm))

save_data_dict(s, :params) do
for (obj, key) in [(base, :base_space), (ambient, :ambient_space), (tp_ring, :tate_polynomial_ring)]
if serialize_with_id(obj)
Expand Down Expand Up @@ -68,16 +67,17 @@ end
#########################################

function load_object(s::DeserializerState, ::Type{<: GlobalTateModel}, params::Tuple{NormalToricVariety, NormalToricVariety, MPolyDecRing})
base_space, ambient_space, tp_ring = params
base_space, amb_space, tp_ring = params
pt = load_object(s, MPolyDecRingElem, tp_ring, :tate_polynomial)
explicit_model_sections = haskey(s, :explicit_model_sections) ? load_typed_object(s, :explicit_model_sections) : Dict{String, MPolyRingElem}()
defining_section_parametrization = haskey(s, :defining_section_parametrization) ? load_typed_object(s, :defining_section_parametrization) : Dict{String, MPolyRingElem}()
defining_classes = haskey(s, :defining_classes) ? load_typed_object(s, :defining_classes) : Dict{String, ToricDivisorClass}()
model = GlobalTateModel(explicit_model_sections, defining_section_parametrization, pt, base_space, ambient_space)
model = GlobalTateModel(explicit_model_sections, defining_section_parametrization, pt, base_space, amb_space)
model.defining_classes = defining_classes
attrs_data = haskey(s, :__attrs) ? load_typed_object(s, :__attrs) : Dict{Symbol, Any}()
for (key, value) in attrs_data
set_attribute!(model, Symbol(key), value)
end
@req cox_ring(ambient_space(model)) == parent(tate_polynomial(model)) "Tate polynomial not in Cox ring of toric ambient space"
return model
end
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ function save_type_params(s::SerializerState, w::WeierstrassModel)
save_data_dict(s) do
save_object(s, encode_type(WeierstrassModel), :name)
base, ambient, wp_ring = base_space(w), ambient_space(w), parent(weierstrass_polynomial(w))

save_data_dict(s, :params) do
for (obj, key) in [(base, :base_space), (ambient, :ambient_space), (wp_ring, :weierstrass_polynomial_ring)]
if serialize_with_id(obj)
Expand Down Expand Up @@ -68,16 +67,17 @@ end
#########################################

function load_object(s::DeserializerState, ::Type{<: WeierstrassModel}, params::Tuple{NormalToricVariety, NormalToricVariety, MPolyDecRing})
base_space, ambient_space, wp_ring = params
base_space, amb_space, wp_ring = params
pw = load_object(s, MPolyDecRingElem, wp_ring, :weierstrass_polynomial)
explicit_model_sections = haskey(s, :explicit_model_sections) ? load_typed_object(s, :explicit_model_sections) : Dict{String, MPolyRingElem}()
defining_section_parametrization = haskey(s, :defining_section_parametrization) ? load_typed_object(s, :defining_section_parametrization) : Dict{String, MPolyRingElem}()
defining_classes = haskey(s, :defining_classes) ? load_typed_object(s, :defining_classes) : Dict{String, ToricDivisorClass}()
model = WeierstrassModel(explicit_model_sections, defining_section_parametrization, pw, base_space, ambient_space)
model = WeierstrassModel(explicit_model_sections, defining_section_parametrization, pw, base_space, amb_space)
model.defining_classes = defining_classes
attrs_data = haskey(s, :__attrs) ? load_typed_object(s, :__attrs) : Dict{Symbol, Any}()
for (key, value) in attrs_data
set_attribute!(model, Symbol(key), value)
end
@req cox_ring(ambient_space(model)) == parent(weierstrass_polynomial(model)) "Weierstrass polynomial not in Cox ring of toric ambient space"
return model
end

0 comments on commit 3642acb

Please sign in to comment.