예제 #1
0
파일: topo_adapt.py 프로젝트: xyuan/tmr
            lower[i] = max(hmin, 0.25 * h[i])
            upper[i] = min(hmax, 2.0 * h[i])

        # Optimize the mesh
        hvals = optimize_mesh(h,
                              errors,
                              mass_errors,
                              lower,
                              upper,
                              element_count_target,
                              s,
                              d,
                              mass_error_ratio=args.mass_error_ratio)

        # Allocate the feature size object
        feature_size = TMR.PointFeatureSize(Xpt, hvals, hmin, hmax)
    else:
        size = error.shape[0]
        comm.gather(size, root=root)
        comm.Gatherv(error, None)
        comm.Gatherv(mass_error, None)
        comm.Gatherv(Xp.flatten(), None)
        comm.Gatherv(xrho, None)

        # Create a dummy feature size object...
        feature_size = TMR.ConstElementSize(0.5 * htarget)

    # Create the surface mesh
    mesh.mesh(fs=feature_size, opts=opts)

    # Create the corresponding mesh topology from the mesh-model
예제 #2
0
                if feature_size is not None:
                    for i, hp in enumerate(hvals):
                        hlocal = feature_size.getFeatureSize(Xpt[i, :])
                        hvals[i] = np.min((np.max(
                            (hp * hlocal, 0.25 * hlocal)), 2 * hlocal))
                else:
                    for i, hp in enumerate(hvals):
                        hvals[i] = np.min((np.max(
                            (hp * htarget, 0.25 * htarget)), 2 * htarget))

                # Allocate the feature size object
                hmax = 10.0
                hmin = 0.1
                feature_size = TMR.PointFeatureSize(Xpt,
                                                    hvals,
                                                    hmin,
                                                    hmax,
                                                    num_sample_pts=12)
            else:
                size = error.shape[0]
                comm.gather(size, root=root)
                comm.Gatherv(error, None)
                comm.Gatherv(Xp.flatten(), None)

                # Create a dummy feature size object...
                feature_size = TMR.ConstElementSize(0.5 * htarget)

            # Create the surface mesh
            mesh.mesh(fs=feature_size, opts=opts)

            # Create the corresponding mesh topology from the mesh-model