def test_WriteEntityDataMdpa_conditions(self):
        mp = ModelPart()
        mp.CreateNewNode(1, 0.0, 0.0, 0.0) # coordinates do not matter here

        props = mp.CreateNewProperties(1)

        for i in range(14):
            cond = mp.CreateNewCondition("OneCondition", i+1, [1], props)
            cond.SetValue("Mwwz", 1+i*3)
            cond.SetValue("AAbqbCC", 1.336E6*i)
            if i%3==0:
                cond.SetValue("SomeMatrix", [[2, i+2, 3.3], [i+2, 5.3, 7.456]]) # matrix
            if i%4==0:
                cond.SetValue("YOUNG", 2397+5*i)

        file_name = "entity_data_conditions.mdpa"
        with open(file_name, 'w') as mdpa_file:
            write_mdpa._WriteEntityDataMdpa(mp.Conditions, "Condition", mdpa_file)

        CompareMdpaWithReferenceFile(file_name, self)
Exemple #2
0
    def test_WriteEntitiesMdpa_conditions(self):
        mp = ModelPart()
        for i in range(6):
            mp.CreateNewNode(i + 1, 0.0, 0.0,
                             0.0)  # coordinates do not matter here

        props_1 = mp.CreateNewProperties(1)
        props_2 = mp.CreateNewProperties(15)

        for i in range(17):
            if i % 5 == 0:
                props = props_2
            else:
                props = props_1

            mp.CreateNewCondition("MainCondition", i + 1,
                                  [i % 3 + 1, i % 6 + 1, i % 2 + 1], props)

        file_name = "conditions.mdpa"
        with open(file_name, 'w') as mdpa_file:
            write_mdpa._WriteEntitiesMdpa(mp.Conditions, "Condition",
                                          mdpa_file)

        CompareMdpaWithReferenceFile(file_name, self)