Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
mif = '# Exchange6Ngbr\n'
mif += 'Specify Oxs_Exchange6Ngbr {\n'
mif += f' default_A {default_value}\n'
mif += ' atlas :main_atlas\n'
mif += ' A {\n'
for key, value in self.A.items():
if key != 'default':
if ':' in key:
region1, region2 = key.split(':')
else:
region1, region2 = key, key
mif += f' {region1} {region2} {value}\n'
mif += ' }\n'
mif += '}\n\n'
elif isinstance(self.A, df.Field):
Amif, Aname = ou.setup_scalar_parameter(self.A, 'ex_A')
mif = Amif
mif += '# ExchangePtwise\n'
mif += 'Specify Oxs_ExchangePtwise {\n'
mif += f' A {Aname}\n'
mif += '}\n\n'
return mif
def _script(self):
k1mif, k1name = ou.setup_scalar_parameter(self.K1, 'ua_K1')
umif, uname = ou.setup_vector_parameter(self.u, 'ua_u')
mif = ''
mif += k1mif
mif += umif
mif += '# UniaxialAnisotropy\n'
mif += 'Specify Oxs_UniaxialAnisotropy {\n'
mif += f' K1 {k1name}\n'
mif += f' axis {uname}\n'
mif += '}\n\n'
return mif
def _script(self):
k1mif, k1name = ou.setup_scalar_parameter(self.K1, 'ca_K1')
u1mif, u1name = ou.setup_vector_parameter(self.u1, 'ca_u1')
u2mif, u2name = ou.setup_vector_parameter(self.u2, 'ca_u2')
mif = ''
mif += k1mif
mif += u1mif
mif += u2mif
mif += '# CubicAnisotropy\n'
mif += 'Specify Oxs_CubicAnisotropy {\n'
mif += f' K1 {k1name}\n'
mif += f' axis1 {u1name}\n'
mif += f' axis2 {u2name}\n'
mif += '}\n\n'
return mif